/* ==============================================================================
   Office For All - Master Responsive Design System & Media Queries
   Practical Excel Skills & Corporate Analytics Platform
   ============================================================================== */

:root {
    --brand-blue-50: #f0f6fc;
    --brand-blue-100: #e1eef9;
    --brand-blue-500: #0070d2;
    --brand-blue-600: #0054a6; /* Royal Blue Primary */
    --brand-blue-700: #004385;
    --brand-blue-900: #002244;

    --brand-green-50: #f2faf0;
    --brand-green-500: #52b03d;
    --brand-green-600: #4ea72e; /* Office Green Primary */
    --brand-green-700: #3c8524;

    --brand-orange-500: #f58220;
    --brand-orange-600: #e06f12;

    --surface-bg: #f8fafc;
    --card-border: rgba(226, 232, 240, 0.8);
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ==============================================================================
   1. GLOBAL RESET & BASE MOBILE POLISH
   ============================================================================== */

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    overflow-x: hidden;
}

/* Fluid Typography with Clamp */
h1, .fluid-h1 {
    font-size: clamp(1.85rem, 4vw + 1rem, 3.75rem);
    line-height: 1.15;
}

h2, .fluid-h2 {
    font-size: clamp(1.5rem, 3vw + 0.5rem, 2.5rem);
    line-height: 1.2;
}

h3, .fluid-h3 {
    font-size: clamp(1.25rem, 2vw + 0.25rem, 1.75rem);
    line-height: 1.3;
}

/* Smooth Touch Targets on Mobile */
button, 
a, 
input, 
select, 
textarea {
    touch-action: manipulation;
}

/* Custom Scrollbar for Chrome, Edge & Safari */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ==============================================================================
   2. BRAND VISUAL UTILITIES & GLASSMORPHISM
   ============================================================================== */

.brand-gradient {
    background: linear-gradient(135deg, #4ea72e 0%, #0054a6 100%);
}

.brand-gradient-text {
    background: linear-gradient(135deg, #4ea72e 0%, #0054a6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.glass-dark {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Elevating Interactive Cards */
.hover-lift {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}

/* Responsive 16:9 Video Container */
.video-responsive-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #020617;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.video-responsive-container iframe,
.video-responsive-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Horizontal Scrolling with Momemtum */
.scroll-touch-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.scroll-touch-x::-webkit-scrollbar {
    display: none; /* WebKit */
}

/* Responsive Table Wrapper */
.responsive-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

/* ==============================================================================
   3. MEDIA QUERIES: MOBILE COMPACT (< 480px)
   ============================================================================== */

@media (max-width: 479px) {
    /* Tighten container gutters on tiny screens */
    .container, 
    .max-w-7xl,
    .max-w-\[1440px\] {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }

    /* Stack buttons full-width */
    .btn-mobile-stack {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.625rem;
    }

    .btn-mobile-stack > * {
        width: 100%;
        justify-content: center;
    }

    /* Form and search bar inputs */
    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="password"],
    select {
        font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    }

    /* Modal dialogue sizing */
    .mobile-modal-sheet {
        width: 95% !important;
        margin: 1rem auto !important;
        padding: 1.25rem !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* QR Code Display on Extra Small Screens */
    .qr-scanner-box {
        padding: 1rem !important;
    }

    .qr-scanner-img {
        width: 140px !important;
        height: 140px !important;
    }

    /* Course player controls */
    .player-action-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .player-action-bar form,
    .player-action-bar button,
    .player-action-bar a {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ==============================================================================
   4. MEDIA QUERIES: MOBILE STANDARD & PHABLETS (max-width: 639px)
   ============================================================================== */

@media (max-width: 639px) {
    /* Tap target sizing guarantee */
    .tap-target {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Hero section adjustments */
    .hero-dashboard-card {
        margin-top: 1.5rem !important;
        padding: 1.25rem !important;
        border-radius: var(--radius-lg) !important;
    }

    /* MIS Metric Grid in Hero */
    .hero-metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 0.5rem !important;
    }

    .hero-metric-item {
        padding: 0.5rem 0.25rem !important;
    }

    .hero-metric-item p {
        font-size: 1rem !important;
    }

    /* Checkout payment method pills */
    .payment-tab-grid {
        grid-template-columns: 1fr !important;
        gap: 0.625rem !important;
    }

    /* Cart and Checkout Summary */
    .order-summary-card {
        padding: 1.25rem !important;
        border-radius: var(--radius-xl) !important;
    }

    /* Sticky Mobile Navigation */
    .mobile-nav-drawer {
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    }
}

/* ==============================================================================
   5. MEDIA QUERIES: TABLETS & PORTRAIT (640px - 1023px)
   ============================================================================== */

@media (min-width: 640px) and (max-width: 1023px) {
    .tablet-col-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .hero-content-wrapper {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    .hero-dashboard-card {
        max-width: 90% !important;
        margin: 2rem auto !important;
    }

    /* Cart & Checkout split on tablets */
    .checkout-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==============================================================================
   6. MEDIA QUERIES: DESKTOP & LARGE MONITORS (1024px+)
   ============================================================================== */

@media (min-width: 1024px) {
    .desktop-nav-link {
        position: relative;
        transition: color 0.2s ease;
    }

    .desktop-nav-link::after {
        content: '';
        position: absolute;
        bottom: -2px;
        left: 50%;
        width: 0;
        height: 2px;
        background: var(--brand-blue-600);
        transition: width 0.25s ease, left 0.25s ease;
        border-radius: 9999px;
    }

    .desktop-nav-link:hover::after {
        width: 100%;
        left: 0;
    }

    /* Sticky curriculum sidebar in LMS */
    .curriculum-sticky-sidebar {
        position: sticky;
        top: 4.5rem;
        height: calc(100vh - 5rem);
    }
}

/* ==============================================================================
   7. HIGH RESOLUTION (RETINA) ENHANCEMENTS
   ============================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .brand-logo-img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* ==============================================================================
   8. ACCESSIBILITY: REDUCED MOTION PREFERENCE
   ============================================================================== */

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

/* ==============================================================================
   9. PRINT MEDIA QUERIES (Certificates, Receipts & Invoices)
   ============================================================================== */

@media print {
    /* Hide navigation bars, drawers, footers, buttons, and marketing banners */
    nav,
    footer,
    .no-print,
    button,
    .btn,
    form {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    .print-sheet {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Ensure certificate fills page neatly */
    .certificate-frame {
        border: 4px double #0054a6 !important;
        page-break-inside: avoid;
    }

    a[href]::after {
        content: ""; /* Prevent ugly link URLs from printing */
    }
}
