/**
 * Enhanced Mobile Optimizations - Serene Space AI
 * Additional improvements for the best mobile experience
 * November 27, 2025
 */

/* ========================================
   CRITICAL MOBILE FIXES
   ======================================== */

/* Prevent text from being too small */
@media (max-width: 768px) {
    /* Ensure minimum readable font sizes */
    body {
        font-size: 15px !important;
        line-height: 1.6;
    }
    
    /* Headings should be appropriately sized - more compact */
    h1 {
        font-size: clamp(1.5rem, 5vw, 2rem) !important;
        line-height: 1.2 !important;
        margin-bottom: 0.75rem !important;
    }
    
    h2 {
        font-size: clamp(1.35rem, 4vw, 1.75rem) !important;
        line-height: 1.3 !important;
        margin-bottom: 0.625rem !important;
    }
    
    h3 {
        font-size: clamp(1.15rem, 3.5vw, 1.4rem) !important;
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Paragraphs with more compact spacing */
    p {
        font-size: 15px !important;
        line-height: 1.6 !important;
        margin-bottom: 0.75rem !important;
        color: #334155 !important;
    }
    
    /* All sections should have tighter mobile padding */
    section {
        padding: 2.5rem 1rem !important;
    }
    
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
        max-width: 100% !important;
    }
}

/* ========================================
   HERO SECTION - ENHANCED
   ======================================== */

@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1rem 2.5rem !important;
        min-height: auto !important;
    }
    
    .hero-content {
        text-align: center !important;
        max-width: 100% !important;
    }
    
    /* Hero headline - more compact */
    .hero-content h1,
    .hero-title {
        font-size: 1.65rem !important;
        line-height: 1.2 !important;
        margin-bottom: 0.75rem !important;
        padding: 0 0.25rem !important;
    }
    
    /* Hero subtitle - more compact */
    .hero-subtitle,
    .hero-content p {
        font-size: 1rem !important;
        line-height: 1.5 !important;
        margin-bottom: 1rem !important;
        color: #475569 !important;
    }
    
    /* Hero buttons stack vertically with less gap */
    .hero-cta,
    .hero-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
    
    .hero-cta .btn-primary,
    .hero-cta .btn-secondary,
    .hero-buttons a {
        width: 100% !important;
        text-align: center !important;
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
    }
    
    /* Trust badges in hero - more compact */
    .trust-badges,
    .hero-badges {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        justify-content: center !important;
        margin-top: 1rem !important;
    }
    
    .trust-badge {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.75rem !important;
        white-space: nowrap !important;
    }
}

/* ========================================
   BUTTONS - TOUCH-OPTIMIZED
   ======================================== */

@media (max-width: 768px) {
    /* All buttons should be easily tappable but more compact */
    button,
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-large,
    a.button {
        min-height: 44px !important;
        min-width: 44px !important;
        padding: 0.625rem 1.25rem !important;
        font-size: 0.95rem !important;
        border-radius: 50px !important;
        font-weight: 600 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.375rem !important;
        text-decoration: none !important;
    }
    
    /* Full-width CTAs on mobile */
    .btn-large,
    .cta-button,
    .hero-cta .btn-primary {
        width: 100% !important;
    }
    
    /* Button groups stack vertically with less gap */
    .button-group,
    .cta-buttons,
    .action-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        width: 100% !important;
    }
}

/* ========================================
   COACH CARDS - MOBILE GRID
   ======================================== */

@media (max-width: 768px) {
    .coaches-grid,
    .coach-grid,
    .services-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 0 !important;
    }
    
    .coach-card,
    .service-card {
        padding: 1.25rem !important;
        border-radius: 12px !important;
        margin-bottom: 0 !important;
    }
    
    .coach-icon {
        font-size: 2rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    .coach-card h3 {
        font-size: 1.15rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    .coach-card p {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
        color: #475569 !important;
    }
    
    .coach-card ul {
        font-size: 0.85rem !important;
        padding-left: 0 !important;
    }
    
    .coach-card li {
        padding: 0.3rem 0 !important;
        color: #475569 !important;
    }
}

/* ========================================
   PRICING CARDS - MOBILE STACK
   ======================================== */

@media (max-width: 768px) {
    .pricing-grid,
    .pricing-cards {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        padding: 0 !important;
    }
    
    .pricing-card {
        width: 100% !important;
        padding: 1.5rem 1.25rem !important;
        border-radius: 16px !important;
        margin-bottom: 0 !important;
    }
    
    /* Pricing card title */
    .pricing-card h3,
    .plan-name {
        font-size: 1.35rem !important;
        margin-bottom: 0.4rem !important;
    }
    
    /* Price display */
    .price,
    .pricing-amount {
        font-size: 2.25rem !important;
        font-weight: 700 !important;
        margin: 0.75rem 0 !important;
    }
    
    .price-period {
        font-size: 0.95rem !important;
        color: #ffffff !important;
        opacity: 0.8;
    }
    
    /* Features list */
    .pricing-features,
    .plan-features {
        font-size: 0.9rem !important;
        line-height: 1.6 !important;
        margin: 1rem 0 !important;
    }
    
    .pricing-features li {
        padding: 0.4rem 0 !important;
        color: #ffffff !important;
    }
    
    /* Pricing CTA */
    .pricing-card .btn,
    .pricing-cta {
        width: 100% !important;
        margin-top: 1rem !important;
    }
}

/* ========================================
   COMPARISON TABLE - MOBILE FRIENDLY
   ======================================== */

@media (max-width: 768px) {
    /* Make comparison table scrollable horizontally */
    .comparison-table-wrapper,
    .compare-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -1.25rem !important;
        padding: 0 1.25rem !important;
    }
    
    .comparison-table {
        min-width: 600px !important;
        font-size: 0.875rem !important;
    }
    
    .comparison-table th {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    .comparison-table td {
        padding: 0.75rem 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    /* Scroll hint */
    .comparison-table-wrapper::after {
        content: "← Scroll to see more →";
        display: block;
        text-align: center;
        color: #ffffff;
        opacity: 0.8;
        font-size: 0.875rem;
        margin-top: 1rem;
        font-style: italic;
    }
}

/* ========================================
   TESTIMONIALS - MOBILE LAYOUT
   ======================================== */

@media (max-width: 768px) {
    .testimonials-grid,
    .testimonial-slider {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .testimonial-card,
    .testimonial {
        width: 100% !important;
        padding: 1.25rem !important;
        border-radius: 12px !important;
        margin-bottom: 0 !important;
    }
    
    .testimonial-avatar,
    .reviewer-photo {
        width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
        margin-bottom: 0.75rem !important;
    }
    
    .testimonial-name {
        font-size: 1rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.2rem !important;
    }
    
    .testimonial-role,
    .reviewer-location {
        font-size: 0.825rem !important;
        color: #ffffff !important;
        opacity: 0.8;
        margin-bottom: 0.75rem !important;
    }
    
    .testimonial-text,
    .testimonial-content {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
        color: #ffffff !important;
    }
    
    .testimonial-rating {
        font-size: 1.15rem !important;
        margin-bottom: 0.625rem !important;
    }
}

/* ========================================
   FAQ SECTION - MOBILE ACCORDION
   ======================================== */

@media (max-width: 768px) {
    .faq-grid,
    .faq-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .faq-item {
        border-radius: 12px !important;
        padding: 1rem !important;
        margin-bottom: 0 !important;
    }
    
    .faq-question {
        font-size: 1.1rem !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
        padding: 0.75rem 2.5rem 0.75rem 0 !important;
        cursor: pointer !important;
        position: relative !important;
    }
    
    .faq-question::after {
        content: '+' !important;
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        font-size: 1.5rem !important;
        font-weight: 300 !important;
        transition: transform 0.3s ease !important;
    }
    
    .faq-item.active .faq-question::after {
        content: '−' !important;
    }
    
    .faq-answer {
        font-size: 0.95rem !important;
        line-height: 1.7 !important;
        color: #475569 !important;
        padding-top: 0.75rem !important;
    }
}

/* ========================================
   FOOTER - MOBILE STACK
   ======================================== */

@media (max-width: 768px) {
    .footer {
        padding: 3rem 1.25rem 2rem !important;
    }
    
    .footer-content {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
    }
    
    .footer-column {
        width: 100% !important;
        text-align: center !important;
    }
    
    .footer-links {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        align-items: center !important;
    }
    
    .footer-links a {
        font-size: 1rem !important;
        padding: 0.5rem 0 !important;
    }
    
    .social-links {
        display: flex !important;
        justify-content: center !important;
        gap: 1rem !important;
        margin-top: 1rem !important;
    }
    
    .social-links a {
        width: 44px !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        font-size: 1.25rem !important;
    }
    
    .copyright {
        text-align: center !important;
        font-size: 0.875rem !important;
        margin-top: 2rem !important;
        padding-top: 2rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    }
}

/* ========================================
   IMAGES & MEDIA - RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    img {
        max-width: 100% !important;
        height: auto !important;
        display: block !important;
    }
    
    .founder-photo,
    .team-photo,
    .profile-image {
        width: 100px !important;
        height: 100px !important;
        border-radius: 50% !important;
        margin: 0 auto 1rem !important;
    }
    
    /* Video embeds */
    video,
    iframe {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* ========================================
   STICKY CTA - MOBILE
   ======================================== */

@media (max-width: 768px) {
    .sticky-cta {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: white !important;
        padding: 0.75rem 1rem !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
        z-index: 9999 !important;
    }
    
    .sticky-cta .btn {
        width: 100% !important;
        padding: 0.75rem !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
    }
    
    /* Add padding to body to prevent content being hidden */
    body.has-sticky-cta {
        padding-bottom: 75px !important;
    }
}

/* ========================================
   CHAT WIDGET - MOBILE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .chat-widget {
        bottom: 90px !important; /* Above sticky CTA if present */
        right: 16px !important;
    }
    
    .chat-button {
        width: 56px !important;
        height: 56px !important;
    }
    
    .chat-window {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        max-height: 100% !important;
        width: 100% !important;
        border-radius: 0 !important;
        z-index: 10002 !important;
    }
    
    .chat-body {
        flex: 1 !important;
        overflow-y: auto !important;
    }
}

/* ========================================
   PERFORMANCE - REDUCE ANIMATIONS ON MOBILE
   ======================================== */

@media (max-width: 768px) and (prefers-reduced-motion: no-preference) {
    * {
        animation-duration: 0.4s !important;
        transition-duration: 0.3s !important;
    }
}

/* ========================================
   ACCESSIBILITY - IMPROVED TOUCH TARGETS
   ======================================== */

@media (max-width: 768px) {
    /* All interactive elements should be at least 44x44px */
    a,
    button,
    input[type="submit"],
    input[type="button"],
    input[type="checkbox"],
    input[type="radio"],
    select {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Larger tap target for links with padding */
    a:not(.btn) {
        padding: 0.5rem !important;
        margin: -0.5rem !important;
    }
}

/* ========================================
   SPACING & RHYTHM - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Consistent vertical rhythm - more compact */
    section {
        margin-bottom: 2rem !important;
    }
    
    .section-header {
        margin-bottom: 1.5rem !important;
        text-align: center !important;
    }
    
    .section-title {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .section-subtitle {
        font-size: 0.95rem !important;
        line-height: 1.5 !important;
        color: #475569 !important;
    }
    
    /* Card spacing - tighter */
    .card,
    .feature-card,
    .info-card {
        margin-bottom: 1rem !important;
    }
}

/* ========================================
   LOADING STATES - MOBILE FRIENDLY
   ======================================== */

@media (max-width: 768px) {
    .loading-spinner {
        width: 40px !important;
        height: 40px !important;
    }
    
    .skeleton-loader {
        border-radius: 12px !important;
        animation: pulse 1.5s ease-in-out infinite !important;
    }
}

/* ========================================
   FINAL POLISH - MOBILE
   ======================================== */

@media (max-width: 768px) {
    /* Remove unnecessary animations on mobile */
    @media (prefers-reduced-motion: reduce) {
        * {
            animation: none !important;
            transition: none !important;
        }
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth !important;
    }
    
    /* Better text rendering on mobile */
    body {
        -webkit-font-smoothing: antialiased !important;
        -moz-osx-font-smoothing: grayscale !important;
        text-rendering: optimizeLegibility !important;
    }
    
    /* Prevent tap highlight on iOS */
    * {
        -webkit-tap-highlight-color: transparent !important;
    }
    
    /* Better select appearance on mobile */
    select {
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") !important;
        background-repeat: no-repeat !important;
        background-position: right 0.75rem center !important;
        background-size: 1.25rem !important;
        padding-right: 2.5rem !important;
    }
}
