/**
 * Luna OS - Mobile Responsive Styles
 * Comprehensive mobile and tablet optimizations
 */

/* ============================================
   MOBILE-FIRST RESPONSIVE BREAKPOINTS
   ============================================ */

/* Small phones: 320px - 374px */
@media (max-width: 374px) {
    .hero h1 {
        font-size: 2rem !important;
    }

    .hero .subtitle {
        font-size: 1rem !important;
    }
}

/* Large phones: 375px - 767px */
@media (max-width: 767px) {
    /* ============================================
       GENERAL FIXES
       ============================================ */

    body {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    * {
        max-width: 100vw !important;
    }

    /* Disable animations on mobile for performance */
    .bg-animation,
    .grid-bg,
    .particles,
    .orb {
        animation: none !important;
        opacity: 0.3 !important;
    }

    /* ============================================
       HEADER & NAVIGATION
       ============================================ */

    .header {
        padding: 1rem 0 !important;
    }

    .nav {
        flex-wrap: wrap;
        padding: 0 1.5rem !important;
        gap: 1rem;
    }

    .logo {
        font-size: 1.4rem !important;
        flex-shrink: 0;
    }

    .logo-image {
        height: 36px !important;
    }

    .logo-text {
        font-size: 1.4rem !important;
    }

    /* Hamburger Menu */
    .nav-links {
        display: none; /* Hide by default, show with JS */
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(40px);
        flex-direction: column;
        gap: 0 !important;
        padding: 2rem 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 999;
    }

    .nav-links.mobile-active {
        display: flex !important;
    }

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .nav-links a {
        width: 100%;
        padding: 1.25rem 1rem !important;
        font-size: 1.1rem !important;
        min-height: 56px !important; /* Touch-friendly */
    }

    /* Mobile Menu Toggle Button */
    .mobile-menu-toggle {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 1.8rem;
        cursor: pointer;
        padding: 0.5rem;
        margin-left: auto;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cta-button {
        padding: 0.75rem 1.5rem !important;
        font-size: 0.9rem !important;
        width: 100%;
        text-align: center;
        display: block;
        margin-top: 1rem;
        min-height: 48px !important;
    }

    /* ============================================
       HERO SECTION
       ============================================ */

    .hero {
        min-height: calc(100vh - 70px) !important;
        padding: 3rem 1.5rem !important;
        margin-top: 70px;
    }

    .hero h1 {
        font-size: 2.5rem !important;
        line-height: 1.2 !important;
        margin-bottom: 1.5rem !important;
    }

    .hero .subtitle {
        font-size: 1.1rem !important;
        line-height: 1.6 !important;
        margin-bottom: 2rem !important;
        padding: 0 1rem;
    }

    .hero-buttons {
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100%;
        max-width: 400px;
        margin: 0 auto;
    }

    .hero-buttons .btn {
        width: 100% !important;
        padding: 1rem 2rem !important;
        font-size: 1rem !important;
        min-height: 56px !important;
        justify-content: center;
    }

    /* ============================================
       FEATURES SECTION
       ============================================ */

    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 0 1.5rem !important;
    }

    .feature-card {
        padding: 2rem 1.5rem !important;
    }

    .feature-icon {
        font-size: 2.5rem !important;
    }

    .feature-title {
        font-size: 1.4rem !important;
        margin-bottom: 0.75rem !important;
    }

    .feature-description {
        font-size: 1rem !important;
        line-height: 1.6 !important;
    }

    /* ============================================
       CODE BLOCKS & PRE
       ============================================ */

    pre {
        font-size: 0.75rem !important;
        padding: 1rem !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    code {
        font-size: 0.8rem !important;
        word-break: break-word;
    }

    /* ============================================
       SECTIONS
       ============================================ */

    .section {
        padding: 4rem 1.5rem !important;
    }

    .section-title {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    .section-subtitle {
        font-size: 1rem !important;
        margin-bottom: 3rem !important;
    }

    /* ============================================
       CARDS & GRID LAYOUTS
       ============================================ */

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .card {
        padding: 1.5rem !important;
        margin-bottom: 1rem;
    }

    /* ============================================
       PRICING TABLES
       ============================================ */

    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 0 1.5rem !important;
    }

    .pricing-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ============================================
       STATS & METRICS
       ============================================ */

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1rem !important;
    }

    .stat-value {
        font-size: 2rem !important;
    }

    .stat-label {
        font-size: 0.85rem !important;
    }

    /* ============================================
       FOOTER
       ============================================ */

    .footer {
        padding: 3rem 1.5rem 2rem !important;
    }

    .footer-content {
        flex-direction: column !important;
        gap: 2rem !important;
        text-align: center;
    }

    .footer-section {
        width: 100% !important;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* ============================================
       BUTTONS & INTERACTIVE ELEMENTS
       ============================================ */

    .btn,
    button,
    a.button {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0.75rem 1.5rem !important;
        font-size: 1rem !important;
    }

    /* Larger touch targets */
    input,
    select,
    textarea {
        min-height: 48px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem !important;
    }

    /* ============================================
       IMAGES & MEDIA
       ============================================ */

    img {
        max-width: 100% !important;
        height: auto !important;
    }

    video {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ============================================
       MODALS & OVERLAYS
       ============================================ */

    .modal {
        width: calc(100% - 2rem) !important;
        max-width: 500px !important;
        margin: 1rem !important;
    }

    .modal-content {
        padding: 1.5rem !important;
    }

    /* ============================================
       TABLES
       ============================================ */

    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    th,
    td {
        font-size: 0.9rem !important;
        padding: 0.75rem 0.5rem !important;
    }

    /* ============================================
       UTILITY CLASSES
       ============================================ */

    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }

    .text-center-mobile {
        text-align: center !important;
    }

    .full-width-mobile {
        width: 100% !important;
    }
}

/* Tablet Portrait: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
    .nav {
        padding: 0 2rem !important;
    }

    .hero {
        padding: 0 2rem !important;
    }

    .hero h1 {
        font-size: 3.5rem !important;
    }

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

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

    .section {
        padding: 5rem 2rem !important;
    }
}

/* Tablet Landscape: 1024px - 1279px */
@media (min-width: 1024px) and (max-width: 1279px) {
    .hero h1 {
        font-size: 4rem !important;
    }

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

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    *:hover {
        transform: none !important;
    }

    /* Larger touch targets */
    a,
    button,
    .btn,
    input[type="submit"],
    input[type="button"] {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    /* Prevent double-tap zoom */
    * {
        touch-action: manipulation;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS FOR MOBILE
   ============================================ */

@media (max-width: 767px) {
    /* Reduce will-change usage */
    * {
        will-change: auto !important;
    }

    /* Simplify shadows on mobile */
    .card,
    .btn,
    .feature-card {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    }

    /* Reduce blur effects */
    .backdrop-blur {
        backdrop-filter: blur(10px) !important;
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE SUPPORT (Mobile specific)
   ============================================ */

@media (prefers-color-scheme: dark) and (max-width: 767px) {
    body {
        background: #000000;
    }

    .header {
        background: rgba(0, 0, 0, 0.95);
    }
}

/* ============================================
   ORIENTATION HANDLING
   ============================================ */

@media (max-width: 767px) and (orientation: landscape) {
    .hero {
        min-height: 100vh !important;
        padding: 2rem 1.5rem !important;
    }

    .hero h1 {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    .hero .subtitle {
        font-size: 0.95rem !important;
        margin-bottom: 1.5rem !important;
    }
}

/* ============================================
   SAFE AREA INSETS (iPhone X+)
   ============================================ */

@supports (padding: max(0px)) {
    .header {
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }

    .footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .header,
    .nav-links,
    .mobile-menu-toggle,
    .particles,
    .bg-animation,
    .orb {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }
}
