/* 
   ULTIMATE GOD MODE - TheLionAI
   Beyond Best-in-Class UI/UX for Mobile & Desktop
   Final Enhancement Layer - January 2026
*/

/* ==========================================
   PART 1: MOBILE-FIRST MASTERY (iOS/Android Quality)
   ========================================== */

/* iOS-Style Haptic Feedback Simulation */
@media (hover: none) and (pointer: coarse) {
    .btn, .card, .nav-link, a, button {
        -webkit-tap-highlight-color: transparent;
        transition: transform 0.1s ease-out, opacity 0.1s ease-out;
    }
    
    .btn:active, .card:active, a:active, button:active {
        transform: scale(0.97);
        opacity: 0.9;
    }
}

/* iPhone Dynamic Island Awareness */
@supports (padding: env(safe-area-inset-top)) {
    .header, header, nav {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}

/* Smooth Momentum Scrolling */
* {
    -webkit-overflow-scrolling: touch;
}

/* No Overscroll Bounce (Android Style) */
html, body {
    overscroll-behavior: none;
}

/* High Refresh Rate Optimization (120Hz Pro Motion) */
@media (prefers-reduced-motion: no-preference) {
    * {
        scroll-behavior: smooth;
    }
    
    .animated, [data-animate] {
        will-change: transform, opacity;
    }
}

/* ==========================================
   PART 2: PREMIUM MICRO-INTERACTIONS
   ========================================== */

/* Magnetic Button Effect (Desktop) */
@media (hover: hover) {
    .btn-primary, .btn-secondary, .cta-btn {
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    }
    
    .btn-primary:hover {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 20px 40px -10px rgba(99, 102, 241, 0.5);
    }
}

/* Card Depth on Hover (3D Pop) */
.glass-product-card, .feature-card, .agent-card, .pricing-card {
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.4s ease,
                border-color 0.3s ease;
}

@media (hover: hover) {
    .glass-product-card:hover, .feature-card:hover, .agent-card:hover {
        transform: translateY(-12px) rotateX(2deg);
        box-shadow: 
            0 30px 60px -15px rgba(0, 0, 0, 0.4),
            0 0 30px rgba(99, 102, 241, 0.15);
    }
}

/* Smooth Focus States (Accessibility++) */
:focus-visible {
    outline: 2px solid var(--primary-light);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ==========================================
   PART 3: DESKTOP BEYOND GOD MODE
   ========================================== */

/* Ultra-Wide Monitor Support (2560px+) */
@media (min-width: 2560px) {
    .container {
        max-width: 1800px;
    }
    
    h1 {
        font-size: 5.5rem;
    }
    
    h2 {
        font-size: 3.5rem;
    }
    
    .products-grid, .features-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 3rem;
    }
}

/* 4K Display Optimization */
@media (min-width: 3840px) {
    html {
        font-size: 20px; /* Scale up base */
    }
    
    .container {
        max-width: 2400px;
    }
}

/* Premium Glass Header (Desktop) */
@media (min-width: 1024px) {
    header, .header {
        background: rgba(15, 23, 42, 0.7);
        -webkit-backdrop-filter: blur(20px) saturate(180%);
        backdrop-filter: blur(20px) saturate(180%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* ==========================================
   PART 4: MOTION & ANIMATION PERFECTION
   ========================================== */

/* Staggered Entrance Animations */
.products-grid > *, .features-grid > *, .sector-grid-preview > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.products-grid > *:nth-child(1) { animation-delay: 0.1s; }
.products-grid > *:nth-child(2) { animation-delay: 0.2s; }
.products-grid > *:nth-child(3) { animation-delay: 0.3s; }
.products-grid > *:nth-child(4) { animation-delay: 0.4s; }
.products-grid > *:nth-child(5) { animation-delay: 0.5s; }
.products-grid > *:nth-child(6) { animation-delay: 0.6s; }

.sector-grid-preview > *:nth-child(1) { animation-delay: 0.05s; }
.sector-grid-preview > *:nth-child(2) { animation-delay: 0.1s; }
.sector-grid-preview > *:nth-child(3) { animation-delay: 0.15s; }
.sector-grid-preview > *:nth-child(4) { animation-delay: 0.2s; }
.sector-grid-preview > *:nth-child(5) { animation-delay: 0.25s; }
.sector-grid-preview > *:nth-child(6) { animation-delay: 0.3s; }
.sector-grid-preview > *:nth-child(7) { animation-delay: 0.35s; }
.sector-grid-preview > *:nth-child(8) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth Section Reveals */
section {
    /* opacity: 0;
    transform: translateY(30px); */
    transition: opacity 0.8s ease, transform 0.8s ease;
}

section.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================
   PART 5: MOBILE NAVIGATION EXCELLENCE
   ========================================== */

/* iOS-Style Bottom Tab Bar */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        background: rgba(15, 23, 42, 0.85);
        -webkit-backdrop-filter: blur(30px) saturate(200%);
        backdrop-filter: blur(30px) saturate(200%);
        border-top: 0.5px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    }
    
    .mobile-nav-item {
        position: relative;
    }
    
    .mobile-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 4px;
        height: 4px;
        background: var(--primary-light);
        border-radius: 50%;
        box-shadow: 0 0 10px var(--primary-light);
    }
}

/* Gesture-Friendly Cards on Mobile */
@media (max-width: 768px) {
    .glass-product-card, .feature-card {
        touch-action: pan-y;
    }
}

/* ==========================================
   PART 6: VISUAL POLISH
   ========================================== */

/* Noise Texture Overlay (Subtle Grain) - DISABLED FOR PERFORMANCE */
/*
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}
*/

/* Premium Glow Effects */
.hero h1, .agent-hero h1 {
    text-shadow: 0 0 80px rgba(99, 102, 241, 0.3);
}

/* Subtle Border Glow on Active Elements */
.btn-primary:focus, input:focus, textarea:focus {
    box-shadow: 
        0 0 0 3px rgba(99, 102, 241, 0.2),
        0 10px 40px -10px rgba(99, 102, 241, 0.4);
}

/* ==========================================
   PART 7: LOADING & SKELETON STATES
   ========================================== */

/* Skeleton Loading Animation */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 25%,
        rgba(255, 255, 255, 0.1) 50%,
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Page Load Animation */
body {
    animation: pageLoad 0.5s ease-out;
}

@keyframes pageLoad {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================
   PART 8: DARK MODE PERFECTION
   ========================================== */

[data-theme="dark"] {
    --bg-elevated: rgba(30, 41, 59, 0.8);
    --border-subtle: rgba(255, 255, 255, 0.06);
}

/* Ensure True Black for OLED Screens */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #000;
    }
    
    .hero, section {
        background-color: #0a0a0f;
    }
}

/* ==========================================
   PART 9: ACCESSIBILITY ENHANCEMENTS
   ========================================== */

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .btn-primary {
        border: 2px solid white;
    }
    
    .card, .feature-card {
        border: 2px solid rgba(255, 255, 255, 0.3);
    }
}

/* Reduce Motion for Vestibular Disorders */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    section {
        opacity: 1;
        transform: none;
    }
    
    .products-grid > *, .features-grid > *, .sector-grid-preview > * {
        opacity: 1;
        transform: none;
        animation: none;
    }
}

/* ==========================================
   PART 10: PRINT STYLES
   ========================================== */

@media print {
    .mobile-bottom-nav,
    .floating-action-button,
    header {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card, .feature-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* ==========================================
   PART 11: CRITICAL MOBILE FIXES
   ========================================== */

/* Fix text overflow on very small screens */
@media (max-width: 400px) {
    h1, h2, h3 {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    .hero-title, .section-title {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .hero-buttons {
        width: 100%;
    }
    
    .hero-buttons .btn {
        width: 100%;
    }
}

/* Ensure proper spacing for bottom nav */
@media (max-width: 768px) {
    main, .main-content {
        padding-bottom: 100px;
    }
    
    footer, .footer {
        margin-bottom: 80px;
    }
}

/* Fix iOS input zoom */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }
}

/* Smooth scrolling for anchor links */
html {
    scroll-padding-top: 100px;
}

/* Fix sticky header overlap */
section[id] {
    scroll-margin-top: 100px;
}

/* Better touch scrolling on cards */
.products-grid, .features-grid, .agents-grid {
    -webkit-overflow-scrolling: touch;
}

/* Prevent layout shift on font load */
body {
    font-display: swap;
}
