/* ==========================================================================
   Sales Performer - Global Application Styles
   Dark theme optimized for TV/large monitor display
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */

:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #111827;
    --bg-card: #1a1f3a;
    --bg-card-hover: #232849;
    --bg-input: rgba(10, 14, 39, 0.6);
    --border-color: #2d3561;
    --border-color-light: rgba(45, 53, 97, 0.5);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #2563eb;
    --accent-blue-light: #3b82f6;
    --accent-blue-dark: #074496;
    --accent-cyan: #06b6d4;
    --accent-gold: #f59e0b;
    --accent-gold-light: #fbbf24;
    --accent-green: #10b981;
    --accent-green-light: #34d399;
    --accent-red: #ef4444;
    --accent-red-light: #f87171;
    --accent-purple: #8b5cf6;

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

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --------------------------------------------------------------------------
   Base / Reset
   -------------------------------------------------------------------------- */

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-feature-settings: "palt" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(37, 99, 235, 0.3);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Scrollbar (Dark Theme)
   -------------------------------------------------------------------------- */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d4578;
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-primary);
}

/* --------------------------------------------------------------------------
   Card Components
   -------------------------------------------------------------------------- */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}

.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-color);
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color-light);
}

/* Card accent borders */
.card--accent-blue {
    border-top: 2px solid var(--accent-blue);
}

.card--accent-gold {
    border-top: 2px solid var(--accent-gold);
}

.card--accent-green {
    border-top: 2px solid var(--accent-green);
}

.card--accent-red {
    border-top: 2px solid var(--accent-red);
}

/* --------------------------------------------------------------------------
   Metric Display
   -------------------------------------------------------------------------- */

.metric-value {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.metric-value--lg {
    font-size: 3.5rem;
}

.metric-value--xl {
    font-size: 4.5rem;
}

.metric-value--blue {
    color: var(--accent-blue-light);
}

.metric-value--gold {
    color: var(--accent-gold);
}

.metric-value--green {
    color: var(--accent-green-light);
}

.metric-value--red {
    color: var(--accent-red-light);
}

.metric-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

.metric-sublabel {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
}

.metric-change--up {
    color: var(--accent-green-light);
    background: rgba(16, 185, 129, 0.1);
}

.metric-change--down {
    color: var(--accent-red-light);
    background: rgba(239, 68, 68, 0.1);
}

/* --------------------------------------------------------------------------
   Glow Effects
   -------------------------------------------------------------------------- */

.glow-blue {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3),
                0 0 40px rgba(37, 99, 235, 0.1);
}

.glow-gold {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3),
                0 0 40px rgba(245, 158, 11, 0.1);
}

.glow-green {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3),
                0 0 40px rgba(16, 185, 129, 0.1);
}

.glow-red {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3),
                0 0 40px rgba(239, 68, 68, 0.1);
}

.text-glow-blue {
    text-shadow: 0 0 20px rgba(37, 99, 235, 0.4),
                 0 0 40px rgba(37, 99, 235, 0.15);
}

.text-glow-gold {
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.4),
                 0 0 40px rgba(245, 158, 11, 0.15);
}

.text-glow-green {
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.4),
                 0 0 40px rgba(16, 185, 129, 0.15);
}

/* --------------------------------------------------------------------------
   Chart Container (Dark Theme)
   -------------------------------------------------------------------------- */

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: relative;
}

.chart-container canvas {
    max-width: 100%;
}

/* --------------------------------------------------------------------------
   Table Styles (Dark Theme)
   -------------------------------------------------------------------------- */

.table-dark {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-dark thead th {
    background: rgba(10, 14, 39, 0.5);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color-light);
    text-align: left;
}

.table-dark tbody tr {
    transition: background 0.15s ease;
}

.table-dark tbody tr:hover {
    background: rgba(35, 40, 73, 0.5);
}

.table-dark tbody td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(45, 53, 97, 0.3);
    color: var(--text-primary);
    font-size: 0.875rem;
}

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

/* --------------------------------------------------------------------------
   Badge Styles (Rank Badges)
   -------------------------------------------------------------------------- */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.025em;
}

.badge--gold {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.badge--silver {
    background: linear-gradient(135deg, rgba(148, 163, 184, 0.2), rgba(100, 116, 139, 0.2));
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
    box-shadow: 0 0 12px rgba(148, 163, 184, 0.15);
}

.badge--bronze {
    background: linear-gradient(135deg, rgba(180, 83, 9, 0.2), rgba(146, 64, 14, 0.2));
    color: #d97706;
    border: 1px solid rgba(180, 83, 9, 0.3);
    box-shadow: 0 0 12px rgba(180, 83, 9, 0.15);
}

.badge--blue {
    background: rgba(37, 99, 235, 0.15);
    color: var(--accent-blue-light);
    border: 1px solid rgba(37, 99, 235, 0.3);
}

.badge--green {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge--red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red-light);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Rank number badges (circular) */
.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 800;
}

.rank-badge--1 {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.rank-badge--2 {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    color: #fff;
    box-shadow: 0 0 12px rgba(148, 163, 184, 0.3);
}

.rank-badge--3 {
    background: linear-gradient(135deg, #b45309, #92400e);
    color: #fff;
    box-shadow: 0 0 12px rgba(180, 83, 9, 0.3);
}

.rank-badge--other {
    background: rgba(45, 53, 97, 0.5);
    color: var(--text-secondary);
}

/* --------------------------------------------------------------------------
   Progress Bar
   -------------------------------------------------------------------------- */

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background: rgba(45, 53, 97, 0.5);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.progress-bar--lg {
    height: 0.75rem;
}

.progress-bar__fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar__fill--blue {
    background: linear-gradient(90deg, var(--accent-blue-dark), var(--accent-blue-light));
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.4);
}

.progress-bar__fill--gold {
    background: linear-gradient(90deg, #b45309, var(--accent-gold), var(--accent-gold-light));
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.progress-bar__fill--green {
    background: linear-gradient(90deg, #047857, var(--accent-green), var(--accent-green-light));
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.progress-bar__fill--red {
    background: linear-gradient(90deg, #b91c1c, var(--accent-red), var(--accent-red-light));
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* Achievement shimmer on progress bar */
.progress-bar__fill--achieved::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    background-size: 200% 100%;
    animation: shimmer-bar 2s linear infinite;
}

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

/* --------------------------------------------------------------------------
   Form Inputs (Dark Theme)
   -------------------------------------------------------------------------- */

.input-dark {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    width: 100%;
}

.input-dark:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15),
                0 0 20px rgba(37, 99, 235, 0.1);
    outline: none;
}

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

/* --------------------------------------------------------------------------
   Button Styles
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

.btn--primary {
    background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
    color: #fff;
}

.btn--primary:hover {
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.4);
    transform: translateY(-1px);
}

.btn--secondary {
    background: rgba(45, 53, 97, 0.5);
    color: var(--text-secondary);
    border: 1px solid var(--border-color-light);
}

.btn--secondary:hover {
    background: rgba(45, 53, 97, 0.8);
    color: var(--text-primary);
}

.btn--gold {
    background: linear-gradient(135deg, var(--accent-gold), #d97706);
    color: #fff;
}

.btn--gold:hover {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Animation Utilities
   -------------------------------------------------------------------------- */

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes count-up-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.animate-fade-in {
    animation: fade-in 0.5s ease-out;
}

.animate-slide-up {
    animation: slide-up 0.4s ease-out;
}

.animate-slide-in-right {
    animation: slide-in-right 0.4s ease-out;
}

.animate-pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite;
}

/* Staggered animation delays */
.animate-delay-1 { animation-delay: 0.1s; animation-fill-mode: both; }
.animate-delay-2 { animation-delay: 0.2s; animation-fill-mode: both; }
.animate-delay-3 { animation-delay: 0.3s; animation-fill-mode: both; }
.animate-delay-4 { animation-delay: 0.4s; animation-fill-mode: both; }
.animate-delay-5 { animation-delay: 0.5s; animation-fill-mode: both; }

/* --------------------------------------------------------------------------
   Gradient Text
   -------------------------------------------------------------------------- */

.gradient-text-blue {
    background: linear-gradient(135deg, #60a5fa, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-green {
    background: linear-gradient(135deg, #34d399, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* --------------------------------------------------------------------------
   Large Screen / TV Optimizations
   -------------------------------------------------------------------------- */

@media (min-width: 1920px) {
    .metric-value {
        font-size: 3.5rem;
    }

    .metric-value--lg {
        font-size: 5rem;
    }

    .metric-value--xl {
        font-size: 6.5rem;
    }

    .metric-label {
        font-size: 1rem;
    }

    .card-body {
        padding: 2rem;
    }

    .rank-badge {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.1rem;
    }

    .table-dark tbody td {
        padding: 1.125rem 1.25rem;
        font-size: 1rem;
    }

    .progress-bar {
        height: 0.75rem;
    }

    .progress-bar--lg {
        height: 1rem;
    }
}

/* --------------------------------------------------------------------------
   Mobile Optimizations
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
    .metric-value {
        font-size: 1.75rem;
    }

    .metric-value--lg {
        font-size: 2.25rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.875rem 1rem;
    }
}
