/* =====================================================
   AudioBook Organizer - Mobile Landing Page
   Fixed Mobile Design for Samsung & iPhone
   ===================================================== */

/* Mobile-First Base Styles */
@media screen and (max-width: 768px) {
    /* Reset and Base */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        margin: 0;
        padding: 0;
    }
    
    /* Hide ALL desktop-only elements */
    .hero-visual,
    .hero-app-preview,
    .app-window,
    .hero-background,
    .hero-gradient,
    .hero-pattern,
    .nav-links,
    .scroll-indicators,
    .step-visual,
    .footer-content,
    .pricing-trust,
    .hero-actions .btn-secondary,
    .hero-actions .btn-outline {
        display: none !important;
    }
    
    /* Mobile Menu Backdrop Overlay */
    .mobile-menu-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    .mobile-menu-backdrop.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* ===== NAVIGATION - Fixed ===== */
    .landing-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: #ffffff;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        z-index: 1000;
        display: flex;
        align-items: center;
        padding: 0 16px;
    }
    
    .nav-container {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        max-width: none;
        padding: 0;
    }
    
    .nav-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 17px;
        font-weight: 700;
        color: var(--primary-color);
    }
    
    .brand-icon {
        font-size: 26px;
    }
    
    .brand-text {
        font-weight: 700;
    }
    
    .nav-mobile {
        display: block !important;
    }
    
    /* Fix hamburger menu button */
    .mobile-menu-btn {
        width: 44px;
        height: 44px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        padding: 0;
        gap: 3px;
        cursor: pointer;
        position: relative;
    }
    
    .mobile-menu-btn span {
        display: block;
        width: 22px;
        height: 2.5px;
        background: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s ease;
        position: relative;
        transform-origin: center;
    }
    
    /* Ensure spans stay horizontal */
    .mobile-menu-btn:not(.active) span {
        transform: rotate(0deg) translate(0, 0);
    }
    
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }
    
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    /* Mobile Menu - Fixed positioning - Override desktop styles */
    .mobile-menu {
        position: fixed !important;
        top: 60px !important;
        right: -100% !important;
        left: auto !important;
        width: 280px !important;
        height: calc(100vh - 60px) !important;
        background: #ffffff !important;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1) !important;
        transition: right 0.3s ease !important;
        padding: 0 !important;
        z-index: 999 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
        border: none !important;
    }
    
    .mobile-menu.show {
        right: 0 !important;
        display: flex !important;
    }
    
    .mobile-link {
        display: block;
        padding: 18px 24px;
        font-size: 16px;
        font-weight: 500;
        color: #2d3748;
        text-decoration: none;
        border-bottom: 1px solid #f0f0f0;
        transition: all 0.2s ease;
        position: relative;
    }
    
    .mobile-link:active {
        background: #f8f9ff;
        padding-left: 28px;
    }
    
    .mobile-auth-btn {
        margin: 20px;
        height: 48px;
        font-size: 16px;
        font-weight: 600;
        background: var(--gradient-primary);
        color: white;
        border: none;
        border-radius: 12px;
        width: calc(100% - 40px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    /* Mobile sign out button styling - positioned exactly like sign in button */
    .mobile-menu .mobile-user-nav {
        display: flex;
        flex-direction: column;
        gap: 0;
    }
    
    .mobile-menu .mobile-user-nav .mobile-link {
        margin: 0;
    }
    
    .mobile-menu .mobile-link.logout-btn {
        margin: 20px !important;
        padding: 14px 24px;
        height: 48px;
        font-size: 16px;
        font-weight: 600;
        background: #dc3545;
        color: white !important;
        border: none;
        border-radius: 12px;
        width: calc(100% - 40px);
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
        display: block;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: center;
        border-bottom: none;
        position: relative;
        bottom: auto;
        margin-top: auto !important;
    }
    
    .mobile-menu .mobile-link.logout-btn:hover {
        background: #c82333;
        box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
    }
    
    .mobile-menu .mobile-link.logout-btn:active {
        background: #bd2130;
        transform: translateY(1px);
        box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
        padding-left: 24px; /* Override the default mobile-link active padding */
    }
    
    /* ===== HERO SECTION - Fixed and Centered ===== */
    .hero {
        padding: 40px 20px 60px;
        text-align: center;
        min-height: calc(100vh - 60px);
        display: flex;
        align-items: flex-start;
        justify-content: center;
        position: relative;
        margin-top: 60px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        padding-top: 80px;
    }
    
    /* Add gradient overlay similar to desktop */
    .hero::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, 
            rgba(102, 126, 234, 0.9) 0%, 
            rgba(118, 75, 162, 0.8) 50%,
            rgba(102, 126, 234, 0.9) 100%
        );
        z-index: 0;
    }
    
    .hero-container {
        max-width: 100%;
        padding: 0;
        position: relative;
        z-index: 1;
        width: 100%;
    }
    
    .hero-content {
        max-width: 100%;
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: 32px;
        line-height: 1.25;
        font-weight: 800;
        color: #ffffff;
        margin-bottom: 20px;
    }
    
    .hero-title .highlight {
        color: #fef49c;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    .hero-subtitle {
        font-size: 16px;
        line-height: 1.6;
        color: rgba(255, 255, 255, 0.9);
        margin-bottom: 32px;
        padding: 0 10px;
        max-width: 360px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .hero-actions {
        display: flex;
        flex-direction: column;
        gap: 16px;
        padding: 0;
        max-width: 300px;
        margin: 0 auto;
    }
    
    .hero-actions .btn-primary {
        width: 100%;
        height: 56px;
        font-size: 18px;
        font-weight: 700;
        background: var(--gradient-primary);
        color: white;
        border: none;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    
    .hero-actions .btn-primary:active {
        transform: translateY(1px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    /* ===== FEATURES - Fixed visibility ===== */
    .features {
        padding: 80px 20px 60px;
        background: #f8f9ff;
        position: relative;
        min-height: auto;
        scroll-snap-align: unset;
        margin-top: -20px;
        box-shadow: 0 -10px 0 0 #f8f9ff;
    }
    
    .features .section-header {
        text-align: center;
        margin-bottom: 40px;
        padding: 0;
        transform: none;
    }
    
    .section-title {
        font-size: 26px;
        font-weight: 700;
        color: #2d3748;
        margin-bottom: 12px;
        line-height: 1.3;
        padding: 0 10px;
    }
    
    .section-subtitle {
        font-size: 15px;
        color: #718096;
        line-height: 1.5;
        padding: 0 10px;
    }
    
    .features .features-grid {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        transform: none !important;
        perspective: none !important;
        overflow: visible !important;
        position: static !important;
        padding: 0 !important;
    }
    
    .features .features-carousel {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 16px !important;
        width: 100% !important;
        height: auto !important;
        transform: none !important;
        animation: none !important;
        position: static !important;
        transform-style: flat !important;
        padding: 0 !important;
        margin: 0 auto !important;
        max-width: 100% !important;
        grid-template-rows: auto auto auto !important;
    }
    
    /* Smart asymmetric layout for 5 cards */
    .features .feature-card:nth-child(1) {
        grid-column: 1 / 3 !important;
        grid-row: 1 !important;
    }
    
    .features .feature-card:nth-child(2) {
        grid-column: 3 / 5 !important;
        grid-row: 1 !important;
    }
    
    .features .feature-card:nth-child(3) {
        grid-column: 2 / 4 !important;
        grid-row: 2 !important;
    }
    
    .features .feature-card:nth-child(4) {
        grid-column: 1 / 3 !important;
        grid-row: 3 !important;
    }
    
    .features .feature-card:nth-child(5) {
        grid-column: 3 / 5 !important;
        grid-row: 3 !important;
    }
    
    .features .feature-card {
        background: white !important;
        padding: 28px 20px !important;
        border-radius: 16px !important;
        text-align: center !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08) !important;
        position: static !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        transition: transform 0.2s ease, box-shadow 0.2s ease !important;
        border: none !important;
        height: auto !important;
        min-height: 180px !important;
        width: auto !important;
        transform: none !important;
        animation: none !important;
        transform-origin: initial !important;
    }
    
    .feature-card:active {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }
    
    .feature-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .features .feature-icon {
        font-size: 44px !important;
        height: auto !important;
        margin-bottom: 12px !important;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1)) !important;
        line-height: 1 !important;
    }
    
    .features .feature-title {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #2d3748 !important;
        line-height: 1.3 !important;
        margin-bottom: 8px !important;
    }
    
    .features .feature-description {
        font-size: 12px !important;
        color: #718096 !important;
        line-height: 1.4 !important;
        text-align: center !important;
        margin-top: 0 !important;
        padding: 0 4px !important;
        flex-grow: 1 !important;
    }
    
    .features .feature-highlights {
        display: none !important;
    }
    
    /* ===== HOW IT WORKS - Clean design ===== */
    .how-it-works {
        padding: 60px 20px;
        background: white;
        position: relative;
    }
    
    .steps-container {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }
    
    .step {
        background: #fafbff;
        padding: 24px;
        border-radius: 16px;
        display: flex;
        gap: 16px;
        align-items: flex-start;
        border: 1px solid #e8eaf6;
        position: relative;
        transition: all 0.2s ease;
    }
    
    /* Remove connecting lines on mobile */
    .step::after {
        display: none !important;
    }
    
    .step:active {
        background: #f8f9ff;
        border-color: #e8eaf6;
    }
    
    .step-number {
        width: 40px;
        height: 40px;
        background: var(--gradient-primary);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 18px;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    }
    
    .step-content {
        flex: 1;
    }
    
    .step-title {
        font-size: 17px;
        font-weight: 600;
        color: #2d3748;
        margin-bottom: 8px;
        line-height: 1.3;
    }
    
    .step-description {
        font-size: 14px;
        color: #718096;
        line-height: 1.5;
    }
    
    /* ===== DEMO SECTION - With video mockup ===== */
    .demo {
        padding: 60px 20px;
        background: #f8f9ff;
        position: relative;
    }
    
    .demo-container {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }
    
    /* Add video player mockup */
    .demo-video {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 12px;
        aspect-ratio: 16/9;
        position: relative;
        margin-bottom: 32px;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
        overflow: hidden;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 220px;
    }
    
    .video-placeholder {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .play-button-large {
        width: 80px;
        height: 80px;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    
    .play-button-large:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 1);
    }
    
    .play-icon {
        font-size: 32px;
        margin-left: 4px;
        color: #333333;
    }
    
    .video-overlay {
        display: none;
    }
    
    .demo-features {
        background: white;
        padding: 24px;
        border-radius: 16px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    }
    
    .demo-feature {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .demo-feature:last-child {
        border-bottom: none;
    }
    
    .demo-icon {
        font-size: 24px;
        flex-shrink: 0;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    }
    
    .demo-text {
        font-size: 15px;
        color: #4a5568;
        line-height: 1.4;
    }
    
    /* ===== PRICING - Redesigned UI/UX ===== */
    .pricing {
        padding: 60px 0 90px;
        background: white;
        position: relative;
    }
    
    .pricing .section-header {
        padding: 0 20px;
        margin-bottom: 60px;
    }
    
    .pricing-tagline {
        display: none;
    }
    
    /* New pricing design - vertical stack on mobile */
    .pricing-grid {
        display: flex;
        flex-direction: column;
        gap: 40px;
        padding: 0 20px;
    }
    
    .pricing-card {
        background: white;
        border-radius: 20px;
        padding: 36px 24px 28px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
        border: 2px solid #f0f0f0;
        position: relative;
        transition: all 0.3s ease;
    }
    
    .pricing-card.featured {
        border-color: var(--primary-color);
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.15);
        transform: scale(1.02);
    }
    
    .pricing-card.best-value {
        border-color: rgba(102, 126, 234, 0.3);
    }
    
    .pricing-badge {
        position: absolute;
        top: -14px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--gradient-primary);
        color: white;
        padding: 6px 20px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .enterprise-badge {
        background: #718096;
    }
    
    .best-value-badge {
        background: #48bb78;
    }
    
    .pricing-header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 12px 20px;
        margin-bottom: 16px;
    }
    
    .pricing-header .pricing-title {
        grid-column: 1;
        grid-row: 1;
    }
    
    .pricing-header .pricing-price {
        grid-column: 2;
        grid-row: 1;
    }
    
    .pricing-header .credits-display {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    .pricing-title {
        font-size: 20px;
        font-weight: 700;
        color: #2d3748;
        flex: 1;
        margin: 0;
    }
    
    .pricing-price {
        text-align: right;
        flex-shrink: 0;
    }
    
    .price-amount {
        font-size: 22px;
        font-weight: 800;
        background: var(--gradient-primary);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
        display: block;
        line-height: 1.2;
        margin: 0;
    }
    
    .price-period {
        font-size: 11px;
        color: #718096;
        display: block;
        margin-top: 2px;
    }
    
    .credits-display {
        font-size: 15px;
        color: #4a5568;
        font-weight: 600;
        margin: 0 auto;
        text-align: center;
        padding: 10px 16px;
        background: #f8f9ff;
        border-radius: 8px;
        border: 1px solid #e8eaf6;
        width: fit-content;
        max-width: 180px;
        display: block;
        justify-self: center;
    }
    
    .pricing-features {
        margin-bottom: 24px;
    }
    
    .pricing-feature {
        padding: 24px 0;
        font-size: 14px;
        color: #4a5568;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .pricing-feature::before {
        content: '✓';
        color: var(--primary-color);
        font-weight: bold;
        font-size: 16px;
    }
    
    .pricing-value {
        display: none;
    }
    
    .pricing-btn {
        width: 100%;
        height: 52px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 12px;
        border: 2px solid var(--primary-color);
        background: white;
        color: var(--primary-color);
        transition: all 0.2s ease;
    }
    
    .pricing-card.featured .pricing-btn {
        background: var(--gradient-primary);
        color: white;
        border: none;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .pricing-scroll-hint {
        display: none;
    }
    
    /* ===== BOTTOM NAVIGATION - Enhanced ===== */
    .bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.08);
        z-index: 900;
        display: flex !important;
        justify-content: space-around;
        align-items: center;
        padding: 0 20px;
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }
    
    .bottom-nav-item {
        flex: 1;
        text-align: center;
        padding: 6px;
        color: #718096;
        text-decoration: none;
        font-size: 11px;
        font-weight: 500;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        transition: color 0.2s ease;
        position: relative;
    }
    
    .bottom-nav-item.active {
        color: var(--primary-color);
    }
    
    .bottom-nav-item.active::after {
        content: '';
        position: absolute;
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 3px;
        background: var(--primary-color);
        border-radius: 2px;
    }
    
    .bottom-nav-icon {
        font-size: 22px;
    }
    
    /* ===== FOOTER - Minimal ===== */
    .footer {
        padding: 40px 20px 80px;
        background: #1a202c;
        color: white;
        text-align: center;
    }
    
    .footer-links-simple {
        display: flex;
        justify-content: center;
        gap: 24px;
        margin-bottom: 20px;
    }
    
    .footer-links-simple a {
        color: #cbd5e0;
        text-decoration: none;
        font-size: 14px;
        font-weight: 500;
        transition: color 0.2s ease;
    }
    
    .footer-links-simple a:active {
        color: white;
    }
    
    .footer-bottom {
        padding-top: 20px;
        border-top: 1px solid #2d3748;
    }
    
    .footer-copyright {
        font-size: 12px;
        color: #a0aec0;
    }
    
    /* ===== BUTTONS - Consistent Styling ===== */
    .btn {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 15px;
        font-weight: 600;
        border-radius: 12px;
        border: none;
        cursor: pointer;
        transition: all 0.2s ease;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn-primary {
        background: var(--gradient-primary);
        color: white;
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    }
    
    .btn-outline {
        background: white;
        color: var(--primary-color);
        border: 2px solid var(--primary-color);
    }
    
    /* Loading overlay - hide on mobile */
    #loadingOverlay {
        display: none !important;
    }
    
    /* Add padding for fixed elements */
    body {
        padding-bottom: 56px;
    }
    
    /* Ensure no horizontal scroll */
    section {
        overflow-x: hidden !important;
    }
    
    .container {
        padding: 0 !important;
        max-width: 100% !important;
    }
}

/* Small phones (iPhone SE, older Android) */
@media screen and (max-width: 380px) {
    .hero-title {
        font-size: 26px;
    }
    
    .section-title {
        font-size: 22px;
    }
    
    .price-amount {
        font-size: 24px;
    }
    
    .features-grid {
        gap: 12px;
    }
    
    .feature-card {
        padding: 20px 14px;
    }
    
    .feature-icon {
        font-size: 36px;
    }
    
    .feature-title {
        font-size: 14px;
    }
    
    .pricing-card {
        padding: 24px 20px;
    }
    
    .step {
        padding: 20px;
    }
    
    .step-number {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* iPhone notch handling */
@supports (padding-top: env(safe-area-inset-top)) {
    .landing-nav {
        padding-top: env(safe-area-inset-top);
        height: calc(70px + env(safe-area-inset-top));
    }
    
    .mobile-menu {
        top: calc(60px + env(safe-area-inset-top));
        height: calc(100vh - 60px - env(safe-area-inset-top));
    }
    
    .hero {
        min-height: calc(100vh - 60px - env(safe-area-inset-top));
    }
    
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(56px + env(safe-area-inset-bottom));
    }
    
    body {
        padding-bottom: calc(56px + env(safe-area-inset-bottom));
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary {
        background: var(--primary-color);
    }
    
    .feature-card,
    .pricing-card,
    .step {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}