/* ==========================================================================
   ROYAL ENGLISH SCHOOL - RESPONSIVE STYLESHEET
   Supports 320px, 375px, 425px, 576px, 768px, 992px, 1200px, 1440px+
   ========================================================================== */

/* Mobile Bottom Action Bar (Default Hidden, Visible <768px) */
.mobile-bottom-action-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--primary-dark);
  border-top: 2px solid var(--accent-red);
  z-index: 9999;
  padding: 8px 12px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.mobile-action-flex {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mobile-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--white);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.725rem;
  padding: 6px 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.mobile-action-btn i {
  font-size: 1.1rem;
}

.mobile-action-btn:not(.btn-whatsapp):not(.btn-enquire) {
  background: var(--secondary);
  color: var(--white);
}

.mobile-action-btn.btn-whatsapp {
  background: var(--whatsapp-green);
  color: var(--white);
}

.mobile-action-btn.btn-enquire {
  background: linear-gradient(135deg, #F0C954 0%, #C89B2E 100%);
  color: var(--primary-dark);
}

/* --------------------------------------------------------------------------
   DESKTOP & LARGE MONITORS (1440px+)
   -------------------------------------------------------------------------- */
@media (min-width: 1440px) {
  .hero-title {
    font-size: 4rem;
  }
  .container {
    max-width: 1380px;
  }
}

/* --------------------------------------------------------------------------
   LAPTOP & SMALL DESKTOP (<1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
  .hero-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .hero-title {
    font-size: 2.85rem;
  }

  .quick-actions-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .legacy-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }

  .academic-stages-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .icse-stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .contact-layout {
    grid-template-columns: 1fr;
  }

  .admission-timeline-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

/* --------------------------------------------------------------------------
   TABLET & MOBILE MENU (<991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .hamburger-btn {
    display: block;
  }

  .brand-name-sub {
    display: none;
  }

  .brand-name-main {
    font-size: 1.15rem;
  }

  .brand-logo-img {
    height: 72px;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    width: 82%;
    max-width: 340px;
    height: 100vh;
    background: var(--white);
    flex-direction: column;
    align-items: stretch;
    padding: 0 0 2rem 0;
    gap: 0;
    box-shadow: -12px 0 40px rgba(11, 19, 43, 0.2);
    border-top: none;
    overflow-y: auto;
    z-index: 1100;
    transform: translateX(100%);
    clip-path: none;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .nav-menu.active {
    clip-path: none;
    transform: translateX(0);
  }

  .mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
  }

  .mobile-nav-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    min-width: 0;
  }

  .mobile-nav-logo img {
    height: 38px;
    width: auto;
    flex-shrink: 0;
  }

  .mobile-nav-logo span {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    color: var(--primary);
    line-height: 1.2;
  }

  .mobile-nav-close {
    background: var(--light-bg);
    border: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  }

  .mobile-nav-close:active {
    background: var(--accent-red);
    color: var(--white);
    transform: scale(0.92);
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu .nav-link-custom {
    padding: 1rem 1.25rem;
    width: 100%;
  }

  .nav-menu .nav-link-custom.active {
    color: var(--accent-red-dark);
  }

  .dropdown-menu-custom {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    width: 100%;
    padding: 0 1.25rem 0.5rem 2rem;
    display: none;
  }

  .nav-item.active-dropdown .dropdown-menu-custom {
    display: block;
  }

  .mobile-nav-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(11, 19, 43, 0.55);
    z-index: 950;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
  }

  .mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .promo-banner-slider {
    aspect-ratio: 2560 / 926;
    height: auto;
    background: transparent;
  }

  .promo-banner-slide img {
    object-fit: cover;
  }

  .hero-description {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta-group {
    justify-content: center;
  }

  .hero-floating-card {
    left: 50%;
    transform: translateX(-50%);
    bottom: -20px;
    white-space: nowrap;
  }

  .legacy-grid {
    grid-template-columns: 1fr;
  }

  .legacy-grid .visual-icon-frame {
    order: -1;
  }

  .counters-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .values-grid {
    grid-template-columns: 1fr;
  }

  .beyond-grid {
    grid-template-columns: 1fr;
  }

  .events-grid {
    grid-template-columns: 1fr;
  }

  .sports-hero-card {
    grid-template-columns: 1fr;
    padding: 2.5rem 1.75rem;
    gap: 2rem;
  }

  .sports-card-disclosure {
    padding: 2.5rem 1.75rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .icon-tile-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .visual-icon-frame {
    height: 320px;
  }

  .enquiry-form-card {
    padding: 2rem 1.5rem;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full-width {
    grid-column: span 1;
  }

  .contact-quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   SMALL TABLET & LARGE MOBILE (<767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  body {
    padding-bottom: 60px; /* Space for bottom action bar */
  }

  .mobile-bottom-action-bar {
    display: block;
  }

  .floating-btn-whatsapp,
  .floating-btn-call {
    display: none; /* Replaced by bottom bar on mobile */
  }

  .chatbot-trigger-btn {
    bottom: 80px; /* sit above the mobile bottom action bar instead of behind it */
    left: 15px;
    z-index: 10000;
  }

  .back-to-top-btn {
    bottom: 80px; /* sit above the mobile bottom action bar instead of behind it */
    right: 15px;
    z-index: 10000;
  }

  .header-actions .btn-gold {
    display: none; /* Enquire Now is already in the mobile bottom bar */
  }

  .brand-logo-img {
    height: 64px;
  }

  .legacy-img-frame img {
    height: 340px;
  }

  .legacy-experience-badge {
    bottom: 12px;
    right: 12px;
    padding: 0.6rem 0.85rem;
    border-radius: var(--radius-sm);
  }

  .legacy-years {
    font-size: 1.35rem;
  }

  .legacy-text {
    font-size: 0.6rem;
    letter-spacing: 0.5px;
  }

  .promo-banner-slider {
    aspect-ratio: 2560 / 926 !important;
    height: auto !important;
    background: transparent !important;
  }

  .promo-banner-slide img {
    object-fit: cover !important;
  }

  .promo-banner-arrow {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .promo-banner-arrow.prev {
    left: 8px;
  }

  .promo-banner-arrow.next {
    right: 8px;
  }

  .promo-banner-dots {
    bottom: 8px;
    gap: 6px;
  }

  .promo-banner-dot {
    width: 7px;
    height: 7px;
  }

  .top-announcement-bar {
    display: none; /* Saved header vertical space */
  }

  .hero-title,
  .bg-primary-navy h1 {
    font-size: 2.2rem !important;
  }

  .section-title {
    font-size: 1.95rem;
  }

  .quick-actions-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .quick-action-card {
    padding: 1.1rem 2.5rem 1.1rem 1.25rem;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    position: relative;
    border-radius: 18px;
    border-color: transparent;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .quick-action-card:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-sm);
  }

  .quick-action-card::after {
    content: '\f105';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--border-color);
    font-size: 0.95rem;
    transition: transform 0.2s ease, color 0.2s ease;
  }

  .quick-action-card:active::after {
    color: var(--accent-red);
    transform: translateY(-50%) translateX(3px);
  }

  .quick-action-card > div:not(.action-icon) {
    flex: 1;
    min-width: 0;
  }

  .action-icon {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 14px;
    font-size: 1.2rem;
    margin-bottom: 0;
    background: linear-gradient(145deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(45, 59, 139, 0.3);
  }

  .quick-action-card:nth-child(even) .action-icon {
    background: linear-gradient(145deg, var(--accent-red) 0%, var(--accent-red-dark) 100%);
    box-shadow: 0 4px 14px rgba(214, 40, 40, 0.3);
  }

  .quick-action-card:hover .action-icon {
    background: linear-gradient(145deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
  }

  .quick-action-card:nth-child(even):hover .action-icon {
    background: linear-gradient(145deg, var(--accent-red) 0%, var(--accent-red-dark) 100%);
  }

  .action-title {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }

  .action-desc {
    font-size: 0.8rem;
    margin-bottom: 0;
  }

  .quick-action-card .action-arrow {
    display: none;
  }

  .academic-stages-grid {
    grid-template-columns: 1fr;
  }

  .icse-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .icse-stats-grid-3col {
    grid-template-columns: 1fr;
  }

  .disclosure-toc {
    grid-template-columns: repeat(2, 1fr);
  }

  .disclosure-table th {
    width: 50%;
  }

  .disclosure-card {
    padding: 1.75rem 1.25rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .feature-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.15rem 1.1rem;
    border-radius: 16px;
    border-color: transparent;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }

  .feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--secondary) 0%, var(--accent-red) 100%);
  }

  .feature-card:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-sm);
  }

  .feature-icon-box {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 14px;
    font-size: 1.15rem;
    margin-bottom: 0;
    background: linear-gradient(145deg, var(--primary) 0%, var(--secondary) 100%);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(45, 59, 139, 0.3);
  }

  .feature-card:nth-child(even) .feature-icon-box {
    background: linear-gradient(145deg, var(--accent-red) 0%, var(--accent-red-dark) 100%);
    box-shadow: 0 4px 14px rgba(214, 40, 40, 0.3);
  }

  .feature-card > *:not(.feature-icon-box) {
    flex: 1;
    min-width: 0;
  }

  .feature-title {
    font-size: 0.98rem;
    margin-bottom: 0.2rem;
  }

  .feature-desc {
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .contact-quick-grid {
    grid-template-columns: 1fr;
  }

  .contact-info-panel {
    padding: 1.5rem;
  }

  .icon-tile-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sports-hero-card,
  .sports-card-disclosure {
    padding: 2rem 1.25rem !important;
    gap: 1.5rem;
    border-radius: var(--radius-md);
  }

  .sports-hero-card h2,
  .sports-card-title {
    font-size: 1.65rem !important;
    line-height: 1.25;
  }

  .sports-list {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    width: 100%;
  }

  .sports-item {
    padding: 10px 14px;
    font-size: 0.925rem;
    width: 100%;
  }

  .badge-tag {
    font-size: 0.75rem;
    padding: 5px 12px;
    letter-spacing: 0.5px;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
    max-width: 100%;
  }

  .btn-custom {
    white-space: normal;
    text-align: center;
    line-height: 1.35;
    padding: 0.75rem 1.35rem;
    max-width: 100%;
  }

  .infra-photo-banner {
    height: 220px;
  }

  .admission-timeline-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .footer-logo {
    height: 130px;
  }

  .footer-bottom-bar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .chatbot-window {
    width: 90%;
    left: 5%;
    bottom: 80px;
    height: 460px;
  }
}

/* --------------------------------------------------------------------------
   EXTRA SMALL MOBILE (<480px)
   -------------------------------------------------------------------------- */
@media (max-width: 479.98px) {
  .promo-banner-slider {
    aspect-ratio: 2560 / 926 !important;
    height: auto !important;
    background: transparent !important;
  }

  .promo-banner-arrow {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
  }

  .promo-banner-arrow.prev {
    left: 6px;
  }

  .promo-banner-arrow.next {
    right: 6px;
  }

  .promo-banner-dots {
    bottom: 6px;
    gap: 5px;
  }

  .promo-banner-dot {
    width: 6px;
    height: 6px;
  }

  .brand-name-main {
    font-size: 1rem;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-title,
  .bg-primary-navy h1 {
    font-size: 1.85rem !important;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
  }

  .sports-hero-card,
  .sports-card-disclosure {
    padding: 1.5rem 1rem !important;
    border-radius: var(--radius-md);
  }

  .sports-hero-card h2,
  .sports-card-title {
    font-size: 1.35rem !important;
  }

  .badge-tag {
    font-size: 0.72rem;
    padding: 4px 10px;
    letter-spacing: 0.3px;
  }

  .btn-custom {
    width: 100%;
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }

  .hero-floating-card {
    position: relative;
    left: 0;
    transform: none;
    margin-top: 1.5rem;
    width: 100%;
  }

  .counters-grid {
    grid-template-columns: 1fr;
  }

  .icse-stats-grid {
    grid-template-columns: 1fr;
  }

  .admission-timeline-grid {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    position: relative;
  }

  .admission-timeline-grid::before {
    content: '';
    position: absolute;
    top: 1.4rem;
    bottom: 1.4rem;
    left: calc(0.25rem + 1.05rem - 1px);
    width: 2px;
    background: linear-gradient(to bottom, var(--border-color) 0%, var(--border-color) 100%);
    z-index: 0;
  }

  .step-card {
    padding: 0.9rem 0.25rem;
    text-align: left;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    column-gap: 0.85rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
    box-shadow: none;
  }

  .step-card:active {
    background: var(--light-bg);
    box-shadow: none;
  }

  .step-num {
    grid-column: 1;
    grid-row: 1 / 3;
    position: relative;
    z-index: 1;
    font-size: 0.95rem;
    margin-bottom: 0;
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(15, 30, 70, 0.28);
    transform: scale(1);
  }

  .admission-timeline-grid.in-view .step-card:nth-child(1) .step-num { animation: stepPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.15s both; }
  .admission-timeline-grid.in-view .step-card:nth-child(2) .step-num { animation: stepPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.22s both; }
  .admission-timeline-grid.in-view .step-card:nth-child(3) .step-num { animation: stepPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.29s both; }
  .admission-timeline-grid.in-view .step-card:nth-child(4) .step-num { animation: stepPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.36s both; }
  .admission-timeline-grid.in-view .step-card:nth-child(5) .step-num { animation: stepPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.43s both; }
  .admission-timeline-grid.in-view .step-card:nth-child(6) .step-num { animation: stepPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both; }

  @keyframes stepPop {
    0% { transform: scale(0.4); box-shadow: 0 0 0 rgba(15, 30, 70, 0); }
    70% { transform: scale(1.12); }
    100% { transform: scale(1); box-shadow: 0 3px 10px rgba(15, 30, 70, 0.28); }
  }

  .step-title {
    grid-column: 2;
    grid-row: 1;
    font-size: 0.92rem;
    margin-bottom: 0.15rem;
  }

  .step-desc {
    grid-column: 2;
    grid-row: 2;
    font-size: 0.78rem;
    line-height: 1.4;
  }

  .gallery-grid {
    grid-template-columns: 1fr;
  }

  .icon-tile-grid {
    grid-template-columns: 1fr !important;
  }


  .disclosure-toc {
    grid-template-columns: 1fr;
  }

  .disclosure-table th,
  .disclosure-table td {
    display: block;
    width: 100%;
  }

  .disclosure-table th {
    padding-bottom: 0.25rem;
  }

  .disclosure-table td {
    padding-top: 0;
  }
}
