/* ============================================
   Chroma Sport Studio - Output Display CSS
   1920x1080 Chroma Key Output for OBS/vMix
   ============================================ */

:root {
    --css-deep: #0A261C;
    --css-deep-90: rgba(10, 38, 28, 0.92);
    --css-deep-80: rgba(10, 38, 28, 0.85);
    --css-primary: #18593B;
    --css-secondary: #2A8C5E;
    --css-accent: #38A668;
    --css-accent-light: #4BC87F;
    --css-text: #ECF7F1;
    --css-text-dim: rgba(236, 247, 241, 0.55);
    --css-border: rgba(56, 166, 104, 0.25);
    --css-glow: rgba(56, 166, 104, 0.15);

    --css-warn-low: #F2CD5E;
    --css-warn-med: #D99748;
    --css-critical: #E04040;
    --css-critical-dark: #8C4014;

    --chroma: #00FF00;
}

/* ===== RESET ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--chroma);
    overflow: hidden;
    cursor: none;
}

/* ===== DISPLAY CANVAS ===== */
.display-canvas {
    width: 1920px;
    height: 1080px;
    position: relative;
    overflow: hidden;
}

/* ===== PANELS BASE ===== */
.panel {
    position: absolute;
}

.panel-inner {
    background: var(--css-deep-90);
    border: 1px solid var(--css-border);
    backdrop-filter: blur(12px);
}

/* ===== TOP LEFT: RACE INFO ===== */
.panel-race-info {
    top: 30px;
    left: 30px;
    z-index: 10;
}

.panel-race-info .panel-inner {
    border-radius: 16px;
    padding: 18px 22px;
    min-width: 380px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(56, 166, 104, 0.1);
    animation: slideInLeft 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.race-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(56, 166, 104, 0.12);
}

.race-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--css-secondary), var(--css-accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 4px 12px rgba(56, 166, 104, 0.3);
}

.race-title {
    display: flex;
    flex-direction: column;
}

.race-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--css-text);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    line-height: 1.2;
}

.race-stage {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--css-accent);
    letter-spacing: 0.3px;
}

.race-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    background: rgba(56, 166, 104, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--css-accent);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.stat-data {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--css-text);
}

.stat-value-mono {
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1px;
}

.stat-unit {
    font-size: 0.72rem;
    color: var(--css-text-dim);
    font-weight: 500;
}

/* ===== TOP RIGHT: TECHNICAL PANEL ===== */
.panel-technical {
    top: 30px;
    right: 30px;
    z-index: 10;
}

.panel-technical .panel-inner {
    border-radius: 16px;
    padding: 18px 22px;
    min-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(56, 166, 104, 0.1);
    animation: slideInRight 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.tech-block {
    padding: 10px 0;
    border-bottom: 1px solid rgba(56, 166, 104, 0.08);
}

.tech-block:last-child {
    border-bottom: none;
}

.tech-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--css-text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.tech-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--css-text);
    font-family: 'JetBrains Mono', monospace;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.tech-value-sm {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.tech-unit {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--css-text-dim);
}

/* ===== BREAKAWAY RADAR ===== */
.breakaway-indicator {
    width: 8px;
    height: 8px;
    background: var(--css-accent);
    border-radius: 50%;
    display: inline-block;
    animation: breakawayPulse 1.5s infinite;
}

.breakaway-indicator.b2 {
    background: var(--css-warn-low);
}

@keyframes breakawayPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(56, 166, 104, 0.5);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(56, 166, 104, 0);
    }
}

.breakaway-data {
    display: flex;
    gap: 20px;
    margin-top: 6px;
}

.breakaway-riders,
.breakaway-gap {
    display: flex;
    flex-direction: column;
}

.breakaway-count {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--css-accent-light);
    font-family: 'JetBrains Mono', monospace;
}

.gap-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--css-warn-low);
    font-family: 'JetBrains Mono', monospace;
}

.breakaway-label {
    font-size: 0.6rem;
    color: var(--css-text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tech-altitude {
    font-size: 0.75rem;
    color: var(--css-text-dim);
    margin-top: 2px;
    font-family: 'JetBrains Mono', monospace;
}

/* ===== ALERT OVERLAY ===== */
.alert-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
}

.alert-overlay.hidden {
    display: none;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--css-deep-90);
    border-radius: 20px;
    padding: 24px 40px;
    border: 2px solid;
    min-width: 500px;
    animation: alertIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Alert types */
.alert-overlay.crash .alert-content {
    border-color: var(--css-critical);
    box-shadow: 0 0 60px rgba(224, 64, 64, 0.3);
}

.alert-overlay.crash .alert-icon {
    background: rgba(224, 64, 64, 0.15);
    color: var(--css-critical);
}

.alert-overlay.crash .alert-type {
    color: var(--css-critical);
}

.alert-overlay.sprint .alert-content,
.alert-overlay.mountain .alert-content {
    border-color: var(--css-warn-low);
    box-shadow: 0 0 60px rgba(242, 205, 94, 0.2);
}

.alert-overlay.sprint .alert-icon,
.alert-overlay.mountain .alert-icon {
    background: rgba(242, 205, 94, 0.15);
    color: var(--css-warn-low);
}

.alert-overlay.sprint .alert-type,
.alert-overlay.mountain .alert-type {
    color: var(--css-warn-low);
}

.alert-overlay.mechanical .alert-content,
.alert-overlay.weather .alert-content {
    border-color: var(--css-warn-med);
    box-shadow: 0 0 60px rgba(217, 151, 72, 0.2);
}

.alert-overlay.mechanical .alert-icon,
.alert-overlay.weather .alert-icon {
    background: rgba(217, 151, 72, 0.15);
    color: var(--css-warn-med);
}

.alert-overlay.mechanical .alert-type,
.alert-overlay.weather .alert-type {
    color: var(--css-warn-med);
}

.alert-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    animation: alertPulse 1.5s infinite;
}

@keyframes alertPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.alert-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-type {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.alert-message {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--css-text);
    line-height: 1.3;
}

/* ===== CLASSIFICATION PANEL ===== */
.panel-classification {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
}

.panel-classification.hidden {
    display: none;
}

.panel-classification .panel-inner {
    border-radius: 18px;
    min-width: 500px;
    overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.class-header {
    background: linear-gradient(135deg, var(--css-primary), var(--css-secondary));
    padding: 14px 22px;
}

.class-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.class-list {
    padding: 8px 0;
}

.class-item {
    display: flex;
    align-items: center;
    padding: 10px 22px;
    gap: 14px;
    border-bottom: 1px solid rgba(56, 166, 104, 0.06);
    animation: slideInLeft 0.4s ease-out;
    animation-fill-mode: both;
}

.class-item:nth-child(1) {
    animation-delay: 0.1s;
}

.class-item:nth-child(2) {
    animation-delay: 0.2s;
}

.class-item:nth-child(3) {
    animation-delay: 0.3s;
}

.class-item:nth-child(4) {
    animation-delay: 0.4s;
}

.class-item:nth-child(5) {
    animation-delay: 0.5s;
}

.class-position {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.class-position.pos-1 {
    background: linear-gradient(135deg, #FFD700, #FFA000);
}

.class-position.pos-2 {
    background: linear-gradient(135deg, #C0C0C0, #808080);
}

.class-position.pos-3 {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
}

.class-position.pos-other {
    background: rgba(56, 166, 104, 0.2);
    color: var(--css-accent);
}

.class-dorsal {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--css-text-dim);
    width: 36px;
}

.class-name {
    flex: 1;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--css-text);
}

.class-team {
    font-size: 0.72rem;
    color: var(--css-text-dim);
    font-weight: 500;
    width: 80px;
    text-align: right;
}

.class-gap {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--css-accent);
    width: 70px;
    text-align: right;
}

/* ===== BOTTOM TICKER ===== */
.panel-ticker {
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    z-index: 20;
    display: flex;
    align-items: stretch;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.ticker-brand {
    background: linear-gradient(135deg, var(--css-primary), var(--css-secondary));
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    font-weight: 800;
    font-size: 0.85rem;
    color: white;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.ticker-logo {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.ticker-content {
    flex: 1;
    background: var(--css-deep-90);
    border-top: 1px solid var(--css-border);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 30s linear infinite;
}

.ticker-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--css-text);
    padding: 0 60px;
    letter-spacing: 0.3px;
}

.ticker-separator {
    color: var(--css-accent);
    font-weight: 700;
    padding: 0 20px;
}

@keyframes tickerScroll {
    0% {
        transform: translate3d(100%, 0, 0);
    }

    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

/* ===== UTILITY ===== */
.hidden {
    display: none !important;
}

/* ===== TRANSITION CLASSES ===== */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.slide-in-left {
    animation: slideInLeft 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.slide-out-left {
    animation: slideOutLeft 0.3s ease-in forwards;
}

@keyframes slideOutLeft {
    to {
        opacity: 0;
        transform: translateX(-40px);
    }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .ticker-track {
        animation: none;
    }
}