/* ==========================================================================
   TESLA TRAINING ACADEMY - RESPONSIVE STYLES
   Mobile, Tablet, and Desktop Breakpoints
   NEET • IIT-JEE • STEM EDUCATION
   ========================================================================== */

/* Universal Layout & Overflow Guards */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
}

section,
header,
footer,
main {
  width: 100%;
  max-width: 100%;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

img,
svg,
video,
iframe {
  max-width: 100%;
  height: auto;
}

/* ==========================================================================
   TABLET LANDSCAPE & SMALL DESKTOP (<= 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --header-height: 74px;
  }

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

  .hero-tag {
    margin: 0 auto 20px;
  }

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

  .hero-desc {
    margin: 0 auto 30px;
  }

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

  .hero-stats-row {
    max-width: 600px;
    margin: 0 auto;
  }

  .spotlight-box {
    grid-template-columns: 1fr;
    padding: 30px 24px;
    text-align: center;
  }

  .spotlight-points {
    align-items: center;
  }

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

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

  .school-banner-card {
    grid-template-columns: 1fr;
    padding: 40px 32px;
  }

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

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

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

  .mission-grid,
  .contact-grid,
  .faculty-leadership-card,
  .stem-showcase-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

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

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

  .page-hero {
    overflow: hidden;
  }
}

/* ==========================================================================
   TABLET PORTRAIT & MOBILE (<= 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .top-notice-bar {
    display: none; /* Hide top bar on mobile to maximise vertical space */
  }

  /* Navigation Drawer */
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: #ffffff;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px 30px 30px;
    gap: 18px;
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 99;
  }

  .nav-menu.open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-link {
    width: 100%;
    font-size: 1.05rem;
    padding: 6px 0;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .mobile-menu-btn.open span:nth-child(1) {
    transform: translateY(8.5px) rotate(45deg);
  }

  .mobile-menu-btn.open span:nth-child(2) {
    opacity: 0;
  }

  .mobile-menu-btn.open span:nth-child(3) {
    transform: translateY(-8.5px) rotate(-45deg);
  }

  .header-actions .btn-header-cta {
    display: none;
  }

  /* Typography Scaling */
  .hero-title {
    font-size: 2.1rem;
    line-height: 1.25;
    word-break: break-word;
  }

  .hero-stat-card .stat-number {
    font-size: 1.8rem;
  }

  .section-title {
    font-size: 1.85rem;
    word-break: break-word;
  }

  .page-hero-title {
    font-size: 1.95rem;
    word-break: break-word;
  }

  .page-hero {
    padding: 45px 0 55px;
    overflow: hidden;
  }

  .page-hero::before {
    width: 100%;
    max-width: 100%;
  }

  /* Single Column Stacking for all Grids on Mobile */
  .features-grid,
  .programs-grid,
  .achievers-grid,
  .faculty-grid,
  .campus-cards-grid,
  .enquiry-grid,
  .mission-grid,
  .contact-grid,
  .faculty-leadership-card,
  .stem-showcase-grid,
  .amenities-grid,
  .calculator-grid,
  .dept-faculty-grid,
  .special-offers-grid,
  .achievers-highlights-grid {
    grid-template-columns: 1fr !important;
  }

  /* Thirukkural Founder Quote Box Responsiveness */
  .kural-quote-box {
    padding: 24px 20px !important;
    margin: 25px 0 !important;
    border-radius: var(--radius-lg);
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
  }

  .kural-text-tamil {
    font-size: 1.12rem;
    line-height: 1.55;
    word-break: break-word;
  }

  .kural-text-translit {
    font-size: 0.88rem;
    word-break: break-word;
  }

  .kural-meaning {
    font-size: 0.9rem;
    line-height: 1.6;
    word-break: break-word;
  }

  .kural-author {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    font-size: 0.84rem;
  }

  /* Exam Date Banner (Index & Courses) */
  .exam-date-banner {
    padding: 20px 18px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  .exam-date-info {
    width: 100% !important;
    gap: 14px !important;
  }

  .exam-date-actions {
    width: 100% !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .exam-date-actions .btn-primary,
  .exam-date-actions .btn-secondary {
    width: 100% !important;
    justify-content: center;
    text-align: center;
  }

  /* Enquiry Metrics Row (Index Page) */
  .enquiry-metrics-row {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .enquiry-metric-divider {
    display: none !important;
  }

  /* Hero Stats Row */
  .hero-stats-row {
    grid-template-columns: 1fr;
    gap: 14px;
    width: 100%;
    max-width: 100%;
  }

  /* School Partnership Card */
  .school-banner-card {
    grid-template-columns: 1fr !important;
    padding: 30px 20px !important;
    gap: 24px;
  }

  .school-perks {
    grid-template-columns: 1fr;
  }

  /* Calculator Total Card */
  .calculator-total-card {
    padding: 22px 18px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }

  .calculator-total-card .btn-primary {
    width: 100% !important;
    justify-content: center;
    text-align: center;
  }

  /* Comparison Table Mobile Fix */
  .comparison-table-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .modern-table {
    min-width: 600px;
  }

  /* Form & Component Cards */
  .founder-desk-card {
    padding: 24px 20px !important;
  }

  .faculty-leadership-card {
    padding: 28px 20px !important;
    text-align: center;
  }

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

  .footer-top-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

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

  .hero-rank-floating {
    position: static;
    margin-top: 15px;
    width: 100%;
    box-sizing: border-box;
  }

  .gallery-tabs {
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
  }

  .tab-btn {
    padding: 8px 16px;
    font-size: 0.85rem;
  }

  /* Universal safety net for any inline grids on mobile */
  [style*="grid-template-columns: 1fr 1.2fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns: 0.9fr 1.3fr"],
  [style*="grid-template-columns: repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(320px, 1fr))"],
  [style*="grid-template-columns: repeat(auto-fit, minmax(270px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  [style*="gap: 50px"],
  [style*="gap: 40px"] {
    gap: 24px !important;
  }

  [style*="padding: 40px"],
  [style*="padding: 45px 50px"],
  [style*="padding: 40px 36px"] {
    padding: 24px 18px !important;
  }
}

/* ==========================================================================
   SMALL SMARTPHONES (<= 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
  }

  .brand-logo-wrap img {
    height: 40px;
    max-width: 180px;
  }

  .hero-section {
    padding: 40px 0 55px;
  }

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

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

  .page-hero-title {
    font-size: 1.6rem;
  }

  .page-hero-subtitle {
    font-size: 0.92rem;
  }

  .hero-desc {
    font-size: 0.92rem;
  }

  /* Kural Box on Smallest Screens */
  .kural-quote-box {
    padding: 18px 14px !important;
    margin: 20px 0 !important;
  }

  .kural-text-tamil {
    font-size: 1.02rem !important;
  }

  .kural-meaning {
    font-size: 0.86rem !important;
  }

  .enquiry-metrics-row {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    text-align: center;
  }

  .mission-stats-grid,
  .leadership-perks-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .floating-actions {
    bottom: 14px;
    right: 14px;
    gap: 8px;
  }

  .float-btn {
    width: 44px;
    height: 44px;
  }

  .float-btn svg {
    width: 20px;
    height: 20px;
  }

  .founder-desk-card {
    padding: 20px 14px !important;
    border-radius: var(--radius-lg);
  }

  .faculty-leadership-card {
    padding: 20px 14px !important;
    border-radius: var(--radius-lg);
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .enquiry-form-card {
    padding: 22px 14px;
  }

  .tab-btn {
    padding: 7px 12px !important;
    font-size: 0.8rem !important;
  }

  .calculator-card {
    padding: 20px 14px !important;
  }

  #calcTotalDisplay {
    font-size: 2rem !important;
  }

  .timeline-container {
    padding-left: 20px !important;
  }

  .timeline-dot {
    left: -20px !important;
    width: 16px !important;
    height: 16px !important;
  }

  .timeline-content {
    padding: 16px 14px !important;
  }

  .timeline-year {
    font-size: 0.98rem !important;
  }

  .timeline-text {
    font-size: 0.88rem !important;
  }
}
