/* ═══════════════════════════════════════════════════════════════════
   SCHOOLRADAR — MODERN COMPONENTS (modern-styles.css)
   Tutor Cards · Search Dropdown · Bottom Sheet · Map Page
   4-tab Bottom Nav · Admin Tutors Panel
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. SEARCH SUGGEST DROPDOWN ─────────────────────────────────── */

.hero-search-wrap {
  position: relative;
}

.search-suggest-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--suggest-bg, #fff);
  border: 1px solid var(--suggest-border, #dce4ef);
  border-radius: var(--radius-block, 12px);
  box-shadow: var(--suggest-shadow, 0 8px 28px rgba(26,63,168,.14));
  overflow: hidden;
  z-index: 9000;
  max-height: 320px;
  overflow-y: auto;
}

.search-suggest-dropdown.is-open {
  display: block;
}

.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  color: var(--ink, #0c1929);
  text-decoration: none;
  transition: background .12s;
  cursor: pointer;
}

.suggest-item:hover,
.suggest-item.is-active {
  background: var(--suggest-hover, #f1f5fb);
}

.suggest-item-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.suggest-item-name {
  flex: 1;
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggest-item-type {
  font-size: .78rem;
  color: var(--muted, #617083);
  background: var(--tint-2, #eef2f9);
  border-radius: var(--radius-pill, 999px);
  padding: 2px 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── 2. TUTOR CARDS ──────────────────────────────────────────────── */

.tutors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.tutor-card {
  background: var(--bg-card, #fff);
  border-radius: var(--radius-block, 12px);
  box-shadow: var(--shadow-card, 0 2px 12px rgba(26,63,168,.09));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow .18s, transform .18s;
}

.tutor-card:hover {
  box-shadow: var(--shadow-md, 0 4px 16px rgba(26,63,168,.12));
  transform: translateY(-2px);
}

.tutor-card-avatar {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--bg-soft, #f1f5fb);
}

.tutor-avatar-shell {
  width: 100%;
  height: 100%;
}

.tutor-avatar-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tutor-rating-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent-lt, #fff8e6);
  color: var(--accent-dk, #d48800);
  font-weight: 700;
  font-size: .82rem;
  border-radius: var(--radius-pill, 999px);
  padding: 3px 9px;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.tutor-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tutor-card-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink, #0c1929);
  margin: 0;
}

.tutor-subject-tag {
  display: inline-block;
  background: var(--tutor-subject-bg, #fff8e6);
  color: var(--tutor-subject-color, #d48800);
  font-size: .78rem;
  font-weight: 600;
  border-radius: var(--radius-pill, 999px);
  padding: 3px 10px;
  align-self: flex-start;
}

.tutor-bio {
  font-size: .88rem;
  color: var(--muted, #617083);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.tutor-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line, #dce4ef);
}

.tutor-price {
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary, #1a3fa8);
}

.tutor-contact-btn {
  background: var(--accent, #f5a623);
  color: #1a1a1a;
  border-radius: var(--radius-btn, 8px);
  font-weight: 700;
  font-size: .8rem;
  padding: 6px 14px;
  border: none;
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}

.tutor-contact-btn:hover {
  background: var(--accent-dk, #d48800);
  color: #fff;
}

/* Home section: Top-3 tutors */
.home-tutors-section {
  background: var(--bg-soft, #f1f5fb);
}

.tutors-top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

/* ── 3. BOTTOM NAVIGATION (4 tabs) ──────────────────────────────── */

.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h, 60px);
  background: var(--bottom-nav-bg, #fff);
  border-top: 1px solid var(--bottom-nav-border, rgba(26,63,168,.10));
  z-index: 8000;
  box-shadow: 0 -2px 12px rgba(26,63,168,.08);
}

@media (max-width: 768px) {
  .bottom-nav {
    display: flex;
    align-items: stretch;
  }

  body {
    padding-bottom: var(--bottom-nav-h, 60px);
  }

  body.page-institution {
    padding-bottom: var(--bottom-nav-h, 60px);
  }
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--bottom-nav-muted, #8fa0b2);
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  transition: color .15s;
  padding: 0 4px;
  min-width: 0;
}

.bottom-nav-item svg {
  flex-shrink: 0;
}

.bottom-nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.bottom-nav-item.is-active,
.bottom-nav-item:hover {
  color: var(--bottom-nav-active, #1a3fa8);
}

/* ── 4. BOTTOM SHEET (mobile filter/review overlay) ─────────────── */

.bottom-sheet-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 8100;
  opacity: 0;
  transition: opacity .22s;
}

.bottom-sheet-overlay.is-open {
  display: block;
  opacity: 1;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--sheet-bg, #fff);
  border-radius: var(--sheet-radius, 20px 20px 0 0);
  box-shadow: var(--sheet-shadow, 0 -8px 32px rgba(26,63,168,.14));
  z-index: 8200;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}

.bottom-sheet.is-open {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--line-2, #c9d5e6);
  border-radius: var(--radius-pill, 999px);
  margin: 10px auto 0;
  flex-shrink: 0;
}

.bottom-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--line, #dce4ef);
  flex-shrink: 0;
}

.bottom-sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink, #0c1929);
  margin: 0;
}

.bottom-sheet-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted, #617083);
  font-size: 1.2rem;
  padding: 4px;
  border-radius: var(--radius-sm, 6px);
}

.bottom-sheet-body {
  overflow-y: auto;
  padding: 16px 20px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line, #dce4ef);
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Mobile filter drawer → bottom-sheet upgrade */
@media (max-width: 768px) {
  .sheet-handle-bar {
    display: block;
  }

  .filter-drawer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: auto;
    max-height: 90dvh;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
    background: var(--white, #fff);
    box-shadow: 0 -6px 40px rgba(26,63,168,.16);
    transform: translateY(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    z-index: 350;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .filter-drawer.is-open {
    display: flex;
    transform: translateY(0);
  }

  .filter-drawer > .sheet-handle-bar {
    flex-shrink: 0;
  }

  .filter-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    padding: 14px 18px 12px;
    background: var(--white, #fff);
    border-bottom: 1px solid var(--line, #dce4ef);
  }

  .filter-drawer-head strong {
    font-weight: 700;
    font-size: .95rem;
    color: var(--ink, #0c1929);
  }
}

/* ── 5. MAP PAGE ─────────────────────────────────────────────────── */

.map-page-wrap {
  border-radius: var(--radius-block, 12px);
  overflow: hidden;
  box-shadow: var(--shadow-md, 0 4px 16px rgba(26,63,168,.12));
}

.map-page-full {
  height: calc(100vh - 260px);
  min-height: 480px;
  width: 100%;
  background: var(--bg-soft, #f1f5fb);
}

@media (max-width: 768px) {
  .map-page-full {
    height: calc(100vh - 220px);
    min-height: 360px;
  }
}

/* ── 6. ADMIN TUTORS PANEL ───────────────────────────────────────── */

.admin-tutor-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--line, #dce4ef);
  border-radius: var(--radius-block, 12px);
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.admin-tutor-avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-block, 12px);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-soft, #f1f5fb);
}

.admin-tutor-meta {
  flex: 1;
  min-width: 0;
}

.admin-tutor-name {
  font-weight: 700;
  font-size: .95rem;
  color: var(--ink, #0c1929);
  margin-bottom: 2px;
}

.admin-tutor-subject {
  font-size: .8rem;
  color: var(--accent-dk, #d48800);
  background: var(--accent-lt, #fff8e6);
  border-radius: var(--radius-pill, 999px);
  padding: 2px 8px;
  display: inline-block;
  margin-bottom: 4px;
}

.admin-tutor-price {
  font-size: .82rem;
  color: var(--muted, #617083);
}

.admin-tutor-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── 7. UPDATED HOME PAGE HERO SEARCH ────────────────────────────── */

.hero-search-relative {
  position: relative;
}

.hero-niche-pill {
  border-radius: var(--radius-block, 12px);
}

/* ── 8. TOP TUTORS HOME SECTION ──────────────────────────────────── */

.home-tutors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.tutor-card-compact {
  background: var(--bg-card, #fff);
  border-radius: var(--radius-block, 12px);
  box-shadow: var(--shadow-card, 0 2px 12px rgba(26,63,168,.09));
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 16px;
  transition: box-shadow .18s, transform .18s;
  text-decoration: none;
  color: inherit;
}

.tutor-card-compact:hover {
  box-shadow: var(--shadow-md, 0 4px 16px rgba(26,63,168,.12));
  transform: translateY(-2px);
}

.tutor-compact-avatar {
  width: var(--tutor-avatar-size, 72px);
  height: var(--tutor-avatar-size, 72px);
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-soft, #f1f5fb);
  border: 2px solid var(--primary-lt, #eaeffc);
}

.tutor-compact-body {
  flex: 1;
  min-width: 0;
}

.tutor-compact-name {
  font-size: .92rem;
  font-weight: 700;
  color: var(--ink, #0c1929);
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tutor-compact-subject {
  font-size: .75rem;
  color: var(--accent-dk, #d48800);
  background: var(--accent-lt, #fff8e6);
  border-radius: var(--radius-pill, 999px);
  padding: 2px 8px;
  display: inline-block;
  margin-bottom: 4px;
}

.tutor-compact-price {
  font-size: .8rem;
  color: var(--muted, #617083);
  font-weight: 500;
}

.tutor-compact-rating {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent-dk, #d48800);
  flex-shrink: 0;
}

/* ── 9. HOME PAGE RESTRUCTURED ───────────────────────────────────── */

.home-no-map body.page-home .home-map-v2-section {
  display: none;
}

/* ── 10. SEARCH PAGE DEDICATED ───────────────────────────────────── */

.page-search-hero .hero-niche-search {
  max-width: 640px;
}

/* ── 11. RESPONSIVE OVERRIDES ────────────────────────────────────── */

@media (max-width: 480px) {
  .tutors-grid {
    grid-template-columns: 1fr;
  }

  .home-tutors-grid {
    grid-template-columns: 1fr;
  }

  .tutor-card-compact {
    padding: 12px;
  }
}
