/* ==========================================================
   MOBILE ENHANCED — ม.5/5 Classroom Website
   เพิ่มเติมและ override สำหรับ mobile UI ที่สวยงาม
   ========================================================== */

/* ── Bottom Navigation Bar (Mobile Only) ─────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: rgba(15, 37, 72, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1.5px solid rgba(245, 166, 35, 0.4);
  padding: 0.4rem 0 env(safe-area-inset-bottom, 0.4rem) 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
}
.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  padding: 0.4rem 0.6rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  font-family: 'Prompt', 'Kanit', sans-serif;
  font-size: 0.6rem;
  font-weight: 500;
  border-radius: 10px;
  transition: color 0.2s ease, background 0.2s ease;
  min-width: 52px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-item i {
  font-size: 1.15rem;
  line-height: 1;
}
.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--secondary-color, #F5A623);
}
.bottom-nav-item.active i {
  color: var(--secondary-color, #F5A623);
  filter: drop-shadow(0 0 5px rgba(245, 166, 35, 0.6));
}

/* ── Hero Banner — Mobile Polish ─────────────────────────── */
@media (max-width: 768px) {
  /* Show bottom nav, hide hamburger drawer */
  .bottom-nav {
    display: block;
  }
  .mobile-toggle-btn {
    display: none !important; /* ใช้ bottom nav แทน */
  }

  /* Pad bottom for bottom-nav */
  body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  /* Hero — ทำให้ดูโปร่งสบาย */
  .hero-banner {
    padding: 2.5rem 0 4rem 0;
    min-height: 85svh;
    display: flex;
    align-items: center;
  }
  .hero-layout {
    flex-direction: column-reverse;
    text-align: center;
    gap: 1.2rem;
    align-items: center;
  }
  .hero-content {
    width: 100%;
    padding: 0 0.5rem;
  }
  .hero-school {
    font-size: 0.72rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    opacity: 0.85;
  }
  .hero-title {
    font-size: 2.1rem;
    line-height: 1.25;
    margin-bottom: 0.6rem;
  }
  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 0.3rem;
  }
  .hero-year {
    font-size: 0.85rem;
    margin-bottom: 1.4rem;
  }
  .hero-actions {
    flex-direction: row;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
  }
  .hero-actions .btn {
    flex: 1 1 auto;
    max-width: 160px;
    justify-content: center;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
  }

  /* Hero Graphics — เล็กลง สง่างาม */
  .hero-graphics {
    width: 100%;
    max-width: 180px;
    margin: 0 auto;
  }
  .hero-logo-showcase {
    width: 170px;
    height: 200px;
  }
  .hero-school-logo {
    height: 155px;
  }
  .orbit-outer  { width: 162px; height: 162px; }
  .orbit-middle { width: 128px; height: 128px; }
  .hero-logo-glow { width: 130px; height: 130px; }

  /* Stats Bar — 3 columns compact */
  .stats-bar {
    margin-top: -2rem;
    padding: 1rem 0;
    border-radius: 16px;
  }
  .stats-bar .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 0 0.75rem;
  }
  .stat-item-card {
    padding: 0.85rem 0.4rem;
    border-radius: 12px;
  }
  .stat-icon {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
  }
  .stat-number {
    font-size: 1.35rem;
    line-height: 1;
  }
  .stat-label {
    font-size: 0.72rem;
    line-height: 1.3;
  }

  /* About Section */
  .about-section {
    padding: 2.5rem 0;
  }
  .about-layout {
    flex-direction: column;
    gap: 1.5rem;
  }
  .about-image-wrap {
    width: 85%;
    max-width: 300px;
    margin: 0 auto;
    padding-bottom: 1.5rem; /* space for badge */
  }
  .about-badge {
    bottom: -12px;
    right: -12px;
    padding: 0.7rem 1rem;
  }
  .about-badge-num {
    font-size: 1.4rem;
  }
  .about-content h2.section-title {
    font-size: 1.5rem !important;
  }
  .about-details {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  /* Highlight Grid */
  .highlight-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .highlight-card {
    border-radius: 14px;
  }
  .highlight-img-wrap {
    height: 180px;
  }

  /* Section spacing */
  section {
    padding: 2.2rem 0;
  }

  /* Footer — stack mobile-friendly */
  .footer-container {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
  .footer-info {
    flex: none;
  }
  .school-address {
    justify-content: center;
  }

  /* Page Hero (sub-pages) */
  .page-hero {
    padding: 2.5rem 0;
  }
  .page-hero-title {
    font-size: 1.8rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .page-hero-subtitle {
    font-size: 1rem;
  }

  /* Scroll indicator — hide on mobile to save space */
  .scroll-indicator {
    display: none;
  }
}

/* ── Small Phones ≤ 480px ─────────────────────────────────── */
@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }
  .hero-subtitle {
    font-size: 0.9rem;
  }
  .stats-bar .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
    padding: 0 0.5rem;
  }
  .stat-item-card {
    padding: 0.7rem 0.3rem;
  }
  .stat-number { font-size: 1.2rem; }
  .stat-label  { font-size: 0.65rem; }
  .stat-icon   { font-size: 1.1rem; }

  .about-details {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .highlight-img-wrap {
    height: 160px;
  }

  /* Bottom nav label — hide to save space */
  .bottom-nav-item span {
    display: none;
  }
  .bottom-nav-item {
    min-width: 44px;
    padding: 0.6rem 0.4rem;
  }
  .bottom-nav-item i {
    font-size: 1.3rem;
  }
}

/* ── Very Small ≤ 360px ───────────────────────────────────── */
@media (max-width: 360px) {
  .hero-title { font-size: 1.55rem; }
  /* Keep 3-column stats even on tiny screens */
  .stats-bar .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .stat-label { font-size: 0.6rem; }
  .stat-number { font-size: 1.1rem; }
}

/* ── Override old CSS: force stats to 3-col on all mobile ── */
/* Must come after the old 480px and 360px rules in style.css */
@media (max-width: 480px) {
  .stats-bar .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}
@media (max-width: 768px) {
  .stats-bar .stats-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ── Smooth touch interactions ────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  .highlight-card:hover,
  .student-card:hover,
  .stat-item-card:hover,
  .nav-link:hover,
  .btn:hover {
    transform: none;
  }
  .highlight-card:active {
    transform: scale(0.98);
  }
  .btn:active {
    transform: scale(0.96);
  }
}

/* ── Improved Modals on Mobile ────────────────────────────── */
@media (max-width: 768px) {
  .modal-content {
    max-height: 92svh;
    overflow-y: auto;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: none;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 1.5rem 1rem;
  }
  .modal-backdrop {
    align-items: flex-end;
  }
  .modal-close {
    top: 1rem;
    right: 1rem;
  }

  /* Lightbox full-screen on mobile */
  .lightbox-card {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 1rem;
  }
  .lightbox-body img {
    max-height: 65svh !important;
  }
}
