/* ========================================
   LOOKER STUDIO INFOGRAPHIC STYLES
   Google Looker Studio inspired data visualization components
   Version: 1.0.0
   ======================================== */

/* Base card container */
.looker-card {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 16px; /* Increased radius for modern look */
    padding: 32px; /* More breathing room */
    margin: 3rem auto;
    max-width: 800px;
    font-family: var(--font-sans, "Inter", "Roboto", sans-serif);
    box-shadow: 0 10px 30px rgba(0,0,0,0.04); /* Softer, deeper shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.looker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}

[data-theme="dark"] .looker-card {
    background: var(--color-surface, #1a1a2e);
    border-color: var(--color-border, #3a3a4a);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Card title */
.looker-title {
    color: var(--color-text, #3c4043);
    font-size: 24px; /* Larger title */
    font-weight: 700;
    margin-bottom: 32px;
    text-align: center;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

[data-theme="dark"] .looker-title {
    color: var(--color-text, #f0f0f0);
}

/* Bar chart container */
.looker-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: visible;
    max-width: 700px;
    margin: 0 auto;
}

/* Bar row */
.looker-bar-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Bar label */
.looker-bar-label {
    width: 130px;
    min-width: 130px;
    font-size: 14px;
    color: var(--color-text-muted, #3c4043);
    text-align: right;
    flex-shrink: 0;
    font-weight: 500;
}

[data-theme="dark"] .looker-bar-label {
    color: var(--color-text-muted, #b0b0b0);
}

/* Bar track - v5.27.6: increased height for WCAG 2.1 touch target (44px min) */
.looker-bar-track {
    flex: 1;
    min-width: 0;
    background: var(--color-surface-alt, #f1f3f4);
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    position: relative;
    border: 1px solid var(--color-border, #e0e0e0);
}

[data-theme="dark"] .looker-bar-track {
    background: var(--color-surface-alt, #2a2a3e);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

/* Bar fill - v5.28.0: min dimensions ensure touch target even before animation */
.looker-bar-fill {
    height: 100%;
    min-height: 44px; /* v5.28.0: Explicit height for touch target compliance */
    border-radius: 6px; /* Slightly softer corners */
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 0.2s ease, box-shadow 0.2s ease; /* Smoother easing */
    position: relative;
    overflow: hidden;
    transform: translateZ(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    will-change: width, transform;
}

.looker-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.18);
    opacity: 0.6;
}

.looker-bar-row:hover .looker-bar-fill,
.looker-bar-fill:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(0,0,0,0.16);
    outline: none;
}

.looker-bar-fill:focus-visible {
    outline: 2px solid var(--color-primary, #0066CC);
    outline-offset: 2px;
}

/* Bar value */
.looker-bar-value {
    width: 55px;
    min-width: 55px;
    font-size: 14px;
    color: var(--color-text, #3c4043);
    font-weight: 700;
    flex-shrink: 0;
    padding-left: 8px;
    text-align: left;
}

/* Fix WordPress p tag wrapping in bar values */
.looker-bar-chart p,
.looker-bar-row p,
.looker-bar-value p {
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
    font-size: inherit !important;
    color: inherit !important;
    font-weight: inherit !important;
}

/* Ensure bar rows don't break */
.looker-bar-row * {
    flex-shrink: 0;
}

[data-theme="dark"] .looker-bar-value {
    color: var(--color-text, #f0f0f0);
}

/* Google-style colors (solid, no gradients) */
.looker-color-blue { background: #4285F4; }
.looker-color-red { background: #DB4437; }
.looker-color-yellow { background: #F4B400; }
.looker-color-green { background: #0F9D58; }
.looker-color-purple { background: #9C27B0; }
.looker-color-teal { background: #009688; }

/* Stats grid container - 2x2 on desktop/tablet, 1 column on mobile
   CRITICAL: Cross-viewport parity - whatever looks good on desktop must translate to tablet/mobile */
.looker-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    /* v5.28.0: Ensure consistent centering across all viewports */
    width: 100%;
    box-sizing: border-box;
}

/* FIX: Force child stat boxes to be visible when parent grid is visible
   The animation system only adds .anim-visible to the parent container,
   but child elements with data-anim also start at opacity: 0.
   This ensures children are always visible when their parent is visible. */
.looker-stats-grid.anim-visible .looker-stat-box,
.synth-stats-grid.anim-visible .looker-stat-box,
.looker-stats-grid.anim-visible [data-anim],
.synth-stats-grid.anim-visible [data-anim] {
    opacity: 1 !important;
    transform: none !important;
}

/* CRITICAL FIX: Override animation initial state for stat boxes inside grids
   This ensures stat boxes are ALWAYS visible regardless of animation state.
   The data-anim attribute sets opacity: 0 by default in modern-animations.css */
.looker-stats-grid .looker-stat-box,
.synth-stats-grid .looker-stat-box,
.looker-stats-grid [data-anim],
.synth-stats-grid [data-anim] {
    opacity: 1 !important;
    transform: none !important;
}

/* Individual stat box */
.looker-stat-box {
    background: var(--color-surface, #fff);
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}

.looker-stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--color-primary, #4285F4);
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.looker-stat-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1);
    border-color: var(--color-primary, #4285F4);
}

.looker-stat-box:hover::before {
    transform: scaleX(1);
}

[data-theme="dark"] .looker-stat-box {
    background: var(--color-surface, #1a1a2e);
    border-color: var(--color-border, #3a3a4a);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .looker-stat-box:hover {
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
    border-color: var(--color-primary, #8ab4f8);
}

/* Stat value */
.looker-stat-value {
    font-size: 42px;
    color: var(--color-primary, #4285F4);
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -1px;
    line-height: 1;
}

/* Stat label */
.looker-stat-label {
    font-size: 12px;
    color: var(--color-text-muted, #70757a);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 600;
}

[data-theme="dark"] .looker-stat-label {
    color: var(--color-text-muted, #a0a0a0);
}

/* Inline image styles for posts */
.aiwp-inline-image {
    margin: 2.5rem 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.aiwp-inline-image:hover {
    transform: scale(1.01);
}

.aiwp-inline-image img {
    width: 100%;
    height: auto;
    display: block;
}

.aiwp-inline-caption {
    font-size: 0.9rem;
    color: var(--color-text-muted, #666);
    text-align: center;
    margin-top: 0.75rem;
    font-style: italic;
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border, #eee);
    display: inline-block;
    width: 100%;
}

[data-theme="dark"] .aiwp-inline-caption {
    color: var(--color-text-muted, #a0a0a0);
    border-color: var(--color-border, #333);
}

/* Blockquote Enhancements */
blockquote {
    border-left: 5px solid var(--color-primary, #4285F4);
    background: var(--color-surface-alt, #f8f9fa);
    padding: 2rem 2.5rem;
    margin: 2.5rem auto;
    max-width: 800px;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: var(--color-text, #333);
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

blockquote p {
    margin: 0 0 0.75rem 0;
    font-size: 1.15rem;
    line-height: 1.7;
}

blockquote cite {
    display: block;
    margin-top: 1rem;
    font-size: 0.95rem;
    font-style: normal;
    font-weight: 600;
    color: var(--color-primary, #4285F4);
}

[data-theme="dark"] blockquote {
    background: rgba(66, 133, 244, 0.1);
    color: var(--color-text, #e0e0e0);
}

blockquote::before {
    content: '“';
    position: absolute;
    top: 0.5rem;
    left: 1rem;
    font-size: 3rem;
    color: var(--color-primary, #4285F4);
    opacity: 0.2;
    font-family: serif;
    line-height: 1;
}

/* Responsive adjustments - TABLET (577px - 768px): Keep 2x2 grid with adjusted sizing */
@media (max-width: 768px) {
    /* v5.28.0: Tablet gets 2x2 grid like desktop, just slightly smaller max-width 
       Using !important to ensure no other rules can override the 2-column layout */
    .looker-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 500px !important;
        gap: 16px !important;
    }
    
    .looker-bar-label {
        width: 100px;
        min-width: 100px;
        font-size: 13px;
    }
    
    .looker-bar-value {
        width: 55px;
        min-width: 55px;
        font-size: 13px;
    }
    
    .looker-stat-value {
        font-size: 32px;
    }
    
    .looker-stat-label {
        font-size: 11px;
        letter-spacing: 1.2px;
    }
    
    .looker-stat-box {
        padding: 24px 16px;
    }
}

/* v5.28.0: MOBILE (<=576px) - Single column layout for narrow screens */
@media (max-width: 576px) {
    .looker-stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        max-width: 100% !important;
        padding: 0 8px;
    }
    
    .looker-bar-row {
        flex-wrap: wrap;
        gap: 8px;
        min-height: 44px; /* Touch target */
    }
    
    .looker-bar-label {
        width: 100%;
        text-align: left;
        margin-bottom: 4px;
        font-size: 13px;
    }
    
    .looker-bar-track {
        flex: 1;
        min-width: calc(100% - 70px);
        height: 44px; /* WCAG touch target */
    }
    
    .looker-bar-value {
        width: auto;
        min-width: 60px;
        font-size: 13px;
        font-weight: 700;
    }
    
    /* Stat boxes need adequate touch area */
    .looker-stat-box {
        min-height: 100px;
        padding: 20px 16px;
    }
    
    .looker-stat-value {
        font-size: 36px;
    }
    
    .looker-stat-label {
        font-size: 11px;
        letter-spacing: 1px;
    }
}
