/* Theme variables (default: dark) */
:root {
  --bg: #0b1220;
  --surface: #0f1724;
  --muted: #9aa4b2;
  --text: #e6eef8;
  --primary: #2563eb;
  --border: rgba(255,255,255,0.12);
}

/* Light mode overrides */
html.light-mode {
  --bg: #f8f9fa;
  --surface: #ffffff;
  --muted: #6c757d;
  --text: #0b1220;
  --primary: #0d6efd;
  --border: rgba(0,0,0,0.08);
}

html {
  font-size: 14px;
  height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Make the main container grow so footer is pushed to bottom */
body > .container {
  flex: 1 0 auto;
}

/* Ensure footer doesn't shrink */
.footer {
  flex-shrink: 0;
}

/* Navbar */
.navbar, .navbar-light.bg-white {
  background-color: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
}
.navbar .navbar-brand, .navbar .nav-link, .navbar-text {
  color: var(--text) !important;
}

/* Highlight username and buttons remain visible */
.navbar-text {
  color: var(--text) !important;
}
.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #fff !important;
}
.btn-link, .nav-link.btn.btn-link {
  color: var(--text) !important;
}

/* Forms and controls */
.form-control, textarea, select {
  background-color: rgba(7,19,27,0.7) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
html.light-mode .form-control, html.light-mode textarea, html.light-mode select {
  background-color: #fff !important;
}
.form-control::placeholder {
  color: var(--muted) !important;
}
.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--muted);
  text-align: end;
}
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Cards, panels, footers */
.card, .bg-white, .container, main, footer {
  background-color: transparent !important;
  color: var(--text) !important;
}
.footer, .border-top.footer.text-muted {
  color: var(--muted) !important;
  border-top-color: var(--border) !important;
}

/* Tables and lists */
table, th, td, .list-group-item {
  background-color: transparent !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

/* Focus outlines */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem rgba(0,0,0,0.06), 0 0 0 0.25rem rgba(37,99,235,0.25) !important;
}

/* Utility to ensure links are readable */
a { color: var(--primary) !important; }

/* Small button variants used in navbar */
.btn-sm {
  padding: .25rem .5rem;
  font-size: .875rem;
}

/* Navbar toggler - improve contrast on small screens */
.navbar-toggler {
  border: 2px solid var(--text) !important;
  padding: 0.35rem 0.55rem !important;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23e6eef8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M 4 7 L 26 7 M 4 15 L 26 15 M 4 23 L 26 23'/%3e%3c/svg%3e") !important;
  background-size: 100%;
  background-repeat: no-repeat;
  width: 1.5em;
  height: 1.5em;
}

html.light-mode .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%230b1220' stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M 4 7 L 26 7 M 4 15 L 26 15 M 4 23 L 26 23'/%3e%3c/svg%3e") !important;
}

/* Theme toggle button tweaks */
#theme-toggle {
  min-width: 48px;
}

/* Align theme toggle button in navbar dropdown mode */
@media (max-width: 575px) {
  #theme-toggle {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0.5rem;
  }
}

/* Dark-mode: increase visibility of borders for cards and form controls
   Keep light-mode unchanged. Use a slightly stronger border for key surfaces. */
html:not(.light-mode) .card,
html:not(.light-mode) .form-control,
html:not(.light-mode) table,
html:not(.light-mode) th,
html:not(.light-mode) td,
html:not(.light-mode) .list-group-item,
html:not(.light-mode) .navbar,
html:not(.light-mode) .footer {
  border-color: rgba(255,255,255,0.18) !important;
}

/* Compact footer lines: used for the small footer links to reduce vertical gaps */
.footer .footer-line {
  display: block;
  margin: 1.5rem 1.5rem 1.5rem 1.5rem;
  padding: 0;
  line-height: 1.3;
  font-size: 1rem;
}

/* Responsive logo sizing */
.cellim-logo {
  height: 120px;
  width: auto;
  max-width: 100%;
}

@media (max-width: 576px) {
  .cellim-logo {
    height: 80px;
  }
}

@media (max-width: 480px) {
  .cellim-logo {
    height: 60px;
  }
}

/* Responsive index page text sizing */
.index-text {
  font-size: 18px;
  margin-bottom: 1rem;
}

@media (max-width: 576px) {
  .index-text {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .index-text {
    font-size: 14px;
  }
}
