/* ========================================
   Responsive Design - Mobile First
   ======================================== */

/* Tablets (768px and up) */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    .container {
        padding: 0 15px;
    }

    /* Navigation */
    .nav-menu {
        gap: 15px;
    }

    .nav-menu a {
        font-size: 0.95rem;
    }

    /* Hero Section */
    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-cta {
        flex-direction: column;
        gap: 10px;
    }

    .btn-lg {
        width: 100%;
    }

    /* Grid Layouts */
    .teachers-grid,
    .classes-grid,
    .benefits-grid,
    .testimonials-grid,
    .meditation-showcase {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }

    /* Section Padding */
    section {
        padding: 50px 0;
    }

    .section-header {
        margin-bottom: 40px;
    }

    /* App Promotion */
    .app-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .app-buttons {
        flex-direction: column;
    }

    /* Newsletter Form */
    .newsletter-form {
        flex-direction: column;
    }

    .form-group {
        flex-direction: column;
    }

    /* Footer */
    .footer-content {
        gap: 30px;
    }
}

/* Mobile (576px and below) */
@media (max-width: 576px) {
    body {
        font-size: 14px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    .container {
        padding: 0 12px;
    }

    /* Navigation */
    .navbar-container {
        padding: 12px 0;
    }

    .logo {
        font-size: 1.4rem;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: white;
        padding: 20px;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    }

    body.dark-mode .nav-menu {
        background: #222;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu a {
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }

    body.dark-mode .nav-menu a {
        border-color: #333;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Hero Section */
    .hero-banner {
        height: auto;
        min-height: 60vh;
        padding: 40px 0;
    }

    .hero-title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 25px;
    }

    .hero-cta {
        flex-direction: column;
        gap: 10px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Section Padding */
    section {
        padding: 40px 0;
    }

    .section-header {
        margin-bottom: 30px;
    }

    .section-header h2 {
        margin-bottom: 10px;
    }

    .section-header p {
        font-size: 1rem;
    }

    /* Grid Layouts */
    .teachers-grid,
    .classes-grid,
    .benefits-grid,
    .testimonials-grid,
    .meditation-showcase {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    /* Cards */
    .teacher-card,
    .class-card,
    .benefit-card,
    .testimonial-card,
    .meditation-card {
        padding: 20px;
    }

    .teacher-image {
        height: 200px;
    }

    .class-thumbnail {
        height: 150px;
    }

    .benefit-icon {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }

    /* Class Card Badges */
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* Testimonials */
    .testimonial-author {
        gap: 10px;
    }

    .author-avatar {
        width: 40px;
        height: 40px;
    }

    /* Newsletter Section */
    .newsletter-content h2 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    .newsletter-content p {
        font-size: 1rem;
        margin-bottom: 20px;
    }

    .form-group input {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    /* App Promotion */
    .app-text h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .app-text p {
        font-size: 0.95rem;
        margin-bottom: 20px;
    }

    .app-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .app-link {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }

    /* Footer */
    .footer-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .footer-section h4 {
        font-size: 1rem;
    }

    .footer-section a {
        font-size: 0.9rem;
    }

    .social-links {
        gap: 10px;
    }

    .social-links a {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    /* Theme Toggle Position */
    .theme-toggle,
    .mobile-menu-btn {
        font-size: 1.1rem;
    }

    /* Utility */
    .text-center {
        text-align: center;
    }

    /* Visibility Helpers */
    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: block;
    }
}

/* Extra Small Devices (480px and below) */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .hero-title {
        font-size: 1.4rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .btn-lg {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    section {
        padding: 30px 0;
    }

    .section-header {
        margin-bottom: 25px;
    }

    .container {
        padding: 0 10px;
    }

    /* Large Font Sizes for Better Readability */
    input,
    button,
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Reduce gaps */
    .teachers-grid,
    .classes-grid,
    .benefits-grid,
    .testimonials-grid,
    .meditation-showcase {
        gap: 12px;
    }

    .card {
        padding: 15px;
    }

    .form-group input {
        padding: 10px 12px;
    }

    .newsletter-form {
        padding: 0;
    }
}

/* Landscape Mode (Tablets) */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-banner {
        min-height: auto;
        padding: 20px 0;
    }

    .hero-title {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    .btn-lg {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .hero-cta,
    .btn,
    footer,
    .newsletter,
    .theme-toggle,
    .mobile-menu-btn {
        display: none;
    }

    body {
        background: white;
    }

    section {
        page-break-inside: avoid;
    }
}

/* ========================================
   INLINE-STYLE RESPONSIVE OVERRIDES
   Fixes sections that use inline styles, which
   normal media queries cannot override.
   ======================================== */

/* Tablet: 3-column grids -> 2 columns */
@media (max-width: 1024px) {
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Mobile */
@media (max-width: 768px) {
    /* Sub-page hero top padding (nav is only ~60px tall) */
    section[style*="padding-top: 160px"],
    section[style*="padding-top: 140px"] {
        padding-top: 110px !important;
    }

    /* Oversized inline headings */
    [style*="font-size: 56px"] { font-size: 38px !important; }
    [style*="font-size: 48px"] { font-size: 34px !important; }
    [style*="font-size: 42px"] { font-size: 32px !important; }

    /* Class details hero image */
    [style*="height: 500px"] { height: 300px !important; }

    /* Oversized card padding */
    [style*="padding: 48px;"] { padding: 24px !important; }
    [style*="padding: 60px 48px"] { padding: 40px 24px !important; }
    [style*="padding: 60px 40px"] { padding: 40px 24px !important; }

    /* 3-column grids -> 1 column */
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    /* Timings stacked card alignment */
    [style*="grid-template-columns: 120px 1fr auto"] > div {
        text-align: left !important;
    }

    /* 2-col form grids -> 1 col WITHOUT content min-width,
       otherwise inputs overflow and get cut off on small screens */
    [style*="grid-template-columns: repeat(2, minmax(0, 1fr))"] {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Keep form controls inside their containers on mobile */
    input,
    select,
    textarea {
        min-width: 0;
        max-width: 100%;
    }
}

/* Small phones */
@media (max-width: 480px) {
    section[style*="padding-top: 160px"],
    section[style*="padding-top: 140px"] {
        padding-top: 90px !important;
    }

    [style*="font-size: 56px"] { font-size: 32px !important; }
    [style*="font-size: 48px"] { font-size: 30px !important; }
    [style*="font-size: 42px"] { font-size: 28px !important; }
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Optimize images for retina displays */
    img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Touch Devices */
@media (hover: none) and (pointer: coarse) {
    .btn,
    a,
    button {
        padding: 12px;
        min-height: 48px;
        min-width: 48px;
    }

    .nav-menu a::after {
        display: none;
    }
}

/* Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #f5f5f5;
    }

    .navbar {
        background: #222;
        border-bottom: 1px solid #333;
    }

    /* Ensure readability in dark mode */
    .section-header p {
        color: #bbb;
    }

    .hero-content {
        text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
    }
}
