/**
 * WhenBRRR McKinsey Enterprise Enhancements
 * Premium visual polish and micro-interactions
 * 
 * Import AFTER enterprise-variables.css
 * 
 * @version 2.0.0
 */

/* ============================================================================
   GLOBAL RESETS & IMPROVEMENTS
   ============================================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--surface-secondary);
    margin: 0;
    padding: 0;
}

/* ============================================================================
   TYPOGRAPHY - McKinsey Grade
   ============================================================================ */

/* Display Headlines - For hero sections */
.text-display {
    font-size: var(--text-display);
    font-weight: var(--font-extrabold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

/* Page Headlines */
.text-headline {
    font-size: var(--text-headline);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

/* Section Titles */
.text-title {
    font-size: var(--text-title);
    font-weight: var(--font-bold);
    line-height: var(--leading-snug);
    color: var(--text-primary);
}

/* Card Titles */
.text-card-title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    line-height: var(--leading-snug);
    color: var(--text-primary);
}

/* Metric Values - Large Numbers */
.text-metric {
    font-size: var(--text-7xl);
    font-weight: var(--font-extrabold);
    line-height: var(--leading-none);
    letter-spacing: var(--tracking-tight);
    font-variant-numeric: tabular-nums;
}

.text-metric-sm {
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    line-height: var(--leading-none);
    font-variant-numeric: tabular-nums;
}

/* Labels & Captions */
.text-label {
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.text-caption {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: var(--leading-relaxed);
}

/* ============================================================================
   ENTERPRISE CARD SYSTEM
   ============================================================================ */

.enterprise-card {
    background: var(--surface-primary);
    border-radius: var(--radius-xl);
    padding: var(--padding-card);
    border: 1px solid var(--border-light);
    box-shadow: var(--elevation-2);
    transition: 
        box-shadow var(--duration-normal) var(--ease-out),
        transform var(--duration-normal) var(--ease-out),
        border-color var(--duration-normal) var(--ease-out);
}

.enterprise-card:hover {
    box-shadow: var(--elevation-3);
    border-color: var(--border-medium);
}

.enterprise-card--interactive:hover {
    transform: translateY(-2px);
    box-shadow: var(--elevation-4);
}

.enterprise-card--elevated {
    box-shadow: var(--elevation-4);
}

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

[data-theme="dark"] .enterprise-card--glass {
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.enterprise-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}

.enterprise-card__title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.enterprise-card__icon {
    width: var(--size-icon-lg);
    height: var(--size-icon-lg);
    color: var(--color-brand-500);
}

.enterprise-card__actions {
    display: flex;
    gap: var(--space-2);
}

/* ============================================================================
   ENTERPRISE BUTTON SYSTEM
   ============================================================================ */

.btn-enterprise {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: var(--leading-none);
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: 
        background var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
    min-height: var(--size-touch-min);
}

.btn-enterprise:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary - Main CTA */
.btn-enterprise--primary {
    background: var(--gradient-brand);
    color: white;
    box-shadow: var(--elevation-2), 0 4px 14px -3px rgba(59, 130, 246, 0.35);
}

.btn-enterprise--primary:hover:not(:disabled) {
    box-shadow: var(--elevation-3), 0 8px 20px -4px rgba(59, 130, 246, 0.45);
    transform: translateY(-1px);
}

.btn-enterprise--primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--elevation-1), 0 2px 8px -2px rgba(59, 130, 246, 0.3);
}

/* Secondary */
.btn-enterprise--secondary {
    background: var(--surface-primary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-medium);
    box-shadow: var(--elevation-1);
}

.btn-enterprise--secondary:hover:not(:disabled) {
    background: var(--surface-secondary);
    border-color: var(--border-heavy);
    box-shadow: var(--elevation-2);
}

/* Ghost */
.btn-enterprise--ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-enterprise--ghost:hover:not(:disabled) {
    background: var(--surface-tertiary);
    color: var(--text-primary);
}

/* Success */
.btn-enterprise--success {
    background: var(--gradient-success);
    color: white;
    box-shadow: var(--elevation-2), 0 4px 14px -3px rgba(16, 185, 129, 0.35);
}

.btn-enterprise--success:hover:not(:disabled) {
    box-shadow: var(--elevation-3), 0 8px 20px -4px rgba(16, 185, 129, 0.45);
    transform: translateY(-1px);
}

/* Danger */
.btn-enterprise--danger {
    background: var(--gradient-danger);
    color: white;
    box-shadow: var(--elevation-2), 0 4px 14px -3px rgba(239, 68, 68, 0.35);
}

/* Sizes */
.btn-enterprise--sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    min-height: 2rem;
}

.btn-enterprise--lg {
    padding: var(--space-4) var(--space-7);
    font-size: var(--text-base);
    min-height: 3.25rem;
}

.btn-enterprise--full {
    width: 100%;
}

/* ============================================================================
   ENTERPRISE INPUTS
   ============================================================================ */

.input-enterprise {
    width: 100%;
    padding: var(--padding-input);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-primary);
    background: var(--surface-primary);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-lg);
    outline: none;
    transition: 
        border-color var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out);
    min-height: var(--size-touch-min);
}

.input-enterprise::placeholder {
    color: var(--text-muted);
}

.input-enterprise:hover {
    border-color: var(--border-medium);
}

.input-enterprise:focus {
    border-color: var(--color-brand-500);
    box-shadow: var(--elevation-ring);
}

.input-enterprise--error {
    border-color: var(--color-danger-500);
}

.input-enterprise--error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* ============================================================================
   ENTERPRISE BADGES & PILLS
   ============================================================================ */

.badge-enterprise {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.badge-enterprise--default {
    background: var(--surface-tertiary);
    color: var(--text-secondary);
}

.badge-enterprise--brand {
    background: var(--color-brand-100);
    color: var(--color-brand-700);
}

.badge-enterprise--success {
    background: var(--color-success-100);
    color: var(--color-success-700);
}

.badge-enterprise--warning {
    background: var(--color-warning-100);
    color: var(--color-warning-700);
}

.badge-enterprise--danger {
    background: var(--color-danger-100);
    color: var(--color-danger-700);
}

/* Regime Badges */
.badge-enterprise--high-tide {
    background: var(--regime-high-tide-bg);
    color: var(--regime-high-tide);
}

.badge-enterprise--tailwind {
    background: var(--regime-tailwind-bg);
    color: var(--regime-tailwind);
}

.badge-enterprise--neutral {
    background: var(--regime-neutral-bg);
    color: var(--regime-neutral);
}

.badge-enterprise--low-tide {
    background: var(--regime-low-tide-bg);
    color: var(--regime-low-tide);
}

/* ============================================================================
   HERO METRIC - Premium Styling
   ============================================================================ */

.hero-metric-enterprise {
    background: var(--gradient-dark);
    border-radius: var(--radius-2xl);
    padding: var(--space-10);
    position: relative;
    overflow: hidden;
    box-shadow: var(--elevation-5), var(--elevation-glow-brand);
}

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

.hero-metric-enterprise::after {
    content: '';
    position: absolute;
    bottom: -20%;
    left: -10%;
    width: 50%;
    height: 80%;
    background: radial-gradient(circle at bottom left, rgba(139, 92, 246, 0.1), transparent 70%);
    pointer-events: none;
}

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

.hero-metric-enterprise__label {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: var(--tracking-widest);
    margin-bottom: var(--space-2);
}

.hero-metric-enterprise__value {
    font-size: var(--text-7xl);
    font-weight: var(--font-extrabold);
    color: #ffffff;
    line-height: var(--leading-none);
    margin-bottom: var(--space-4);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero-metric-enterprise__value--positive {
    color: #4ade80;
    text-shadow: 0 4px 20px rgba(74, 222, 128, 0.3);
}

.hero-metric-enterprise__value--negative {
    color: #f87171;
    text-shadow: 0 4px 20px rgba(248, 113, 113, 0.3);
}

.hero-metric-enterprise__context {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

/* ============================================================================
   DATA TABLE - McKinsey Style
   ============================================================================ */

.table-enterprise {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface-primary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--elevation-2);
}

.table-enterprise thead {
    background: var(--surface-secondary);
}

.table-enterprise th {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.table-enterprise td {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    transition: background var(--duration-fast) var(--ease-out);
}

.table-enterprise tbody tr:last-child td {
    border-bottom: none;
}

.table-enterprise tbody tr:hover td {
    background: var(--surface-secondary);
}

/* ============================================================================
   LOADING STATES - Skeleton & Spinner
   ============================================================================ */

.skeleton-enterprise {
    background: linear-gradient(
        90deg,
        var(--surface-tertiary) 25%,
        var(--surface-secondary) 50%,
        var(--surface-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

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

.spinner-enterprise {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--border-light);
    border-top-color: var(--color-brand-500);
    border-radius: 50%;
    animation: spinner-spin 0.6s linear infinite;
}

@keyframes spinner-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font Weight */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-brand { color: var(--text-brand); }
.text-success { color: var(--color-success-600); }
.text-warning { color: var(--color-warning-600); }
.text-danger { color: var(--color-danger-600); }

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* Gap Utilities */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Padding Utilities */
.p-0 { padding: 0; }
.p-2 { padding: var(--space-2); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }

/* Margin Utilities */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

/* Border Radius */
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow Utilities */
.shadow-sm { box-shadow: var(--elevation-1); }
.shadow { box-shadow: var(--elevation-2); }
.shadow-md { box-shadow: var(--elevation-3); }
.shadow-lg { box-shadow: var(--elevation-4); }
.shadow-xl { box-shadow: var(--elevation-5); }

/* Visibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================================
   RESPONSIVE HELPERS
   ============================================================================ */

@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
    .hero-metric-enterprise__value { font-size: var(--text-5xl); }
}

@media (min-width: 768px) {
    .hide-desktop { display: none !important; }
}
