/* ═══════════════════════════════════════════════════════
   HealthBridge | Main Site Styles  (style.css)
═══════════════════════════════════════════════════════ */

:root {
  --pure-white: #ffffff;
  --background-light: #f5fafd;
  --text-primary: #122b3f;
  --text-secondary: #2c4b63;
  --accent-medical: #1e88e5;
  --accent-soft: #6ab7ff;
  --border-light: #d9e9f2;
  --hover-bg: #e1f0fa;
  --nav-bg: #0b202f;
  --nav-text: #e0eefb;
  --nav-hover-bg: #1e3a5f;
  --dropdown-bg: #112b3c;
  --dropdown-border: #2b4b65;
  --footer-text: #cbd5e0;
  --footer-heading: #ffffff;
  --shadow-sm: 0 8px 20px rgba(0, 50, 80, 0.08);
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-sans);
}

body {
  background-color: var(--pure-white);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ══════════════════════════
   NAVBAR
══════════════════════════ */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 6%;
  height: 90px;
  background: var(--nav-bg);
  position: sticky;
  top: 0;
  z-index: 10000;
  border-bottom: 2px solid var(--dropdown-border);
}

.logo {
  cursor: pointer;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--nav-text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.logo-hb {
  background: var(--nav-bg);
  color: var(--accent-medical);
  font-size: 1.4rem;
  font-weight: 800;
  padding: 6px 12px;
  border-radius: 10px;
  margin-right: 4px;
  border: 2px solid var(--accent-medical);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.logo > span {
  color: #cddae6;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  cursor: pointer;
  gap: 6px;
  z-index: 10002;
  padding: 8px;
}
.hamburger span {
  width: 28px;
  height: 3px;
  background: var(--nav-text);
  border-radius: 3px;
  transition: 0.25s;
  display: block;
}
.hamburger.open span:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}
.hamburger.open span:nth-child(2) {
  opacity: 0;
}
.hamburger.open span:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

/* Nav links list */
.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
}

.nav-item {
  position: relative;
}

.nav-item > a {
  text-decoration: none;
  color: var(--nav-text);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 15px 18px;
  display: block;
  transition:
    background 0.2s,
    color 0.2s;
  border-radius: 4px 4px 0 0;
  white-space: nowrap;
}
.nav-item:hover > a,
.nav-item.open > a {
  background: var(--nav-hover-bg);
  color: #fff;
}

.nav-item.has-sub > a::after {
  content: " ▾";
  font-size: 0.65rem;
  opacity: 0.7;
  display: inline;
}
.nav-item.has-sub.open > a::after {
  content: " ▴";
}

/* ══════════════════════════
   DROPDOWNS & MEGA-MENU
══════════════════════════ */
.dropdown,
.mega-menu {
  position: absolute;
  top: 100%;
  background: var(--dropdown-bg);
  border: 2px solid var(--dropdown-border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  box-shadow: var(--shadow-sm);
  z-index: 10001;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.dropdown {
  min-width: 260px;
  padding: 10px 0;
  left: 0;
}
.mega-menu {
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  max-width: 1400px;
  padding: 40px 6%;
}

/* Desktop hover */
@media (min-width: 769px) {
  .nav-item:hover > .dropdown,
  .nav-item:hover > .mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

/* Open class (mobile + desktop fallback) */
.nav-item.open > .dropdown,
.nav-item.open > .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.menu-title {
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: block;
}

/* Desktop: 5-column grid */
.mega-menu-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.mega-menu-grid a,
.dropdown a {
  color: #e0eefb;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 16px;
  display: block;
  transition:
    background 0.15s,
    padding-left 0.15s,
    color 0.15s;
  border-radius: 8px;
}
.dropdown a {
  padding: 12px 22px;
}
.mega-menu-grid a:hover,
.dropdown a:hover {
  background: var(--nav-hover-bg);
  color: #fff;
  padding-left: 24px;
}

/* ══════════════════════════
   HERO
══════════════════════════ */
.hero {
  min-height: 85vh;
  display: flex;
  position: relative;
  background:
    linear-gradient(
      100deg,
      rgba(255, 255, 255, 0.92) 30%,
      rgba(255, 255, 255, 0.5)
    ),
    url("medical.jpg");
  background-size: cover;
  background-position: center 30%;
  background-blend-mode: overlay;
}

.hero-sidebar-accent {
  width: 10px;
  background: var(--accent-medical);
  min-height: 100%;
  opacity: 0.8;
  flex-shrink: 0;
}

.hero-content {
  padding: 80px 6%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.55);
  border-radius: 20px;
  max-width: fit-content;
}

.hero h1 {
  font-size: 4.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -2px;
  margin-bottom: 40px;
  color: var(--text-primary);
}
.hero h1 span {
  color: var(--accent-medical);
  -webkit-text-fill-color: var(--accent-medical);
}

.hero-body-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  align-items: flex-start;
  gap: 60px;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.15rem;
  line-height: 1.7;
  border-left: 4px solid var(--accent-soft);
  padding-left: 24px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(2px);
  border-radius: 0 20px 20px 0;
}

.btn-primary-sharp {
  background: #0b202f;
  color: #fff;
  border: none;
  padding: 22px 46px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.25s ease;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-radius: 40px;
  box-shadow: 0 15px 30px -10px rgba(30, 136, 229, 0.3);
  white-space: nowrap;
}
.btn-primary-sharp:hover {
  background: #000;
  transform: translateY(-4px);
  box-shadow: 0 25px 35px -10px #cedfed;
}

/* ══════════════════════════
   FOOTER
══════════════════════════ */
.footer {
  background: var(--nav-bg);
  padding: 80px 8% 40px;
  border-top: 2px solid var(--dropdown-border);
  color: var(--footer-text);
}
.footer-container {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 80px;
}
.brand-mark {
  font-weight: 900;
  font-size: 1.6rem;
  border: 3px solid var(--accent-medical);
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  color: var(--accent-medical);
  border-radius: 12px;
  background: var(--nav-bg);
}
.footer-section h2 {
  margin-bottom: 15px;
  font-weight: 800;
  color: var(--footer-heading);
}
.footer-section h2 span {
  color: var(--accent-medical);
}
.footer-section p {
  color: var(--footer-text);
  font-size: 0.95rem;
  line-height: 1.8;
  opacity: 0.9;
}
.footer-section ul {
  list-style: none;
}
.footer-section ul li {
  margin-bottom: 12px;
}
.footer-section a {
  text-decoration: none;
  color: var(--footer-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: 0.2s;
}
.footer-section a:hover {
  color: var(--accent-medical);
  padding-left: 6px;
}
.label-heading {
  color: var(--accent-soft);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.75rem;
  font-weight: 800;
  margin-bottom: 20px;
  display: block;
}
.footer-bottom {
  text-align: center;
  margin-top: 70px;
  padding-top: 25px;
  border-top: 1px solid var(--dropdown-border);
  color: #8fa3b8;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ══════════════════════════
   AUTH MODAL
══════════════════════════ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 20000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.auth-modal-content {
  background: #fff;
  max-width: 460px;
  width: 100%;
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  max-height: 92vh;
  overflow-y: auto;
}

.auth-tabs {
  display: flex;
  background: var(--background-light);
  border-bottom: 2px solid var(--border-light);
}
.auth-tab {
  flex: 1;
  padding: 18px 10px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  color: #8fa3b8;
  transition: all 0.2s;
  margin-bottom: -2px;
}
.auth-tab.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-medical);
  background: #fff;
}

.auth-panel {
  padding: 32px 36px 28px;
  display: flex;
  flex-direction: column;
}
.auth-panel.hidden {
  display: none;
}

.auth-panel h3 {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.auth-subtitle {
  color: #8fa3b8;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-secondary);
  margin-top: 18px;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.auth-panel input {
  width: 100%;
  padding: 13px 18px;
  border: 1.5px solid var(--border-light);
  border-radius: 40px;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--background-light);
  outline: none;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.auth-panel input:focus {
  border-color: var(--accent-medical);
  background: #fff;
}

/* Primary action button */
.auth-panel > button:not(.close-modal):not(.toggle-btn) {
  width: 100%;
  padding: 15px;
  background: var(--text-primary);
  color: #fff;
  border: none;
  border-radius: 40px;
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 24px;
  transition:
    background 0.2s,
    transform 0.2s,
    opacity 0.2s;
}
.auth-panel > button:not(.close-modal):not(.toggle-btn):hover:not(:disabled) {
  background: var(--accent-medical);
  transform: translateY(-2px);
}
.auth-panel > button:not(.close-modal):not(.toggle-btn):disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Cancel button */
.close-modal {
  width: 100%;
  padding: 12px !important;
  background: transparent !important;
  color: #8fa3b8 !important;
  border: 1.5px solid var(--border-light) !important;
  border-radius: 40px !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  cursor: pointer;
  margin-top: 10px !important;
  transition: all 0.2s;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.close-modal:hover {
  border-color: #8fa3b8 !important;
  color: var(--text-primary) !important;
}

/* Account type toggle */
.toggle-group {
  display: flex;
  background: var(--background-light);
  border-radius: 40px;
  padding: 4px;
  margin-top: 8px;
  margin-bottom: 4px;
}
.toggle-btn {
  flex: 1;
  padding: 10px;
  border: none;
  border-radius: 36px;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  background: transparent;
  color: #8fa3b8;
  transition: all 0.2s;
}
.toggle-btn.active {
  background: var(--text-primary);
  color: #fff;
}

.switch-hint {
  text-align: center;
  font-size: 0.85rem;
  color: #8fa3b8;
  margin-top: 16px;
}
.switch-hint span {
  color: var(--accent-medical);
  cursor: pointer;
  font-weight: 700;
}
.switch-hint span:hover {
  text-decoration: underline;
}

/* ══════════════════════════
   SERVICE RESULT BOX
══════════════════════════ */
#resultBox {
  display: none;
  background: var(--pure-white);
  border-radius: 28px;
  padding: 32px;
  margin: 40px auto;
  max-width: 800px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
#predictionResult,
#predictionScore {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text-primary);
}
.advice-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--border-light);
}
.advice-section h4 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-medical);
  margin: 16px 0 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.advice-section p {
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--background-light);
  padding: 12px 16px;
  border-radius: 20px;
  margin-bottom: 8px;
}

/* ══════════════════════════
   RESPONSIVE — TABLET ≤ 1024px
══════════════════════════ */
@media (max-width: 1024px) {
  .navbar {
    padding: 0 4%;
  }
  .nav-item > a {
    padding: 12px 14px;
    font-size: 0.78rem;
  }
  .mega-menu-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ══════════════════════════
   RESPONSIVE — MOBILE ≤ 768px
══════════════════════════ */
@media (max-width: 768px) {
  /* Show hamburger */
  .hamburger {
    display: flex;
  }

  /* Slide-in sidebar — full width of viewport, no overflow */
  .nav-links {
    position: fixed;
    top: 90px;
    left: -100%;
    width: 100%; /* full width so nothing bleeds outside */
    max-width: 100%;
    height: calc(100vh - 90px);
    background: var(--nav-bg);
    flex-direction: column;
    padding: 12px 0;
    gap: 0;
    transition: left 0.3s ease;
    z-index: 10001;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .nav-links.active {
    left: 0;
  }

  .nav-item {
    width: 100%;
  }

  .nav-item > a {
    padding: 14px 22px;
    font-size: 0.82rem;
    border-radius: 0;
  }

  /* Mobile: static flow, hidden by default */
  .dropdown,
  .mega-menu {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: rgba(0, 0, 0, 0.25) !important;
    padding: 8px 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: none;
    overflow: hidden;
  }

  .nav-item.open > .dropdown,
  .nav-item.open > .mega-menu {
    display: block !important;
  }

  /* Mega-menu content padding */
  .mega-menu-content {
    padding: 10px 12px;
  }

  .menu-title {
    font-size: 0.68rem;
    margin-bottom: 10px;
    padding-left: 4px;
  }

  /* ✅ KEY FIX: 2-column grid on mobile, contained within viewport */
  .mega-menu-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 2px !important;
    width: 100% !important;
  }

  .mega-menu-grid a {
    padding: 9px 12px !important;
    font-size: 0.78rem !important;
    border-radius: 6px !important;
    white-space: normal !important;
    word-break: break-word;
    line-height: 1.3;
  }
  .mega-menu-grid a:hover {
    padding-left: 16px !important;
  }

  .dropdown a {
    padding: 11px 28px;
    font-size: 0.82rem;
    border-radius: 4px;
  }
  .dropdown a:hover {
    padding-left: 34px;
  }

  /* Hero */
  .hero {
    min-height: 70vh;
  }
  .hero-content {
    margin: 16px;
    padding: 28px 20px;
  }
  .hero-body-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .hero p {
    font-size: 1rem;
  }
  .btn-primary-sharp {
    padding: 16px 32px;
  }

  /* Footer */
  .footer-container {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  /* Modal */
  .auth-panel {
    padding: 24px 20px 20px;
  }
  .auth-panel h3 {
    font-size: 1.5rem;
  }

  #resultBox {
    margin: 20px;
    padding: 24px;
  }
}

/* ══════════════════════════
   RESPONSIVE — SMALL PHONE ≤ 480px
══════════════════════════ */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 2.4rem;
  }
  .btn-primary-sharp {
    padding: 14px 28px;
    font-size: 0.85rem;
  }
  .logo {
    font-size: 1.45rem;
  }
  .logo-hb {
    font-size: 1.2rem;
    padding: 5px 10px;
  }
  #predictionResult,
  #predictionScore {
    font-size: 1.1rem;
  }
}
