/* overlay-styles.css - Styles for Figure Skating Overlay */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: transparent;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ===== LIVESCORE OVERLAY ===== */

#livescore-wrap {
    position: fixed;
    /* top, left, width ustawiane dynamicznie przez JS z config */
    z-index: 9998; /* Pod NAME/EVENT NAME, nad resztą */
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
}

#livescore-wrap.show {
    opacity: 1;
}

/* Pasek kwadratów - absolutnie pozycjonowany względem wrappera */
#ls-squares {
    position: absolute;
    /* top, left, gap ustawiane dynamicznie przez JS z config (%) */
    right: 2.5%;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    z-index: 1;
    user-select: none;
}

.ls-sq {
    display: block;
    /* width ustawiany dynamicznie przez JS z config (%) */
    aspect-ratio: 1 / 1;
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,.75);
    background: rgba(180,180,180,.95);
    border-radius: 2px;
    box-shadow: 0 0 2px rgba(0,0,0,.5);
    position: relative;
    flex-shrink: 0;
}

.ls-sq.pos {
    background: rgba(0,180,0,.95);
}

.ls-sq.neg {
    background: rgba(200,0,0,.95);
}

.ls-sq.neutral {
    background: rgba(180,180,180,.95);
}

.ls-sq.pending {
    background: transparent;
    border-style: dashed;
    opacity: .6;
}

.ls-sq.x {
    background: rgba(180,180,180,.95);
    border-color: rgba(255,255,255,.8);
}

.ls-sq.x::before,
.ls-sq.x::after {
    content: "";
    position: absolute;
    left: 15%;
    right: 15%;
    top: 50%;
    height: 2px;
    background: rgba(220,0,0,.95);
    transform-origin: center;
}

.ls-sq.x::before {
    transform: translateY(-50%) rotate(45deg);
}

.ls-sq.x::after {
    transform: translateY(-50%) rotate(-45deg);
}

/* Style dla tekstów SVG w livescore */
.ls-label {
    font-weight: 600;
    letter-spacing: .01em;
    user-select: none;
    pointer-events: none;
}

.ls-metric {
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,.6);
    user-select: none;
    pointer-events: none;
}

.ls-row-text {
    font-weight: 700;
    letter-spacing: .01em;
    text-shadow: 0 1px 2px rgba(0,0,0,.55);
    user-select: none;
    pointer-events: none;
    fill: #ffffff;
}

/* .ls-te font-size jest kontrolowany przez JavaScript z config */

/* ===== EVENT NAME OVERLAY ===== */

#event-name-wrap {
    position: fixed;
    left: 50%;
    /* bottom i width ustawiane dynamicznie przez JS z config */
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
}

#event-name-wrap.show {
    opacity: 1;
}

/* ===== VICTORY CEREMONY OVERLAY ===== */

#victory-wrap {
    position: fixed;
    left: 50%;
    /* bottom i width ustawiane dynamicznie przez JS z config */
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
}

#victory-wrap.show {
    opacity: 1;
}

.victory-title {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.victory-category {
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.victory-medal {
    user-select: none;
    pointer-events: none;
}

.victory-name {
    letter-spacing: 0.02em;
}

/* ===== NAME OVERLAY ===== */

#name-wrap {
    position: fixed;
    left: 50%;
    bottom: 10%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    width: 65vw;
    
    display: none;
    opacity: 0;
    transition: opacity 500ms ease-in-out;
}

#name-wrap.show {
    opacity: 1;
}

/* DEBUG BOXES dla NAME */
#name-debug-boxes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.debug-box {
    position: absolute;
    border: 2px solid;
    pointer-events: none;
}

.debug-flag {
    border-color: rgba(255, 0, 110, 0.8);
    background: rgba(255, 0, 110, 0.15);
}

.debug-name {
    border-color: rgba(0, 212, 255, 0.8);
    background: rgba(0, 212, 255, 0.15);
}

.debug-club {
    border-color: rgba(255, 190, 11, 0.8);
    background: rgba(255, 190, 11, 0.15);
}

.debug-points {
    border-color: rgba(131, 56, 236, 0.8);
    background: rgba(131, 56, 236, 0.15);
}

/* Obrazek tła */
.overlay-image {
    display: block;
    width: 100%;
    height: auto;
    /* opacity ustawiane dynamicznie przez JS z config */
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

/* Logo - pozycjonowane absolutnie, poza SVG (dla kompatybilności z OBS) */
.overlay-logo {
    position: absolute;
    /* pozycja i rozmiar ustawiane dynamicznie przez JS z config */
    object-fit: contain;
    pointer-events: none;
    z-index: 10;
}

/* SVG z tekstami - nałożony na obrazek */
.overlay-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Style dla tekstów SVG */
.svg-text {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    /* text-anchor usunięty - ustawiany indywidualnie w HTML lub JS */
}

.comp-name {
    /* fill ustawiany przez JS z config */
    stroke: none;
    text-anchor: middle;  /* Competition name wyśrodkowany */
}

.category-name {
    /* fill ustawiany przez JS z config */
    stroke: none;
    text-anchor: middle;  /* Category name wyśrodkowany */
    text-transform: uppercase;  /* WIELKIE LITERY */
}

.segment-name {
    /* fill ustawiany przez JS z config */
    stroke: none;
    text-anchor: middle;  /* Segment name wyśrodkowany */
    text-transform: uppercase;  /* WIELKIE LITERY */
}

.ad-text {
    /* fill ustawiany przez JS z config - GRANATOWY */
    stroke: none;
    font-weight: 700;
}

/* ===== JUDGES PANEL OVERLAY ===== */

#judges-wrap {
    position: fixed;
    left: 50%;
    /* bottom i width ustawiane dynamicznie przez JS z config */
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
}

#judges-wrap.show {
    opacity: 1;
}

/* Animacja listy sędziów - podobnie jak w results */
.judge-item {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease;
    transform: translateY(-50px);  /* Pozycja startowa - nad ekranem */
    opacity: 0;
}

.judge-item.slide-in {
    transform: translateY(0);  /* Wskakuje na właściwą pozycję */
    opacity: 1;
}

/* ===== WARMUP GROUP OVERLAY ===== */

#warmup-wrap {
    position: fixed;
    left: 50%;
    /* bottom i width ustawiane dynamicznie przez JS z config */
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
}

#warmup-wrap.show {
    opacity: 1;
}

/* Animacja listy zawodników - podobnie jak w judges */
.skater-item {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease;
    transform: translateY(-50px);  /* Pozycja startowa - nad ekranem */
    opacity: 0;
}

.skater-item.slide-in {
    transform: translateY(0);  /* Wskakuje na właściwą pozycję */
    opacity: 1;
}
/* GOE Box - HTML div z kolorowym tłem */
#ls-goe-wrap {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2%;
    box-sizing: border-box;
    /* border-radius usunięty - ostre krawędzie */
    transition: background-color 0.3s ease;
    font-family: 'Montserrat', Arial, sans-serif;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
    pointer-events: none;
}

#ls-goe-label,
#ls-goe-value {
    color: #FFFFFF;
    line-height: 1;
    white-space: nowrap;
}

/* ===== RESULTS OVERLAY ===== */

#results-wrap {
    position: fixed;
    left: 50%;
    /* bottom i width ustawiane dynamicznie przez JS z config */
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
}

#results-wrap.show {
    opacity: 1;
}

/* DEBUG BOXES dla RESULTS */
#results-debug-boxes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.debug-results-flag {
    border-color: rgba(255, 0, 110, 0.8);
    background: rgba(255, 0, 110, 0.15);
}

.debug-results-name {
    border-color: rgba(0, 212, 255, 0.8);
    background: rgba(0, 212, 255, 0.15);
}

.debug-results-te {
    border-color: rgba(255, 190, 11, 0.8);
    background: rgba(255, 190, 11, 0.15);
}

.debug-results-pcs {
    border-color: rgba(131, 56, 236, 0.8);
    background: rgba(131, 56, 236, 0.15);
}

.debug-results-ded {
    border-color: rgba(255, 100, 0, 0.8);
    background: rgba(255, 100, 0, 0.15);
}

.debug-results-sb {
    border-color: rgba(0, 255, 127, 0.8);
    background: rgba(0, 255, 127, 0.15);
}

.debug-results-score-label {
    border-color: rgba(220, 20, 60, 0.8);
    background: rgba(220, 20, 60, 0.15);
}

.debug-results-score {
    border-color: rgba(220, 20, 60, 0.8);
    background: rgba(220, 20, 60, 0.15);
    border-style: dashed;
}

.debug-results-rank-label {
    border-color: rgba(30, 144, 255, 0.8);
    background: rgba(30, 144, 255, 0.15);
}

.debug-results-rank {
    border-color: rgba(30, 144, 255, 0.8);
    background: rgba(30, 144, 255, 0.15);
    border-style: dashed;
}

.debug-results-segment-score {
    border-color: rgba(50, 205, 50, 0.8);
    background: rgba(50, 205, 50, 0.15);
}

.debug-results-segment-rank {
    border-color: rgba(255, 20, 147, 0.8);
    background: rgba(255, 20, 147, 0.15);
}

/* Style dla tekstów SVG w results */
.results-text {
    font-weight: 700;
    letter-spacing: .01em;
    text-shadow: 0 1px 2px rgba(0,0,0,.55);
    user-select: none;
    pointer-events: none;
}

/* Animacja elementów results przy pierwszym pokazaniu */
.results-item {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease !important;
    transform: translateY(-50px) !important;  /* Pozycja startowa - nad ekranem */
    opacity: 0 !important;
}

.results-item.slide-in-initial {
    transform: translateY(0) !important;  /* Wskakuje na właściwą pozycję */
    opacity: 1 !important;
}

/* Animacja przejścia segment → total */
.results-segment-element {
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.3s ease;
    transform: translateY(0);  /* Pozycja startowa */
    opacity: 1;
}

.results-total-element {
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.3s ease;
    transform: translateY(-200px);  /* Pozycja startowa - poza ekranem u góry */
    opacity: 0;
    pointer-events: none;  /* Nie przeszkadza podczas gdy jest niewidoczny */
}

/* Klasy dla animacji - również działają bezpośrednio na elementach */
.results-segment-element.slide-out,
.slide-out {
    transform: translateY(200px) !important;  /* Wyjeżdża w dół */
    opacity: 0 !important;
    pointer-events: none !important;
}

.results-total-element.slide-in,
.slide-in {
    transform: translateY(0) !important;  /* Wjeżdża na właściwą pozycję */
    opacity: 1 !important;
    pointer-events: auto !important;
}

.results-detail {
    fill: #FFFFFF;
    stroke: #000000;
    stroke-width: 1.8;
    text-shadow: 0 1px 2px rgba(0,0,0,.55);
}

.results-label {
    fill: #FFFFFF;
    stroke: #000000;
}

.results-value {
    fill: #FFFFFF;
    stroke: #000000;
}

.results-label-big {
    font-size: 31px;
}

.results-value-big {
    font-size: 31px;
    font-weight: 700;
}

.results-segment {
    font-size: 24px;
    font-weight: 600;
}

.results-segment-label {
    font-weight: 600;
}

/* ===== CURRENT STANDINGS OVERLAY ===== */

#current-standings-wrap {
    position: fixed;
    /* right, bottom, width ustawiane dynamicznie przez JS z config */
    z-index: 9998;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.35));
}

#current-standings-wrap.show {
    opacity: 1;
}

/* Animacja rzędów standings - podobnie jak w judges/warmup */
.standings-row {
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.5s ease;
    transform: translateY(-50px);  /* Pozycja startowa - nad ekranem */
    opacity: 0;
}

.standings-row.slide-in {
    transform: translateY(0);  /* Wskakuje na właściwą pozycję */
    opacity: 1;
}

/* Style dla tekstów SVG w current standings */
.standings-text {
    font-weight: 700;
    letter-spacing: .01em;
    user-select: none;
    pointer-events: none;
}
/* ===== STANDINGS OVERLAY (Results List) ===== */

#standings-wrap {
    position: fixed;
    /* bottom, width ustawiane dynamicznie przez JS z config */
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    
    display: none;
    opacity: 0;
    /* transition ustawiany dynamicznie przez JS z config */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
}

#standings-wrap.show {
    opacity: 1;
}

/* Style dla tekstów SVG w standings */
.standings-text {
    font-weight: 700;
    letter-spacing: .01em;
    text-shadow: 0 1px 2px rgba(0,0,0,.55);
    user-select: none;
    pointer-events: none;
}

/* ===== GREEN SCREEN MODE ===== */
/* Wyłącza fade-in/fade-out wrapperów (opacity transition) dla Blackmagic ATEM.
   Animacje wewnętrzne (slide-in sędziów, zawodników, wyników) pozostają aktywne. */

/* Wrappery w trybie greenscreen: bez opacity fade, natychmiastowe show/hide */
body.greenscreen-mode #livescore-wrap,
body.greenscreen-mode #event-name-wrap,
body.greenscreen-mode #victory-wrap,
body.greenscreen-mode #name-wrap,
body.greenscreen-mode #judges-wrap,
body.greenscreen-mode #warmup-wrap,
body.greenscreen-mode #results-wrap,
body.greenscreen-mode #current-standings-wrap,
body.greenscreen-mode #standings-wrap {
    transition: none !important;
}

/* Wrappery z klasą .show: pełna widoczność natychmiast */
body.greenscreen-mode #livescore-wrap.show,
body.greenscreen-mode #event-name-wrap.show,
body.greenscreen-mode #victory-wrap.show,
body.greenscreen-mode #name-wrap.show,
body.greenscreen-mode #judges-wrap.show,
body.greenscreen-mode #warmup-wrap.show,
body.greenscreen-mode #results-wrap.show,
body.greenscreen-mode #current-standings-wrap.show,
body.greenscreen-mode #standings-wrap.show {
    opacity: 1 !important;
}