/**
 * McKinsey-Grade Dashboard Design System
 * WhenBRRR Market Intelligence Platform
 * 
 * Design Principles:
 * 1. ONE primary metric dominates (MTI)
 * 2. F-pattern scanning hierarchy
 * 3. Data density without clutter
 * 4. Clear action pathway
 * 5. Consistent 8px grid
 */

/* ============================================================================
   HERO METRIC - The ONE number that matters
   ============================================================================ */

.hero-metric {
    background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%) !important;
    border-radius: 16px !important;
    padding: 32px !important;
    margin-bottom: 24px !important;
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    gap: 24px !important;
    align-items: center !important;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.35) !important;
    position: relative !important;
    overflow: hidden !important;
}

.hero-metric::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 70%);
    pointer-events: none;
}

.hero-metric__content {
    position: relative;
    z-index: 1;
}

.hero-metric__label {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

.hero-metric__value {
    font-size: 72px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1;
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}

.hero-metric__value.positive {
    color: #4ade80;
}

.hero-metric__value.negative {
    color: #f87171;
}

.hero-metric__context {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.hero-metric__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.hero-metric__badge--regime {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    backdrop-filter: blur(8px);
}

.hero-metric__badge--trend {
    background: rgba(74, 222, 128, 0.2);
    color: #4ade80;
}

.hero-metric__badge--trend.down {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.hero-metric__sparkline {
    width: 200px;
    height: 60px;
    position: relative;
    z-index: 1;
}

.hero-metric__cta {
    margin-top: 20px;
}

.hero-metric__cta .btn {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.hero-metric__cta .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* ============================================================================
   SUPPORTING METRICS - Secondary data points
   ============================================================================ */

.metrics-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .metrics-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .metrics-row {
        grid-template-columns: 1fr;
    }
}

.metric-card-v2 {
    background: var(--color-surface, #ffffff);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--color-border, #e5e7eb);
    transition: all 0.2s ease;
    position: relative;
}

[data-theme="dark"] .metric-card-v2 {
    background: #1e293b;
    border-color: #334155;
}

.metric-card-v2:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.metric-card-v2__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.metric-card-v2__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-card-v2__info {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-gray-100, #f3f4f6);
    color: var(--color-gray-500, #6b7280);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

[data-theme="dark"] .metric-card-v2__info {
    background: #334155;
    color: #94a3b8;
}

.metric-card-v2__value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text, #111827);
    line-height: 1.1;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .metric-card-v2__value {
    color: #f1f5f9;
}

.metric-card-v2__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.metric-card-v2__change {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.metric-card-v2__change.up {
    color: #059669;
}

.metric-card-v2__change.down {
    color: #dc2626;
}

.metric-card-v2__percentile {
    font-size: 12px;
    color: var(--color-text-muted, #6b7280);
    background: var(--color-gray-100, #f3f4f6);
    padding: 2px 8px;
    border-radius: 4px;
}

[data-theme="dark"] .metric-card-v2__percentile {
    background: #334155;
    color: #94a3b8;
}

/* Inline sparkline */
.metric-card-v2__sparkline {
    height: 24px;
    margin-top: 12px;
    opacity: 0.8;
}

/* ============================================================================
   REGIME INDICATOR - Status at a glance
   ============================================================================ */

.regime-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    font-weight: 500;
}

.regime-strip--high-tide {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.05));
    border-left: 4px solid #22c55e;
    color: #15803d;
}

.regime-strip--tailwind {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.05));
    border-left: 4px solid #3b82f6;
    color: #1d4ed8;
}

.regime-strip--neutral {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.1), rgba(234, 179, 8, 0.05));
    border-left: 4px solid #eab308;
    color: #a16207;
}

.regime-strip--low-tide {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border-left: 4px solid #ef4444;
    color: #b91c1c;
}

[data-theme="dark"] .regime-strip--high-tide {
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.05));
    color: #4ade80;
}

[data-theme="dark"] .regime-strip--tailwind {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(59, 130, 246, 0.05));
    color: #60a5fa;
}

[data-theme="dark"] .regime-strip--neutral {
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.15), rgba(234, 179, 8, 0.05));
    color: #fbbf24;
}

[data-theme="dark"] .regime-strip--low-tide {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), rgba(239, 68, 68, 0.05));
    color: #f87171;
}

.regime-strip__icon {
    font-size: 20px;
}

.regime-strip__text {
    flex: 1;
}

.regime-strip__action {
    font-size: 13px;
    opacity: 0.8;
}

/* ============================================================================
   ACTION PANEL - Clear next step
   ============================================================================ */

.action-panel {
    background: linear-gradient(135deg, #059669, #047857);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.action-panel__content {
    color: white;
}

.action-panel__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.action-panel__subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.action-panel__btn {
    background: white;
    color: #059669;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.action-panel__btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 640px) {
    .action-panel {
        flex-direction: column;
        text-align: center;
    }
    
    .action-panel__btn {
        width: 100%;
    }
}

/* ============================================================================
   DATA SECTIONS - Organized content blocks
   ============================================================================ */

.section-card {
    background: var(--color-surface, #ffffff);
    border-radius: 12px;
    border: 1px solid var(--color-border, #e5e7eb);
    margin-bottom: 24px;
    overflow: hidden;
}

[data-theme="dark"] .section-card {
    background: #1e293b;
    border-color: #334155;
}

.section-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border, #e5e7eb);
    background: var(--color-gray-50, #f9fafb);
}

[data-theme="dark"] .section-card__header {
    background: #0f172a;
    border-color: #334155;
}

.section-card__title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text, #111827);
    display: flex;
    align-items: center;
    gap: 8px;
}

[data-theme="dark"] .section-card__title {
    color: #f1f5f9;
}

.section-card__body {
    padding: 20px;
}

/* ============================================================================
   SKELETON LOADING STATES
   ============================================================================ */

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-200, #e5e7eb) 0%,
        var(--color-gray-100, #f3f4f6) 50%,
        var(--color-gray-200, #e5e7eb) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        #334155 0%,
        #475569 50%,
        #334155 100%
    );
    background-size: 200% 100%;
}

.skeleton-hero {
    height: 180px;
    border-radius: 16px;
    margin-bottom: 24px;
}

.skeleton-card {
    height: 140px;
    border-radius: 12px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 40%;
}

.skeleton-text.medium {
    width: 70%;
}

/* ============================================================================
   RESPONSIVE REFINEMENTS
   ============================================================================ */

@media (max-width: 768px) {
    .hero-metric {
        padding: 24px;
        grid-template-columns: 1fr;
    }
    
    .hero-metric__value {
        font-size: 48px;
    }
    
    .hero-metric__sparkline {
        width: 100%;
        height: 40px;
        margin-top: 16px;
    }
    
    .metrics-row {
        gap: 12px;
    }
    
    .metric-card-v2 {
        padding: 16px;
    }
    
    .metric-card-v2__value {
        font-size: 28px;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
    .skeleton {
        animation: none;
        background: var(--color-gray-200, #e5e7eb);
    }
    
    .hero-metric__cta .btn,
    .action-panel__btn,
    .metric-card-v2 {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .hero-metric {
        border: 2px solid white;
    }
    
    .metric-card-v2 {
        border-width: 2px;
    }
    
    .regime-strip {
        border-left-width: 6px;
    }
}
