/**
 * OzCopilot - Main Stylesheet
 * Custom styles for the marketing website
 *
 * Structure:
 * 1. Base Utilities (glass panels, glows)
 * 2. Animations & Keyframes
 * 3. iPhone Frame Mockup
 * 4. Feature Panels
 * 5. METAR/Weather Components
 * 6. Checklist Demo
 * 7. Responsive Overrides
 */

/* ==========================================================================
   1. BASE UTILITIES
   ========================================================================== */

.glass-panel {
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-glow {
    box-shadow: 0 0 100px -20px rgba(251, 191, 36, 0.2);
}

/* Prevent iOS Safari from auto-zooming inputs (it zooms when font-size < 16px) */
@media (max-width: 640px), (any-pointer: coarse) {
    #hero-chat-input {
        font-size: 16px;
        line-height: 1.25;
    }
}

/* Scroll lock used while hero chat input is focused (prevents page "Y-scroll" on keyboard open) */
body.oz-scroll-locked {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
}

/* Hero chat: fixed-size widget with internal scrolling (prevents growth with content) */
.hero-chat-widget {
    height: min(500px, 70vh);
    display: flex;
    flex-direction: column;
}

/* Make the transcript take remaining space and scroll */
.hero-chat-widget #hero-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Accent color glows */
.glow-blue { box-shadow: 0 0 40px -10px rgba(59, 130, 246, 0.3); }
.glow-sky { box-shadow: 0 0 40px -10px rgba(14, 165, 233, 0.3); }
.glow-emerald { box-shadow: 0 0 40px -10px rgba(16, 185, 129, 0.3); }
.glow-violet { box-shadow: 0 0 40px -10px rgba(139, 92, 246, 0.3); }
.glow-amber { box-shadow: 0 0 40px -10px rgba(245, 158, 11, 0.3); }

/* ==========================================================================
   2. ANIMATIONS & KEYFRAMES
   ========================================================================== */

/* Global interaction pause: freeze ALL keyframe animations for 15s after user interaction */
html.oz-paused *, html.oz-paused *::before, html.oz-paused *::after {
    animation-play-state: paused !important;
}

/* Typing indicator animation */
.typing-dot {
    animation: typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Panel slide-up animation */
@keyframes panel-slide-up {
    0%, 18% { transform: translateY(100%); }
    25%, 88% { transform: translateY(0); }
    95%, 100% { transform: translateY(100%); }
}

/* Marker pulse animation */
@keyframes marker-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255,255,255,0.6), 0 2px 6px rgba(0,0,0,0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(255,255,255,0), 0 2px 8px rgba(76, 175, 80, 0.4);
        transform: scale(1.2);
    }
}

/* Content fade animation */
@keyframes content-fade {
    0%, 20% { opacity: 0; transform: translateY(10px); }
    28%, 88% { opacity: 1; transform: translateY(0); }
    95%, 100% { opacity: 0; transform: translateY(-6px); }
}

/* VFR glow animation */
@keyframes vfr-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.5); }
    50% { box-shadow: 0 0 10px 3px rgba(74, 222, 128, 0.3); }
}

/* ==========================================================================
   3. IPHONE FRAME MOCKUP
   ========================================================================== */

.iphone-frame {
    position: relative;
    width: 350px;
    height: 720px;
    background: #1a1a1a;
    border-radius: 50px;
    padding: 12px;
    box-shadow:
        0 50px 100px -20px rgba(0, 0, 0, 0.7),
        inset 0 0 0 2px #333,
        inset 0 0 0 4px #1a1a1a;
    margin: 0 auto;
}

.iphone-island {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 95px;
    height: 30px;
    background: #000;
    border-radius: 16px;
    z-index: 30;
}

.iphone-screen {
    position: relative;
    width: 100%;
    height: 100%;
    background: #1e293b;
    border-radius: 42px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.iphone-home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 5px;
    background: rgba(255,255,255,0.25);
    border-radius: 3px;
    z-index: 30;
}

/* ==========================================================================
   3b. IPAD FRAME MOCKUP (RESPONSIVE: LANDSCAPE -> PORTRAIT)
   ========================================================================== */

.ipad-frame {
    position: relative;
    width: min(980px, 100%);
    aspect-ratio: 4 / 3;
    background: #0b1220;
    border-radius: 44px;
    padding: 18px;
    box-shadow:
        0 50px 100px -20px rgba(0, 0, 0, 0.7),
        inset 0 0 0 2px rgba(255,255,255,0.10),
        inset 0 0 0 6px rgba(0,0,0,0.35);
    margin: 0 auto;
    transition:
        width 320ms ease,
        padding 320ms ease,
        border-radius 320ms ease,
        box-shadow 320ms ease;
}

.ipad-screen {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 30px;
    overflow: hidden;
    position: relative;
    touch-action: pan-y;
}

.ipad-camera {
    position: absolute;
    top: 9px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 10px;
    background: #050a14;
    border-radius: 999px;
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,0.06),
        inset 0 2px 6px rgba(0,0,0,0.6);
    z-index: 40;
}

.ipad-home-indicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 5px;
    background: rgba(255,255,255,0.22);
    border-radius: 999px;
    z-index: 40;
}

/* Portrait mode (phones + touch devices): show the iPad in portrait to match vertical screenshots
   - The (hover/pointer) clause helps on iOS when users request "Desktop Site" (viewport may be wide). */
@media (max-width: 640px), ((any-pointer: coarse) and (orientation: portrait)) {
    .ipad-frame {
        width: min(560px, 100%);
        aspect-ratio: 3 / 4;
        border-radius: 52px;
        padding: 16px;
    }

    .ipad-screen {
        border-radius: 34px;
    }

    .ipad-camera {
        width: 62px;
        height: 10px;
        top: 10px;
    }

    .ipad-home-indicator {
        width: 96px;
        bottom: 12px;
    }
}

.carousel-slide {
    width: 100%;
    height: 100%;
    flex-shrink: 0;
    position: relative;
}

.carousel-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.carousel-caption {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 20;
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.2s ease, border-color 0.2s ease;
    z-index: 50;
}

.carousel-control:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255,255,255,0.18);
}

.carousel-control-prev { left: 14px; }
.carousel-control-next { right: 14px; }

/* ==========================================================================
   4. FEATURE PANELS
   ========================================================================== */

/* Feature panel (reusable) */
.feature-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 78%;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-top: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    animation: panel-slide-up 15s ease-in-out infinite;
    overflow-y: auto;
    z-index: 15;
}

.feature-panel > div:only-child {
    min-height: 100%;
}

/* Route briefing drawer: single drawer with fixed header + scroll body (matches app layout) */
.route-panel {
    /* Always visible (single drawer over map) */
    transform: translateY(0);
    animation: none;
    /* More like the app: nearly full-height drawer */
    height: 72%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 220ms ease;
}

.route-panel-header {
    padding: 12px 12px 10px;
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.98) 0%, rgba(15, 23, 42, 0.92) 100%);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
}

.route-panel-scroll {
    padding: 0 12px 18px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Dismissed state: slide drawer down to reveal map */
.route-panel.is-dismissed {
    transform: translateY(110%);
    pointer-events: none;
}

/* "Back to briefing" launcher shown only when dismissed */
.route-briefing-launcher {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 21;
    display: inline-flex;
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}
.route-panel.is-dismissed ~ .route-briefing-launcher {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Fade-in reveal when scrolled into view */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 500ms ease, transform 500ms ease;
}
.reveal-on-scroll.is-revealed {
    opacity: 1;
    transform: none;
}

/* Respect reduced-motion preferences (avoid hiding content behind animation) */
@media (prefers-reduced-motion: reduce) {
    .reveal-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Briefing section fold animation (smooth expand/collapse) */
.briefing-section-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 320ms ease, opacity 220ms ease;
}
.briefing-section.is-open .briefing-section-content {
    max-height: 1200px; /* large enough for demo content */
    opacity: 1;
}
.briefing-chevron {
    transition: transform 220ms ease;
}
.briefing-section.is-open .briefing-chevron {
    transform: rotate(180deg);
}

/* Preflight profile tabs: crossfade between two independently scrollable panes */
.preflight-tab-content {
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
    -webkit-overflow-scrolling: touch;
}
.preflight-tab-content.is-active {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

/* Pilot Records cycling panels: Hangar, Documents, Logbook */
 .pilot-showcase .metar-map-area .feature-panel.pilot-panel {
     /* Override feature-panel "drawer" look -> make it a full-screen page */
     position: absolute;
     inset: 0;
     height: 100%;
     border-radius: 0;
     border-top: none;
     background: linear-gradient(180deg, rgba(15, 23, 42, 0.98) 0%, rgba(2, 6, 23, 0.98) 100%);
     box-shadow: none;
 
     opacity: 0;
     pointer-events: none;
     transition: opacity 260ms ease-in-out;
 
     animation: none !important;
     transform: translateY(0) !important;
     z-index: 5;
     overflow-y: auto;
     -webkit-overflow-scrolling: touch;
 }
 .pilot-showcase .metar-map-area .feature-panel.pilot-panel.is-active {
     opacity: 1;
     pointer-events: auto;
     z-index: 10;
 }
/* Disable the staggered panel-slide animation for pilot panels */
.pilot-showcase .pilot-panel .panel-content {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

 /* Pilot selector active state */
 .pilot-feature-btn {
     transition: background 180ms ease, color 180ms ease;
 }
 .pilot-feature-btn.is-active {
     background: rgba(15, 23, 42, 0.9);
     color: #fff;
 }

 /* Make sure pilot pages always start below the combined header+selector block */
 .pilot-showcase .pilot-page-content {
     padding-top: 100px;
     /* Push content to the bottom of the panel */
     min-height: 100%;
     display: flex;
     flex-direction: column;
     justify-content: flex-end;
 }

 /* No drawer handle on page-style panels */
 .pilot-showcase .pilot-panel .drawer-handle {
     display: none;
 }

/* Route widget should be a single drawer: hide the persistent bottom nav just for this showcase */
.route-briefing-showcase .metar-bottom-nav {
    display: none;
}

/* Ensure the route briefing drawer does NOT inherit showcase auto-slide animations */
.route-briefing-showcase .feature-panel.route-panel {
    animation: none !important;
    animation-delay: 0s !important;
}

/* Keep the drawer visible by default (but allow the dismissed state to slide it away) */
.route-briefing-showcase .feature-panel.route-panel:not(.is-dismissed) {
    transform: translateY(0) !important;
}

/* Keep route briefing content static (no looping fade animation) */
.route-briefing-showcase .route-panel .panel-content {
    opacity: 1;
    transform: none;
    animation: none;
}

/* Feature screen background */
.feature-screen-bg {
    position: absolute;
    inset: 0;
    object-fit: cover;
    object-position: top center;
    width: 100%;
    height: 100%;
}

/* Panel content animations */
.panel-content {
    opacity: 0;
    transform: translateY(10px);
    animation: content-fade 15s ease-out infinite;
}
.panel-content:nth-child(1) { animation-delay: 0.2s; }
.panel-content:nth-child(2) { animation-delay: 0.4s; }
.panel-content:nth-child(3) { animation-delay: 0.6s; }
.panel-content:nth-child(4) { animation-delay: 0.8s; }

/* Themed showcase variants */
.showcase-violet .feature-panel {
    border-top-color: rgba(139,92,246,0.3);
}
.showcase-emerald .feature-panel {
    border-top-color: rgba(16,185,129,0.3);
}
.showcase-sky .feature-panel {
    border-top-color: rgba(14,165,233,0.3);
}
.showcase-amber .feature-panel,
.showcase-amber .metar-panel {
    border-top-color: rgba(245,158,11,0.3);
}

/* Staggered animation delays for showcases */
.showcase-delay-1 .feature-panel {
    animation: panel-slide-up 15s ease-in-out infinite;
    animation-delay: 0s;
}
.showcase-delay-2 .feature-panel {
    animation: panel-slide-up 15s ease-in-out infinite;
    animation-delay: 5s;
}
.showcase-delay-3 .feature-panel {
    animation: panel-slide-up 15s ease-in-out infinite;
    animation-delay: 10s;
}
.showcase-delay-4 .feature-panel,
.showcase-delay-4 .metar-panel {
    animation: panel-slide-up 15s ease-in-out infinite;
    animation-delay: 15s;
}

/* ==========================================================================
   5. METAR/WEATHER COMPONENTS
   ========================================================================== */

/* Map area - fills screen above bottom nav */
.metar-map-area {
    position: relative;
    flex: 1;
    /* Important for scrollable children inside flex layouts (prevents scroll from "not working") */
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
}

/* Pilot Records: align the right-side "Current / date" meta block a touch lower + centered */
.pilot-showcase .doc-row .text-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    line-height: 1.15;
    /* Slightly lower the visual baseline (fixes "too high" look across rows) */
    margin-top: 1px;
}

.metar-map-bg {
    position: absolute;
    inset: 0;
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* Fallback gradient if no image */
.metar-map-fallback {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 35% 45%, rgba(45, 85, 55, 0.5) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 65% 35%, rgba(55, 95, 65, 0.4) 0%, transparent 55%),
        radial-gradient(ellipse 70% 55% at 50% 70%, rgba(60, 80, 50, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse 40% 30% at 80% 30%, rgba(40, 80, 110, 0.4) 0%, transparent 100%),
        linear-gradient(145deg, #0a1628 0%, #152238 50%, #0d1a2d 100%);
}

/* Weather panel - slides up from bottom */
.metar-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 65%;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
    border-top: 1px solid rgba(255,255,255,0.15);
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    animation: panel-slide-up 15s ease-in-out infinite;
    overflow-y: auto;
    z-index: 15;
}

/* Bottom Nav - ALWAYS visible, full width */
.metar-bottom-nav {
    position: relative;
    z-index: 20;
    background: #1e293b;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding: 8px 0 20px;
}

/* Airport markers */
.airport-marker {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.marker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.5);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.marker-label {
    font-size: 9px;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    margin-top: 2px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    letter-spacing: 0.3px;
}

/* Flight rules colors */
.marker-vfr { background: #4CAF50; }
.marker-mvfr { background: #2196F3; }
.marker-ifr { background: #F44336; }
.marker-lifr { background: #9C27B0; }

.marker-selected .marker-dot {
    animation: marker-pulse 1.5s ease-in-out infinite;
}

/* VFR dot pulse */
.vfr-pulse {
    animation: vfr-glow 2s ease-in-out infinite;
}

/* Flight rules legend */
.flight-rules-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    display: flex;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
    z-index: 12;
}

/* Risk gauge bar */
.risk-gauge {
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #10b981 0%, #10b981 33%, #eab308 33%, #eab308 66%, #ef4444 66%, #ef4444 100%);
}

.risk-gauge-marker {
    width: 3px;
    height: 12px;
    background: white;
    border-radius: 1px;
    margin-top: -3px;
}

/* ==========================================================================
   6. CHECKLIST DEMO
   ========================================================================== */

.checklist-demo-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.checklist-demo-header {
    background: rgba(30, 41, 59, 0.95);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.checklist-section-header {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
}

.checklist-demo-item {
    transition: background 0.3s ease;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.checklist-demo-item:hover {
    background: rgba(255,255,255,0.03);
}

.checklist-demo-item.checked {
    background: rgba(16, 185, 129, 0.15);
}

.checklist-demo-item .checkbox {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(100, 116, 139, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checklist-demo-item.checked .checkbox {
    background: #10b981;
    border-color: #10b981;
}

.checklist-demo-item .checkmark {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease;
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.checklist-demo-item.checked .checkmark {
    opacity: 1;
    transform: scale(1);
}

.checklist-demo-item .item-title {
    color: white;
    font-size: 11px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.checklist-demo-item.checked .item-title {
    color: #5eead4;
}

.checklist-demo-item .item-action {
    color: #fbbf24;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.checklist-progress-bar {
    height: 6px;
    background: rgba(100, 116, 139, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.checklist-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #14b8a6);
    border-radius: 3px;
    transition: width 0.4s ease;
    width: 0%;
}

/* ==========================================================================
   7. RESPONSIVE OVERRIDES
   ========================================================================== */

/* Mobile responsive - scale iPhone frame */
@media (max-width: 640px) {
    .iphone-frame {
        width: 300px;
        height: 620px;
        border-radius: 44px;
        padding: 10px;
    }

    .iphone-island {
        width: 82px;
        height: 26px;
        top: 14px;
    }

    .iphone-screen {
        border-radius: 36px;
    }
}
