/* --------------------------------------------------
   LIGHT THEME (Default)
-------------------------------------------------- */

:root {
  --bg-body: #f8f9fa;
  --bg-card: #ffffff;
  --text-main: #212529;
  --text-muted: #6c757d;
  --text-heading: #212529;
  --nav-bg: #1f1f1f;
  --footer-bg: #1f1f1f;
  --border-color: #d0d0d0;
}

/* Global mobile rendering fixes (iPhone + Android) */
html, body {
  background-color: var(--bg-body);
  color: var(--text-main);

  /* Prevent Safari/Chrome from auto-adjusting text */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  /* Tell browsers we support both themes */
  color-scheme: light dark;

  /* Prevent Android Chrome from forcing dark mode */
  forced-color-adjust: none;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-heading) !important;
}

.bg-white, .card, .p-4 {
  background-color: var(--bg-card) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.navbar-dark {
  background-color: var(--nav-bg) !important;
}

footer {
  background-color: var(--footer-bg) !important;
}

/* --------------------------------------------------
   DARK THEME (Bootstrap‑Aligned)
-------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-body: #212529;
    --bg-card: #2b3035;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;

    /* iPhone + Android friendly off-white */
    --text-heading: #f5f7fa;

    --nav-bg: #1c1f23;
    --footer-bg: #1c1f23;
    --border-color: #495057;
  }

  body {
    background-color: var(--bg-body);
    color: var(--text-main);
  }

  .bg-white, .card, .p-4 {
    background-color: var(--bg-card) !important;
  }

  .text-muted {
    color: var(--text-muted) !important;
  }

  h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading) !important;
  }

  .form-control {
    background-color: #2b3035;
    border-color: var(--border-color);
    color: var(--text-main);
  }

  .form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.15rem rgba(13,110,253,0.35);
  }
}

/* --------------------------------------------------
   MOBILE READABILITY BOOST (iPhone + Android)
-------------------------------------------------- */

@media (max-width: 768px) {
  h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading) !important;

    /* Universal mobile contrast enhancement */
    text-shadow: 0 0 2px rgba(0,0,0,0.35);
  }

  /* Improve text rendering on Android Chrome */
  body, h1, h2, h3, h4, h5, h6 {
    -webkit-font-smoothing: antialiased;
    font-smooth: always;
  }
}
