/* ─── NAV HEADER ─── */
.nav-header {
  background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 32px; height: var(--nav-height);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 99999; box-shadow: var(--shadow-sm);
}
.nav-left { display: flex; align-items: center; }
.nav-center { display: flex; align-items: center; gap: 4px; height: 100%; transition: opacity 0.2s, transform 0.2s; }
.nav-right { display: flex; align-items: center; gap: 12px; transition: opacity 0.2s; }

.logo {
  font-size: 22px; font-weight: 700; color: var(--green); text-decoration: none;
  display: flex; align-items: center; gap: 6px; margin-right: 16px;
}
.logo svg { width: 28px; height: 28px; }
.logo .my { color: var(--green); }
.logo .exam { color: var(--navy); }

.nav-item-wrapper { position: relative; height: 100%; display: flex; align-items: center; }
/* Invisible bridge to prevent hover loss between nav item and dropdown */
.nav-item-wrapper::after { content: ''; position: absolute; bottom: -20px; left: -20px; right: -20px; height: 40px; background: transparent; z-index: 100000; }

.nav-link {
  display: flex; align-items: center; gap: 6px; padding: 10px 16px;
  font-size: 15px; font-weight: 600; color: var(--text-muted);
  text-decoration: none; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; white-space: nowrap; user-select: none;
}
.nav-item-wrapper:hover .nav-link,
a.nav-link:hover { color: var(--text-main); background-color: #f3f4f6; }
.nav-link .chevron { width: 14px; height: 14px; transition: transform 0.2s ease; fill: currentColor; }
.nav-item-wrapper:hover .chevron { transform: rotate(180deg); }

.mer-search-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--gray-200);
  background: var(--white); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition); outline: none;
}
.mer-search-btn:hover { border-color: var(--green); background: var(--green-pale); }
.mer-search-btn svg { width: 18px; height: 18px; display: block; overflow: visible; }
.mer-search-btn svg, .mer-search-btn svg path, .mer-search-btn svg circle { 
  stroke: var(--gray-600); fill: none; stroke-width: 2; 
}
.mer-search-btn:hover svg, .mer-search-btn:hover svg path, .mer-search-btn:hover svg circle { 
  stroke: var(--green); 
}

.login-link {
  font-size: 15px; font-weight: 600; color: var(--text-muted); text-decoration: none;
  padding: 8px 12px; border-radius: 8px; transition: var(--transition); cursor: pointer;
}
.login-link:hover { color: var(--green); }

.user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: white;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 15px; cursor: pointer; transition: var(--transition); position: relative;
}
.user-avatar:hover { background: var(--green-dark); box-shadow: 0 0 0 3px var(--green-light); }

.cta-btn {
  display: flex; align-items: center; gap: 8px; padding: 10px 22px;
  background: var(--green); color: white; border: none; border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  transition: all 0.2s ease; text-decoration: none; white-space: nowrap;
}
.cta-btn:hover { background: var(--green-dark); box-shadow: 0 4px 14px rgba(42,181,115,0.35); transform: translateY(-1px); }
.cta-btn svg { width: 16px; height: 16px; }

/* ─── INLINE EXPANDING SEARCH ─── */
.inline-search-wrapper {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.95);
  width: 550px; max-width: 45vw; opacity: 0; pointer-events: none; transition: all 0.2s ease;
  z-index: 10;
}
.inline-search-wrapper.active {
  opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1);
}

.inline-search-form {
  width: 100%; height: 46px; display: flex; align-items: center; background: var(--white); border-radius: 23px;
  padding: 0 20px; transition: all 0.2s ease; border: 1px solid var(--gray-200); box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.inline-search-wrapper.active .inline-search-form {
  border-color: var(--green); box-shadow: 0 0 0 4px rgba(42, 181, 115, 0.15);
}

.is-icon { width: 18px; height: 18px; stroke: var(--gray-500); fill: none; flex-shrink: 0; }
.inline-search-wrapper.active .is-icon { stroke: var(--green); }

.is-input {
  flex: 1; border: none !important; background: transparent !important; padding: 0 16px !important; font-size: 15px !important;
  font-family: inherit !important; color: var(--navy) !important; outline: none !important; width: 100% !important; box-shadow: none !important; margin: 0 !important;
}
.is-input::placeholder { color: var(--gray-500); font-weight: 500; opacity: 1; }

.is-close {
  width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--gray-100);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--gray-600); transition: all 0.15s; font-size: 14px; flex-shrink: 0; margin-left: 8px;
}
.is-close:hover { background: #E5E7EB; color: #ef4444; }

/* Desktop AJAX Dropdown */
.inline-search-dropdown {
  position: absolute; top: calc(100% + 12px); left: 0; width: 100%;
  background: var(--white); border: 1px solid var(--gray-200); border-radius: 16px;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.15);
  padding: 16px; display: none; max-height: 480px; overflow-y: auto; z-index: 11;
}
/* Only display if wrapper is both active AND explicitly marked to show results */
.inline-search-wrapper.active.has-results .inline-search-dropdown {
  display: block; animation: fadeIn 0.15s ease-out;
}

/* Shared utility styling for desktop results */
.inline-search-dropdown .ms-section-title { font-size: 13px; font-weight: 700; color: var(--gray-400); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; padding-left: 4px; }
.inline-search-dropdown .ms-result-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; text-decoration: none; color: var(--navy); transition: background 0.15s; margin-bottom: 4px; }
.inline-search-dropdown .ms-result-item:hover { background: var(--gray-100); }
.inline-search-dropdown .ms-result-icon { width: 44px; height: 44px; background: #f3f4f6; border-radius: 10px; display: flex; justify-content: center; align-items: center; font-size: 22px; flex-shrink:0; }
.inline-search-dropdown .ms-result-details { display: flex; flex-direction: column; gap: 2px; }
.inline-search-dropdown .ms-result-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.inline-search-dropdown .ms-result-breadcrumb { font-size: 12px; color: var(--gray-500); }
.inline-search-dropdown .ms-highlight { color: var(--green); font-weight: 800; background: rgba(46, 204, 113, 0.1); padding: 0 2px; border-radius: 2px; }
.inline-search-dropdown .ms-no-results { text-align: center; color: var(--gray-500); padding: 32px 24px; font-weight: 500; font-size: 15px; }


/* ═══════════════════════════════════════════
   SECONDARY MENUS — desktop (reference style)
═══════════════════════════════════════════ */
.dropdown-menu {
  position: absolute;
  top: calc(var(--nav-height) - 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15), 0 0 10px rgba(0,0,0,0.02);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
  z-index: 100001; display: flex; overflow: hidden; transform-origin: top center;
}
.nav-item-wrapper:hover .dropdown-menu {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translateX(-50%) translateY(10px);
  transition-delay: 0s;
}

/* Study Resources */
.study-resources-menu { width: 900px; padding: 0; }
.menu-column { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); background: #fff; }
.menu-column:last-child { border-right: none; }
.menu-title-header { font-size: 13px; text-transform: uppercase; font-weight: 700; color: var(--text-light); margin-bottom: 20px; letter-spacing: 0.5px; display: block; }

.level-col { flex: 0 0 260px; background: #f9fafb; padding: 28px 24px; border-right: 1px solid var(--border-color); }
.level-item { display: flex; flex-direction: column; padding: 18px 20px; border-radius: 12px; color: var(--text-main); text-decoration: none; transition: all 0.15s; cursor: pointer; margin-bottom: 8px; border: 1px solid transparent; }
.level-item-header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; }
.level-desc { font-size: 14px; color: var(--text-light); margin-top: 4px; font-weight: 400; }
.level-item.active { background-color: #fff; border-color: var(--border-color); box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
.level-item:hover:not(.active) { background-color: rgba(0,0,0,0.02); }
.level-item .arrow-svg { display: none; stroke: var(--text-main); stroke-width: 2.5; width: 16px; height: 16px; fill: none; }
.level-item.active .arrow-svg { display: block; }

.board-col { padding: 28px 32px; flex: 0 0 280px; }
.sub-column-flex { display: none; flex-direction: column; gap: 4px; }
.sub-column-flex.active { display: flex; animation: fadeIn 0.2s ease forwards; }
.board-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 8px; color: var(--text-muted); text-decoration: none; font-size: 15px; font-weight: 500; transition: all 0.15s; cursor: pointer; margin-bottom: 2px; }
.board-item:hover { background-color: #f3f4f6; color: var(--text-main); }
.board-item.active { background-color: var(--green-light); color: var(--green-dark); font-weight: 600; }
.board-item .inline-arrow { display: none; font-size: 18px; line-height: 1; }
.board-item.active .inline-arrow { display: block; }

.nav-megamenu-col { padding: 28px 32px; flex: 1; background: #fff; }
.nav-megamenu-grid { display: flex; flex-direction: column; gap: 16px; }
.sub-column-grid { display: none; }
.sub-column-grid.active { display: block; animation: fadeIn 0.2s ease forwards; }
.nav-megamenu-card { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: 12px; text-decoration: none; color: var(--text-main); border: 1px solid var(--border-color); transition: all 0.2s; background: #fff; }
.nav-megamenu-card:hover { border-color: var(--green); box-shadow: 0 4px 12px rgba(46,204,113,0.08); transform: translateY(-1px); }
.nav-megamenu-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.icon-maths  { background: #e0e7ff; color: #4338ca; }
.icon-physics { background: #fce7f3; color: #be185d; }
.icon-chem   { background: #dcfce7; color: #15803d; }
.icon-bio    { background: #fef3c7; color: #b45309; }
.icon-fm     { background: #f3e8ff; color: #7e22ce; }
.nav-megamenu-details { display: flex; flex-direction: column; }
.nav-megamenu-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.nav-megamenu-tag  { font-size: 14px; color: var(--text-light); }

/* Tutoring */
.tutoring-menu { width: 800px; padding: 0; flex-direction: row; }
.tutoring-links-col { padding: 32px 40px 40px; flex: 1.3; display: flex; flex-direction: column; gap: 8px; background: #fff; }
.tutoring-links-col .menu-title-header { margin-bottom: 12px; }
.service-link { display: flex; align-items: flex-start; gap: 20px; padding: 10px 8px; border-radius: 12px; text-decoration: none; color: var(--text-main); transition: all 0.2s; }
.service-link:hover { background: #f9fafb; transform: translateX(2px); }
.sv-icon { width: 48px; height: 48px; background: #f3f4f6; border-radius: 14px; display: flex; justify-content: center; align-items: center; font-size: 24px; flex-shrink: 0; }
.sv-text { display: flex; flex-direction: column; gap: 6px; padding-top: 2px; }
.sv-title { font-weight: 700; font-size: 16px; color: #111827; }
.sv-desc  { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.tutoring-promo-col { padding: 36px 36px; flex: 1; background: #1A1A2E; color: #fff; display: flex; flex-direction: column; justify-content: flex-start; }
.trust-badge { display: flex; flex-direction: column; gap: 4px; margin-bottom: 20px; }
.trust-badge .stars { color: #fbbf24; font-size: 16px; letter-spacing: 1px; display: block; }
.trust-badge .trust-text { font-size: 13px; font-weight: 700; color: #f3f4f6; display: block; }
.tutoring-promo-col h3 { font-size: 22px; font-weight: 800; margin-bottom: 12px; line-height: 1.2; letter-spacing: -0.5px; color: white; }
.tutoring-promo-col p  { font-size: 14px; color: #9CA3AF; line-height: 1.6; margin-bottom: 24px; font-weight: 400; }
.promo-btn { display: block; text-align: center; padding: 16px; background: var(--green); color: white; border-radius: 8px; font-size: 16px; font-weight: 700; text-decoration: none; transition: background 0.2s; width: 100%; border: none; cursor: pointer; font-family: inherit; }
.promo-btn:hover { background: var(--green-dark); }

/* User dropdown */
.user-wrapper { position: relative; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; width: 220px;
  background: var(--white); border: 1px solid var(--border-color); border-radius: 16px;
  box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 100001; overflow: hidden; display: flex; flex-direction: column; padding: 8px;
}
.user-dropdown.show { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(4px); }
.user-dropdown .user-info { padding: 12px 14px; border-bottom: 1px solid var(--gray-200); margin-bottom: 4px; }
.user-dropdown .user-info .name  { font-weight: 700; font-size: 15px; }
.user-dropdown .user-info .email { font-size: 12px; color: var(--gray-400); }
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; text-decoration: none; color: var(--navy); font-size: 14px; font-weight: 500; transition: var(--transition); }
.user-dropdown a:hover { background: var(--green-light); color: var(--green); }
.user-dropdown a svg { width: 18px; height: 18px; color: var(--gray-400); }
.user-dropdown .divider { height: 1px; background: var(--gray-200); margin: 4px 0; }
.user-dropdown .logout { color: #e53e3e; }
.user-dropdown .logout:hover { background: #fff5f5; color: #c53030; }
.user-dropdown .logout svg { color: #e53e3e; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }


/* ─── MOBILE HEADER ─── */
.mobile-header {
  display: none; background: var(--white); border-bottom: 1px solid var(--gray-200);
  padding: 0 16px; height: 64px; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 99999; box-shadow: var(--shadow-sm);
}
.mobile-header .logo { font-size: 18px; }
.mobile-icons { display: flex; align-items: center; gap: 8px; }
.mobile-icon-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gray-200); background: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--gray-600); transition: var(--transition); outline: none; }
.mobile-icon-btn:hover { border-color: var(--green); color: var(--green); }
.mobile-icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.hamburger-btn { width: 38px; height: 38px; border-radius: 8px; border: none; background: var(--green-light); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; transition: var(--transition); }
.hamburger-btn:hover { background: var(--green); }
.hamburger-btn:hover .bar { background: white; }
.hamburger-btn .bar { width: 18px; height: 2px; background: var(--green); border-radius: 2px; transition: var(--transition); }

/* ─── MOBILE MENU OVERLAY ─── */
.mobile-menu-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--white); z-index: 100000; transform: translateX(100%); transition: transform 0.3s ease; overflow-y: auto; }
.mobile-menu-overlay.show { transform: translateX(0); }
.mobile-menu-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--gray-200); }
.mobile-menu-header .logo { font-size: 18px; }
.mobile-close-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gray-200); background: var(--white); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 20px; color: var(--gray-600); }
.mobile-menu-body { padding: 8px 12px 24px; }

/* Mobile top-level nav items */
.mobile-nav-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--navy); cursor: pointer; transition: var(--transition); text-decoration: none; margin-bottom: 2px; }
.mobile-nav-item:hover { background: var(--green-light); color: var(--green); }
.mobile-nav-item .emoji { margin-right: 10px; }
.mobile-nav-item .arrow { color: var(--gray-400); font-size: 16px; transition: transform 0.2s; }
.mobile-nav-item.open .arrow { transform: rotate(90deg); }

/* Expandable sections */
.mobile-sub-section { display: none; padding: 4px 0 8px; }
.mobile-sub-section.show { display: block; }

/* Mobile section label */
.mob-section-label { display: block; font-size: 11px; text-transform: uppercase; font-weight: 700; color: var(--gray-400); letter-spacing: 1px; padding: 12px 8px 6px; }

/* ─── MOBILE TUTORING STYLES ─── */
.mob-service-link { display: flex; align-items: flex-start; gap: 12px; padding: 10px 6px; border-radius: 12px; text-decoration: none; color: var(--navy); transition: background 0.15s; margin-bottom: 2px; }
.mob-service-link:hover { background: var(--green-light); }
.mob-sv-icon { width: 40px; height: 40px; background: #f3f4f6; border-radius: 10px; display: flex; justify-content: center; align-items: center; font-size: 20px; flex-shrink: 0; }
.mob-sv-text { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.mob-sv-title { font-weight: 700; font-size: 14px; color: var(--navy); }
.mob-sv-desc  { font-size: 12px; color: var(--gray-600); line-height: 1.3; }

.mob-promo { margin-top: 14px; padding: 22px 20px; background: #1A1A2E; border-radius: 16px; color: white; }
.mob-promo .mob-stars { color: #fbbf24; font-size: 15px; letter-spacing: 1px; }
.mob-promo .mob-trust { font-size: 13px; font-weight: 700; color: #f3f4f6; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.mob-promo h4 { font-size: 18px; font-weight: 800; line-height: 1.2; margin-bottom: 8px; letter-spacing: -0.3px; color: white; }
.mob-promo p { font-size: 13px; color: #9CA3AF; line-height: 1.5; margin-bottom: 16px; }
.mob-promo-btn { display: block; text-align: center; padding: 13px; background: var(--green); color: white; border-radius: 10px; font-size: 15px; font-weight: 700; text-decoration: none; transition: background 0.2s; }
.mob-promo-btn:hover { background: var(--green-dark); }

/* ─── MOBILE STUDY TOOLS DRILL-DOWN ─── */
.mob-level-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-radius: 10px; cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent; background: #f9fafb; transition: all 0.15s;
}
.mob-level-item.active { background: white; border-color: var(--gray-200); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.mob-level-item:hover:not(.active) { background: #f3f4f6; }
.mob-level-left { display: flex; flex-direction: column; gap: 2px; }
.mob-level-name { font-weight: 700; font-size: 14px; color: var(--navy); }
.mob-level-desc { font-size: 11px; color: var(--text-light); font-weight: 400; }
.mob-level-arrow { color: var(--gray-400); font-size: 14px; transition: transform 0.2s; flex-shrink: 0; }
.mob-level-item.active .mob-level-arrow { transform: rotate(90deg); color: var(--green); }

.mob-board-section { display: none; padding: 6px 0 4px 12px; }
.mob-board-section.show { display: block; animation: fadeIn 0.15s ease; }

.mob-board-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
}
.mob-board-item:hover { background: #f3f4f6; color: var(--text-main); }
.mob-board-item.active { background: var(--green-light); color: var(--green-dark); font-weight: 600; }
.mob-board-arrow { font-size: 14px; transition: transform 0.2s; }
.mob-board-item.active .mob-board-arrow { transform: rotate(90deg); }

.nav-mob-megamenu-section { display: none; padding: 4px 0 4px 10px; }
.nav-mob-megamenu-section.show { display: block; animation: fadeIn 0.15s ease; }

.nav-mob-megamenu-card { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 8px; text-decoration: none; color: var(--navy); border: 1px solid var(--border-color); background: white; margin-bottom: 6px; transition: border-color 0.15s, box-shadow 0.15s; }
.nav-mob-megamenu-card:hover { border-color: var(--green); box-shadow: 0 2px 8px rgba(46,204,113,0.1); }
.nav-mob-megamenu-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.nav-mob-megamenu-name { font-weight: 700; font-size: 13px; }
.nav-mob-megamenu-tag  { font-size: 11px; color: var(--text-light); margin-top: 1px; }

.mobile-divider { height: 1px; background: var(--gray-200); margin: 10px 0; }
.mobile-cta { display: block; text-align: center; padding: 14px; margin-top: 12px; background: var(--green); color: white; border-radius: 12px; font-size: 16px; font-weight: 600; text-decoration: none; transition: var(--transition); }
.mobile-cta:hover { background: var(--green-dark); }
.mobile-trust { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 0 0; font-size: 13px; color: var(--gray-400); }
.mobile-trust .stars { color: #f59e0b; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
  .nav-header { display: none; }
  .mobile-header { display: flex; }
  .page-content h1 { font-size: 32px; }
  .page-content p { font-size: 15px; }
}
