/**
 * Business Intelligence Page - Optimized Styles
 * Version: 1.0.0
 * 
 * This file consolidates all inline styles and adds performance optimizations
 * for the Business Intelligence Reporting Systems page.
 * 
 * Auto-loaded by functions.php when page slug is 'business-intelligence'
 */

/* ===================================================
   1. CSS CUSTOM PROPERTIES (Z-Index Scale)
   =================================================== */
:root {
    /* Z-Index Hierarchy - Replace arbitrary 9999 values */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* ===================================================
   2. BIGQUERY SECTION - Consolidated from Inline Styles
   =================================================== */
.bigquery-section {
    padding: 120px 20px;
    background: linear-gradient(180deg, rgba(40, 204, 205, 0.05) 0%, transparent 100%);
}

.bigquery-feature-box {
    max-width: 900px;
    margin: 3rem auto;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 3rem;
}

.bigquery-feature-box h3 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--teal-bright);
}

.bigquery-feature-grid {
    display: grid;
    gap: 2rem;
}

.bigquery-feature-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1.5rem;
    align-items: start;
}

.bigquery-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(40, 204, 205, 0.1);
    border-radius: 12px;
    flex-shrink: 0;
}

/* SVG Icon Styling */
.bigquery-icon svg {
    width: 32px;
    height: 32px;
    stroke: var(--teal-bright);
    stroke-width: 1.5;
}

.bigquery-feature-row h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--aqua-light);
}

.bigquery-feature-row p {
    opacity: 0.85;
    line-height: 1.6;
}

.bigquery-section-title {
    text-align: center;
    margin: 4rem 0 3rem;
    font-size: 1.5rem;
    font-weight: 700;
}

/* BigQuery Stack Integration Box */
.bigquery-stack-box {
    max-width: 800px;
    margin: 4rem auto;
    background: linear-gradient(135deg, rgba(40, 204, 205, 0.1), rgba(60, 222, 207, 0.05));
    border: 2px solid var(--teal-bright);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
}

.bigquery-stack-box h3 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.bigquery-stack-box>p {
    opacity: 0.9;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.bigquery-stack-list {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
    list-style: none;
    padding: 0;
}

.bigquery-stack-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bigquery-stack-list li:last-child {
    border-bottom: none;
}

.bigquery-stack-list li strong {
    color: var(--aqua-light);
}

/* Problem/Solution Banners */
.problem-banner {
    background: rgba(40, 204, 205, 0.1);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--teal-bright);
}

/* ===================================================
   3. PERFORMANCE OPTIMIZATIONS
   =================================================== */

/* Fallback for devices that don't support backdrop-filter */
@supports not (backdrop-filter: blur(12px)) {

    .glass-dashboard,
    .use-case-card,
    .btn-secondary {
        background: rgba(20, 25, 40, 0.95);
    }
}

/* Fix iOS background jitter - use pointer:coarse to detect touch */
@media (pointer: coarse) {
    body {
        background-attachment: scroll;
    }
}

/* Reduce animation complexity on low-end devices */
@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;
    }

    .glass-dashboard {
        animation: none;
    }

    .status-dot {
        animation: none;
    }
}

/* ===================================================
   4. MOBILE TABLE FIX - Comparison Section
   =================================================== */
@media (max-width: 768px) {

    /* Horizontal scroll approach */
    .comparison-table {
        overflow-x: auto;
        display: block;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .comparison-row,
    .comparison-header {
        min-width: 600px;
    }

    /* Scroll indicator shadow */
    .comparison-table::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, var(--dark-bg), transparent);
        pointer-events: none;
    }
}

/* Alternative: Card View for Mobile */
.comparison-table.card-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 768px) {
    .comparison-table.card-view .comparison-header {
        display: none;
    }

    .comparison-table.card-view .comparison-row {
        display: flex;
        flex-direction: column;
        min-width: 100%;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        overflow: hidden;
        background: rgba(255, 255, 255, 0.02);
    }

    .comparison-table.card-view .comparison-row>div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .comparison-table.card-view .comparison-row>div:last-child {
        border-bottom: none;
    }

    .comparison-table.card-view .comparison-row>div::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--teal-bright);
        flex-shrink: 0;
        margin-right: 1rem;
    }
}

/* ===================================================
   5. FONT OPTIMIZATION
   =================================================== */

/* Use tabular nums for metrics instead of JetBrains Mono */
.metric-value,
.use-case-tracks,
.use-case-number {
    font-family: 'Inter', sans-serif;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* System monospace fallback for code displays */
.code-block,
.technical-spec {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

/* ===================================================
   6. ACCESSIBILITY IMPROVEMENTS
   =================================================== */

/* Focus states for keyboard navigation */
.faq-question:focus {
    outline: 2px solid var(--teal-bright);
    outline-offset: 2px;
}

.faq-question:focus-visible {
    outline: 2px solid var(--teal-bright);
    outline-offset: 2px;
}

.btn:focus,
.btn:focus-visible {
    outline: 2px solid var(--aqua-light);
    outline-offset: 3px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--teal-bright);
    color: var(--dark-bg);
    padding: 8px 16px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Improve color contrast for accessibility */
.lose {
    color: rgba(255, 255, 255, 0.6);
    /* Increased from 0.4 for WCAG compliance */
}

/* ===================================================
   7. Z-INDEX FIXES - Replace 9999 with proper scale
   =================================================== */

/* WordPress Header - Use scale values */
#masthead,
.site-header,
header,
nav,
.wp-block-navigation,
.navigation-wrapper {
    position: relative;
    z-index: var(--z-fixed);
}

.sub-menu,
.wp-block-navigation__submenu-container,
.dropdown-menu {
    z-index: var(--z-popover);
}

/* Hero stays behind header */
.hero {
    z-index: var(--z-base);
}

/* Future modals will work correctly */
.modal-overlay {
    z-index: var(--z-modal-backdrop);
}

.modal-content {
    z-index: var(--z-modal);
}

/* ===================================================
   8. SVG ICON SYSTEM (Replaces Emojis)
   =================================================== */

.icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: rgba(40, 204, 205, 0.1);
    border-radius: 12px;
    flex-shrink: 0;
}

.icon-wrapper svg {
    width: 32px;
    height: 32px;
    stroke: var(--teal-bright);
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Problem icons with red tint */
.problem-card .icon-wrapper {
    background: rgba(255, 100, 100, 0.1);
}

.problem-card .icon-wrapper svg {
    stroke: #ff6b6b;
}

/* ===================================================
   9. ADDITIONAL MOBILE OPTIMIZATIONS
   =================================================== */

@media (max-width: 480px) {

    /* Prevent H1 text from wrapping too much */
    h1 {
        font-size: clamp(2rem, 8vw, 2.5rem);
        word-break: break-word;
        hyphens: auto;
    }

    /* Reduce padding on mobile */
    .problem-section,
    .solution-section,
    .comparison-section,
    .use-cases-section,
    .faq-section,
    .final-cta,
    .bigquery-section {
        padding: 60px 15px;
    }

    /* Stack CTAs vertically */
    .cta-group {
        flex-direction: column;
        gap: 1rem;
    }

    .cta-group .btn {
        width: 100%;
        text-align: center;
    }

    /* Reduce step number size */
    .step-number {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    /* Improve use case card spacing */
    .use-case-card {
        padding: 1.5rem;
    }

    .use-case-number {
        font-size: 2rem;
    }
}

/* ===================================================
   10. PRINT STYLES
   =================================================== */

@media print {
    .hero {
        min-height: auto;
        padding: 20px;
    }

    .glass-dashboard {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .btn {
        border: 1px solid #333;
    }

    .cta-group,
    .dashboard-visual {
        display: none;
    }

    body {
        background: white !important;
        color: black !important;
    }
}