/* =========================================
   SPIS TREŚCI:
   1. WYKRESY
   2. THUMBNAILS / CAPTIONS
   3. LIGHTBOX
   4. POWIADOMIENIA (INFO HINT)
   5. YOUTUBE / STREAM WIDGET
   6. ZAPOWIEDZI PRZED ZAWODAMI
   7. STRONA GŁÓWNA (HOME)
   8. LISTA WYDARZEŃ I FILTRY (EVENTS)
   9. KARTY WYDARZEŃ I KATEGORIE
   10. PRZEŁĄCZNIK ZAKŁADEK (TABS)
   11. PLAKIETKI I STATUSY (LIVE)
   12. SZCZEGÓŁY WYDARZENIA
   13. NADPISANIE WTYCZEK I FORMULARZY
   14. LISTA STARTOWA
   15. MEDIA QUERIES (GLOBALNE)
   ========================================= */

/* =========================================
   1. WYKRESY
   ========================================= */
.chart-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

#resultsChart { 
    width: 100%; 
    height: 1000px; 
}

/* =========================================
   2. THUMBNAILS / CAPTIONS
   ========================================= */
.thumbnails-container {
    display: grid;
    /* auto-fit sprawia, że kafelki same przeskakują do nowej linii, gdy brakuje miejsca. 
       minmax(80px, 100px) ustala elastyczną szerokość pojedynczego kafelka. */
    grid-template-columns: repeat(auto-fit, minmax(80px, 100px));
    justify-content: center; /* Wyśrodkowuje całą siatkę, gdy obrazków jest np. tylko 4 lub 5 */
    gap: 8px;
    margin: 20px auto;
    width: 100%;
    max-width: 850px; /* Zabezpiecza przed zbyt dużym rozciągnięciem na szerokich monitorach */
}

.thumbnails-container img {
    width: 100%; /* Wypełnia komórkę grida */
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    opacity: 0.9;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.3s ease, box-shadow 0.2s ease;
}

/* Wykorzystujemy :not(:has(...)). Ta reguła zadziała TYLKO wtedy, 
   gdy kontener NIE ma wewnątrz trzeciego elementu. (Dla 1 lub 2 obrazków) */
.thumbnails-container:not(:has(> :nth-child(3))) {
    grid-template-columns: repeat(auto-fit, minmax(150px, 200px));
    gap: 15px;
}

.thumbnails-container:not(:has(> :nth-child(3))) img {
    height: 150px; /* Zwiększamy wysokość dla pojedynczych/podwójnych kafelków */
}

.thumbnails-container figcaption {
    margin-top: 6px;
    padding: 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--white);
    border-radius: 4px;
    text-align: center;
    background-color: var(--bg-color);
    transition: transform 0.2s ease, opacity 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.thumbnails-container figcaption:hover {
    background-color: var(--hover-color);
    scale: var(--scale);
}

.thumbnails-container figcaption.disabled {
    background-color: var(--color-10) !important;
    color: var(--color-4);
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
}

.thumbnails-container figcaption.clicked {
    box-shadow: var(--shadow-light);
    z-index: 2;
    opacity: 1;
}

.no-results {
    opacity: 0.4;
    filter: grayscale(100%);
}

/* =========================================
   3. LIGHTBOX
   ========================================= */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: var(--black-opacity);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox-img {
    max-width: 95%;
    max-height: 80%;
    object-fit: contain;
    background-color: var(--white); 
    padding: 15px;           
    border-radius: 12px;     
    box-sizing: border-box;
}

.lightbox-description {
    color: var(--white);
    margin-top: 10px;
    text-align: center;
    max-width: 90%;
    font-size: 1.1rem;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: var(--white);
    cursor: pointer;
}

/* =========================================
   4. POWIADOMIENIA (INFO HINT)
   ========================================= */
.info-hint {
    background-color: #f0f7ff;
    border: 1px solid #cce3f6;
    color: #334e68;
    padding: 10px 40px 10px 15px; /* Zwiększony prawy padding na krzyżyk (40px) */
    border-radius: 8px;
    font-size: 0.9rem;
    margin: 0 auto 20px auto;
    max-width: fit-content;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    position: relative; /* Wymagane do pozycjonowania krzyżyka */
}

.info-icon {
    font-size: 1.2rem;
}

.info-close {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%); /* Idealne wyśrodkowanie w pionie */
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #627d98;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease-in-out;
}

.info-close:hover {
    color: #102a43; /* Ciemniejszy kolor po najechaniu */
}

@media (max-width: 768px) {
    .info-hint {
        max-width: 100%;
        margin: 0 15px 20px 15px;
        text-align: left;
    }
}

/* =========================================
   5. YOUTUBE / STREAM WIDGET
   ========================================= */
.stream-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px; /* Domyślna szerokość */
    min-width: 320px; /* Minimalna szerokość */
    max-width: 90vw; /* Zabezpieczenie przed wyjściem za ekran */
    background: #000;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    overflow: hidden;
    z-index: 9999;
    /* transition: bottom 0.4s ease, opacity 0.4s ease; Usunięte 'width' dla płynnego rozciągania */
    transition: bottom 0.4s ease, opacity 0.4s ease;
    font-family: Arial, sans-serif;
    display: block;
}

.stream-widget.hidden {
    opacity: 0;
    pointer-events: none;
    bottom: -300px;
}

/* !important zapobiega konfliktom ze zmienioną ręcznie szerokością */
.stream-widget.minimized {
    width: auto !important; 
    min-width: 220px;
}

.stream-widget.minimized #player-wrapper,
.stream-widget.minimized #resize-handle {
    display: none; /* Ukrywa wideo i uchwyt po zminimalizowaniu */
}

/* Uchwyt do rozciągania w lewym górnym rogu */
#resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;  /* Zwiększono dla wygody na ekranach dotykowych */
    height: 24px; /* Zwiększono dla wygody na ekranach dotykowych */
    background: linear-gradient(135deg, rgba(255,255,255,0.7) 0%, rgba(255,255,255,0.7) 45%, transparent 50%);
    cursor: nwse-resize;
    z-index: 10;
    touch-action: none; /* Blokuje przewijanie strony podczas dotykania uchwytu! */
}

#resize-handle:hover {
    background: linear-gradient(135deg, rgba(255,255,255,1) 0%, rgba(255,255,255,1) 45%, transparent 50%);
}

.stream-header {
    background: #222;
    color: white;
    padding: 8px 12px 8px 24px; /* Zrobione miejsce z lewej strony na uchwyt */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.stream-header:hover { background: #333; }
.stream-header button { background: none; border: none; color: #fff; cursor: pointer; font-weight: bold; pointer-events: none; }
#live-indicator { font-weight: bold; }
.offline { color: #aaa; }
.live { color: #ff0000; animation: pulse 1.5s infinite; }

/* Odtwarzacz skaluje się idealnie proporcjonalnie do szerokości okna */
#player-wrapper {
    width: 100%;
    aspect-ratio: 16 / 9; /* Magia CSS - zawsze idealne proporcje */
    position: relative;
}

#player {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}

/* Blokuje wideo przed "kradzieżą" kursora myszki podczas rozciągania */
.stream-widget.is-resizing #player-wrapper {
    pointer-events: none;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.yt-consent-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #111; /* Ciemne tło zamiast pustego odtwarzacza */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.yt-consent-overlay:hover .play-btn {
    transform: scale(1.1);
    background: #ff0000; /* Kolor YouTube po najechaniu */
}

.play-btn {
    font-size: 40px;
    color: white;
    background: #444;
    width: 70px;
    height: 70px;
    line-height: 70px;
    border-radius: 50%;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.yt-consent-overlay p {
    color: #fff;
    margin: 0 0 10px 0;
    font-weight: bold;
}

.yt-consent-overlay small {
    color: #aaa;
    font-size: 11px;
    max-width: 250px;
}

/* =========================================
   6. ZAPOWIEDZI PRZED ZAWODAMI
   ========================================= */
.pre-event-info {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    padding: 40px 30px;
    margin: 20px 0 40px;
    text-align: center;
}

.pre-event-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 5px;
}

.pre-event-subtitle {
    font-size: 1.1rem;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.pre-event-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-box {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    min-width: 150px;
    flex: 1 1 calc(25% - 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid #eee;
}

.stat-icon { font-size: 2rem; margin-bottom: 10px; }
.stat-value { font-size: 1.5rem; font-weight: bold; color: #e74c3c; margin-bottom: 5px;}
.stat-label { font-size: 0.9rem; color: #555; }

.pre-event-description p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 15px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.pre-event-cta {
    font-weight: bold;
    color: #2980b9 !important;
    background: #eaf2f8;
    padding: 15px;
    border-radius: 8px;
    margin-top: 25px !important;
}

.pre-event-description a {
    color: #2980b9; /* Elegancki, zaufany odcień niebieskiego */
    font-weight: 600; /* Delikatne pogrubienie, żeby link "wychodził" z tekstu */
    text-decoration: underline;
    text-decoration-color: rgba(41, 128, 185, 0.4); /* Półprzezroczyste podkreślenie */
    text-decoration-thickness: 2px; /* Odrobinę grubsza, nowoczesna linia */
    text-underline-offset: 4px; /* Odsunięcie linii w dół, żeby nie przecinała liter "p", "y", "j" */
    transition: all 0.2s ease-in-out; /* Płynne przejście animacji */
    padding: 2px 4px;
    margin: 0 -4px; /* Kompensacja paddingu, żeby tekst się nie rozjeżdżał */
    border-radius: 4px;
}

.pre-event-description a:hover,
.pre-event-description a:focus {
    color: #1a5276; /* Ściemnienie tekstu przy najechaniu myszką */
    text-decoration-color: #1a5276; /* Wyraźniejsze, pełne podkreślenie */
    background-color: rgba(41, 128, 185, 0.08); /* Bardzo delikatne, błękitne tło */
}

.pre-event-patronage {
    margin-top: 25px !important;
    border-top: 1px dashed #e0e0e0;
    padding-top: 15px;
}

/* =========================================
   7. STRONA GŁÓWNA (HOME)
   ========================================= */
.home-main-container { margin-top: 0; }
.home-hero-text { font-size: clamp(14px, 2vw, 18px); color: var(--color-1); margin-bottom: 25px; }

.home-search-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 25px; }
.home-search-input { padding: 12px 20px; font-size: 16px; border-radius: 8px; border: 1px solid var(--color-4); width: 100%; max-width: 500px; font-family: inherit; }
.home-search-btn { width: auto; margin: 0; padding: 12px 25px; }

.home-quick-links { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.home-quick-btn { width: auto; margin: 0; display: flex; align-items: center; gap: 8px; }
.home-live-indicator { font-size: 12px; }

.home-section { margin-top: 20px; }

.categories-row { margin: 20px auto; max-width: 1000px; }
.category-btn { margin: 0; flex: 1; min-width: 200px; }

.home-b2b-section { margin-top: 20px; margin-bottom: 40px; border: 2px dashed var(--color-2); }
.home-b2b-text { color: var(--color-1); font-size: 16px; margin-bottom: 25px; max-width: 700px; margin-left: auto; margin-right: auto; line-height: 1.5; }
.home-b2b-btn { width: auto; display: inline-block; padding: 14px 30px; font-weight: bold; }

/* =========================================
   8. LISTA WYDARZEŃ I FILTRY (EVENTS)
   ========================================= */
.events-main-container { width: 80%; margin-top: 2vh; text-align: left; }

.breadcrumbs { font-size: 14px; font-weight: 600; color: var(--color-10); margin-bottom: 25px; padding-bottom: 15px; border-bottom: 1px solid var(--color-4); }
.breadcrumbs a { color: var(--color-2); text-decoration: none; }
.breadcrumbs .sep { margin: 0 8px; }
.breadcrumbs .active { color: var(--base-1); }
.breadcrumbs .search-term { color: var(--color-10); }

.events-layout { display: flex; gap: 30px; flex-wrap: wrap; align-items: flex-start; }
.events-layout-wrapper { display: flex; gap: 30px; align-items: flex-start; }

/* Sidebar z filtrami */
.events-sidebar { flex: 1; min-width: 250px; max-width: 320px; background: var(--color-5); padding: 20px; border-radius: 12px; box-shadow: var(--shadow-light); }
.sidebar-title { margin-top: 0; margin-bottom: 20px; color: var(--base-1); border-bottom: 2px solid var(--color-4); padding-bottom: 10px; }
.filter-form { display: flex; flex-direction: column; gap: 15px; }
.filter-label { display: block; font-size: 13px; font-weight: bold; margin-bottom: 5px; color: var(--color-1); }
.filter-input { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--color-4); font-family: inherit; }
.filter-select { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--color-4); font-family: inherit; background: var(--white); }
.filter-actions { margin-top: 10px; }
.filter-btn-submit { width: 100%; margin: 0 0 10px 0; }
.filter-btn-clear { width: 100%; text-align: center; text-decoration: none; box-sizing: border-box; display: block; margin: 0; }

.date-small-label { font-size: 12px !important; font-weight: normal !important; }

.filters-sidebar { flex: 0 0 250px; background: var(--color-3); padding: 20px; border-radius: 8px; box-shadow: var(--shadow-light); }
.filter-group { margin-bottom: 15px; }
.filter-group label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 14px; }
.filter-group select, .filter-group input[type="date"] { width: 100%; padding: 8px; border-radius: 4px; border: 1px solid var(--color-4); box-sizing: border-box; }
.date-range-group {
    display: flex;
    flex-direction: column; /* Zrzuca pole "Do" pod pole "Od" */
    gap: 10px;
    width: 100%;
}

/* Zmniejszamy boczne marginesy wewnętrzne, żeby dać więcej miejsca na tekst i ikonkę */
.filter-input[type="date"] {
    padding: 8px 10px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
}

.btn-clear-filters {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background-color: var(--color-10);
    color: var(--white);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
}

.btn-clear-filters.is-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.btn-clear-filters:hover { background-color: var(--color-1); }

/* Lista zawodów */
.events-content { flex: 3; min-width: 300px; }
.events-list-title { margin-top: 0; color: var(--base-1); display: flex; align-items: center; gap: 10px; }
.events-list { display: flex; flex-direction: column; gap: 0px; margin-top: 20px; }

/* =========================================
   9. KARTY WYDARZEŃ I KATEGORIE
   ========================================= */
.event-list-card { 
    background: var(--white); 
    border: 1px solid var(--color-4); 
    border-radius: 10px; 
    padding: 20px; 
    transition: transform 0.2s, box-shadow 0.2s; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 20px; 
    margin-bottom: 10px; 
}
.event-list-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-light); }
.event-list-card-left { flex: 1; min-width: 200px; }

.event-badges { display: flex; gap: 8px; margin-bottom: 8px; }
.badge-base { pointer-events: none; padding: 3px 8px; font-size: 12px; font-weight: bold; }
.badge-primary { background: var(--color-6); color: var(--color-11); }
.badge-secondary { background: var(--color-8); color: var(--white); }

.event-list-card-title { margin: 0 0 5px 0; color: var(--color-1); font-size: 20px; }
.event-list-card-meta { margin: 0; font-size: 14px; color: var(--color-10); font-weight: 600; }
.event-list-card-btn { margin: 0; width: auto; font-size: 15px; padding: 10px 20px; }

.category-row {
    margin-top: 8px;
    padding: 5px;
    background: var(--color-3);
    border-radius: 4px;
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-badge {
    font-size: 0.8rem;
    border-radius: 4px;
    display: inline-block;
    min-width: 80px;
    text-align: center;
}

.category-meta {
    font-size: 0.85rem;
    color: var(--color-10);
    margin-left: 10px;
}

.event-categories-sublist { margin-top: 10px; }
.event-list-card-action { margin-top: 15px; text-align: right; }

/* Kolory dla kategorii */
.cat-i { background-color: var(--color-2) !important; color: var(--white) !important; }
.cat-p { background-color: var(--color-8-1) !important; color: var(--white) !important; }
.cat-t { background-color: var(--color-7) !important; color: var(--white) !important; }
.cat-m { background-color: var(--color-6) !important; color: var(--white) !important; }
.cat-o { background-color: var(--color-10) !important; color: var(--white) !important; }

/* Wyróżniona Karta na Home */
.event-card-home { 
    background: var(--white); 
    border-radius: 12px; 
    padding: 20px; 
    width: 100%; 
    max-width: 800px; 
    box-shadow: var(--shadow-light); 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 20px; 
    margin: 0 auto; 
}

/* =========================================
   10. PRZEŁĄCZNIK ZAKŁADEK (TABS)
   ========================================= */
.events-type-toggle {
    display: inline-flex;
    background-color: var(--color-4);
    padding: 6px;
    border-radius: 50px;
    flex-wrap: wrap;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
    margin: 0;
}

.category-tabs-content-wrapper { margin-top: 0; }
.category-results-section { margin-top: 0; padding-top: 0.5vw; }

.toggle-btn {
    border: none;
    background: transparent;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-10);
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.toggle-btn:hover { color: var(--color-1); }
.toggle-btn.active { background-color: var(--white); color: var(--color-2); box-shadow: var(--shadow-light); }

/* =========================================
   11. PLAKIETKI I STATUSY (LIVE)
   ========================================= */
.badge-live {
    display: inline-flex;
    align-items: center;
    background-color: var(--color-9);
    color: var(--color-7);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    margin-right: 10px;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-7);
    border-radius: 50%;
    margin-right: 6px;
    /* Kolor RGB z --color-7 (#d65a47) to 214, 90, 71 */
    box-shadow: 0 0 0 0 rgba(214, 90, 71, 0.7);
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(214, 90, 71, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(214, 90, 71, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(214, 90, 71, 0); }
}

.event-card-live {
    border-left: 4px solid var(--color-7);
    background-color: var(--color-9); 
}

.scale-badge { background: var(--color-4); padding: 2px 6px; border-radius: 4px; font-size: 12px; margin-right: 10px; }

/* =========================================
   12. SZCZEGÓŁY WYDARZENIA
   ========================================= */
.event-header-box { margin-bottom: 0px; }
.event-header-box h1 { margin-top: 0px; }

.event-header-box .event-breadcrumbs {
    margin-bottom: 0px;
    display: flex;
    border-bottom: none;
    padding-bottom: 0;
}

.event-header-box .breadcrumb-back-link {
    color: var(--color-2);
    text-decoration: none;
    font-size: 18px;
    margin-left: 20px;
}

.category-tab-pane { display: none; /* Domyślny stan, przełączany w JS */ }

.category-meta-box {
    background: var(--color-3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    margin-top: 10px;
}

.category-meta-box p {
    margin: 0;
    font-size: 15px;
    color: var(--color-1);
}

.title-container-results {
    display: flex;
    justify-content: space-between; 
    align-items: center; 
    flex-wrap: wrap; 
    gap: 20px; 
    margin-bottom: 30px; 
    padding: 10px;
    border-radius: 12px;
}

.title-results { margin: 0; }

.results-title {
    padding: 8px 18px;
    background: var(--color-6-1);
    color: var(--color-11);
    border-radius: 15px;
    font-size: 22px;
    font-weight: bold; 
    width: fit-content;
    display: inline-flex;
    margin-bottom: 0;
}

.event-info-sub {
    margin: 0;
    font-size: 14px;
    color: #777;
    font-weight: 600;
    margin-bottom: 10px;
}

.category-title {
    text-align: left;
    border-left: 4px solid var(--color-2);
    padding-left: 15px;
    margin-bottom: 20px;
}

.section-divider {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--color-4), transparent);
    margin: 40px 0;
}

.team-name-cell { text-align: left !important; padding-left: 20px !important; }

.comment-cell {
    font-size: 12px;
    color: var(--color-10);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 12px;
}
.meta-item {
    white-space: nowrap; /* KLUCZOWE: trzyma emotkę i wynik razem */
}

/* =========================================
   13. NADPISANIE WTYCZEK I FORMULARZY
   ========================================= */
/* Choices.js nadpisanie stylów */
.choices__inner {
    border-radius: 8px !important;
    background-color: var(--white) !important;
    border: 1px solid var(--color-4) !important;
    min-height: 44px !important;
}

.choices__list--multiple .choices__item {
    background-color: var(--color-2) !important; 
    border: 1px solid var(--color-2) !important;
    border-radius: 6px !important;
}

.choices[data-type*="select-multiple"] .choices__button {
    border-left: 1px solid var(--white-opacity) !important;
}

.choices__list--dropdown .choices__item--selectable.is-highlighted {
    background-color: var(--color-4) !important;
}

.choices__input {
    background-color: var(--white) !important;
}

/* Dostosowanie wyglądu inputów daty */
.filter-input[type="date"] {
    width: 100% !important;
    min-height: 44px !important;
    padding: 7px 15px !important;
    border-radius: 8px !important;
    border: 1px solid var(--color-4) !important;
    background-color: var(--white) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    color: inherit !important; 
    box-sizing: border-box !important;
    transition: border-color 0.2s !important;
}

.filter-input[type="date"]:focus {
    outline: none !important;
    border-color: var(--color-2) !important; 
}

/* =========================================
   14. LISTA STARTOWA
   ========================================= */
.starting-list-section { margin-top: 40px; border-top: 2px solid #eee; padding-top: 20px; }

.list-header-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap; 
    margin-bottom: 15px;
    gap: 15px; 
}

.list-header-row::before {
    content: "";
    flex: 1 1 0%; 
}

.list-header-row .results-title2 {
    flex: 0 1 auto;
    margin: 0; 
    white-space: nowrap; 
}

.list-header-row .search-box {
    flex: 1 1 0%; 
    display: flex;
    justify-content: flex-end; 
    min-width: 220px; 
}

.list-header-row .search-box input {
    width: 100%;
    max-width: 300px;
}

.starting-list-section.is-collapsed .list-header-row::after {
    content: "";
    flex: 1 1 0%;
}

#teamSearchInput { width: 100%; padding: 8px 12px; border: 1px solid #ccc; border-radius: 20px; font-size: 14px; }

/* GŁÓWNA TABELA */
.compact-table { 
    /* Kluczowa zmiana: tabela dopasowuje się do treści, ale nie jest węższa niż 50% i nie szersza niż 100% kontenera */
    width: max-content; 
    min-width: min(100%, 600px); 
    max-width: 100%;
    margin: 20px auto; /* Wyśrodkowanie tabeli na stronie */
    
    background: #fff; 
    /* Zmiana na 'separate', aby border-radius na całej tabeli zadziałał prawidłowo */
    border-collapse: separate; 
    border-spacing: 0;
    
    border-radius: 10px; /* Zaokrąglone rogi dla estetyki */
    box-shadow: 0 4px 12px rgba(0,0,0,0.06); /* Nieco bardziej miękki i nowoczesny cień */
    overflow: hidden;
}

.compact-table th { 
    background: #f8f9fa; 
    padding: 12px 15px; /* Zwiększony padding dla lepszego "oddechu" */
    text-align: center; 
    font-size: 13px; 
    text-transform: uppercase; 
    border-bottom: 2px solid #dee2e6; 
    color: #555;
    letter-spacing: 0.5px;
}

.compact-table td { 
    padding: 12px 15px; 
    border-bottom: 1px solid #eee; 
    font-size: 14px; 
    vertical-align: middle; /* Centrowanie w pionie wygląda lepiej przy różnej długości tekstu */
}

/* Usuwamy obramowanie w ostatnim wierszu, by nie psuło zaokrąglonych rogów tabeli */
.compact-table tr:last-child td {
    border-bottom: none;
}

/* SZEROKOŚCI KOLUMN */
.col-num { 
    width: 60px; 
    text-align: center !important; 
    font-weight: bold; 
    color: #888; 
}

.col-name { 
    /* Usunięto sztywne 30%, dodano sensowne minimum */
    min-width: 180px; 
    color: #333; 
}

.col-members { 
    color: #666; 
    font-size: 13px; 
    line-height: 1.5; 
    min-width: 250px; /* Zapewnia miejsce na długie składy */
}

.team-row {
    transition: background-color 0.2s ease;
}

.team-row:hover { 
    background-color: #f4f7fb; /* Delikatniejszy, lekko niebieskawy odcień po najechaniu */
}

.no-data-info { 
    color: #999; 
    font-style: italic; 
    text-align: center; 
    padding: 20px; 
}

/* UX: Zwijana Lista Startowa */
.toggle-list-btn {
    background: transparent;
    border: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0;
    transition: opacity 0.2s ease;
}

.toggle-list-btn:hover { opacity: 0.8; }

.toggle-list-btn .chevron-icon {
    transition: transform 0.3s ease;
    transform: rotate(180deg);
}

.starting-list-section.is-collapsed .toggle-list-btn .chevron-icon {
    transform: rotate(0deg); 
}

.starting-list-section.is-collapsed .search-box,
.starting-list-section.is-collapsed #teamsGrid {
    display: none !important;
}

/* =========================================
   FIX: ZWIJANE FILTRY I UKŁAD LISTY (EVENTS-LIST)
   ========================================= */

/* KONTENER: Filtry + Lista */
.events-layout-wrapper {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
}

/* LISTA ZAWODÓW (Prawa strona) */
.events-content {
    flex: 1; 
    min-width: 0; /* Zabezpiecza przed wylewaniem się długich nazw tabel */
    width: 100%;
}

/* SIDEBAR Z FILTRAMI - DESKTOP */
.filters-sidebar {
    flex: 0 0 280px; /* Sztywne 280px, bez prawa do rozciągania */
    width: 280px; 
    box-sizing: border-box;
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--color-4);
    position: sticky; 
    top: 20px; 
}

/* Nagłówek sidebar'a */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--color-4);
    padding-bottom: 10px;
}

.sidebar-title { margin: 0; border: none; padding: 0; }
.mobile-filters-btn { display: none; } /* Przycisk strzałki ukryty na PC */
.filters-collapsible { display: flex; flex-direction: column; }


/* =========================================
   TABLETY I TELEFONY (PONIŻEJ 900px)
   ========================================= */
@media (max-width: 1200px) {
    .events-layout-wrapper {
        flex-direction: column; /* Filtry lądują nad listą */
        gap: 20px;
    }
    
    .filters-sidebar {
        flex: none;
        width: 100%; /* Zajmują całą szerokość ekranu */
        max-width: 100%;
        position: static; /* Wyłączamy przyklejanie przy scrollu */
        padding: 15px;
    }

    /* Przebudowa nagłówka na klikalny przycisk */
    .sidebar-header {
        margin-bottom: 0;
        border-bottom: none;
        padding-bottom: 0;
        cursor: pointer;
        user-select: none;
    }

    .mobile-filters-btn { 
        display: block; 
        background: none; 
        border: none; 
        color: var(--color-1);
        padding: 5px; 
        cursor: pointer;
    }
    
    .mobile-filters-btn svg {
        transition: transform 0.3s ease;
    }

    /* Animacja strzałki po otwarciu */
    .filters-sidebar.is-open .mobile-filters-btn svg {
        transform: rotate(180deg);
    }
    
    /* UKRYCIE FILTRÓW (Domyślnie zwinięte) */
    .filters-collapsible {
        display: none; 
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid var(--color-4);
        align-items: stretch; /* Wyrównuje na całą szerokość, zapobiega uciekaniu do prawej! */
    }

    /* POKAŻ FILTRY (gdy dodamy klasę is-open w JS) */
    .filters-sidebar.is-open .filters-collapsible {
        display: flex;
    }
    
    /* Zabezpieczenie przed uciekaniem dat do prawej na małych telefonach */
    .date-range-group {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
}

/* =========================================
   15. MEDIA QUERIES (GLOBALNE)
   ========================================= */
@media (max-width: 800px) {
    .events-layout-wrapper { flex-direction: column; }
    .filters-sidebar { flex: 1; width: 100%; }

    .events-main-container {
        width: 95%; /* Rozszerzenie z 80% - daje znacznie więcej miejsca */
        margin-top: 15px;
    }
}

/* WERSJA MOBILNA */
@media (max-width: 600px) {
    .compact-table { 
        width: 100%; /* Na telefonach wymuszamy 100% dla czytelności */
        min-width: 100%;
        border-radius: 8px; /* Opcjonalnie mniejsze zaokrąglenie na mobilkach */
    }
    .compact-table tr { 
        display: flex; 
        flex-wrap: wrap; 
        border-bottom: 1px solid #eee; 
    }

    .col-num { width: 15%; padding-bottom: 4px;}
    .col-name { width: 85%; padding-bottom: 4px; font-size: 15px;}
    .col-members { width: 100%; padding-left: 15%; padding-top: 0; }

    .list-header-row {
        flex-direction: column; /* Układa tytuł i wyszukiwarkę pionowo */
        justify-content: center;
        gap: 15px;
    }

    /* Ukrywamy niewidzialne bloki rozpychające, które psuły układ na mobile */
    .list-header-row::before,
    .starting-list-section.is-collapsed .list-header-row::after {
        display: none; 
    }

    .list-header-row .results-title2 {
        white-space: normal; /* Pozwala na łamanie bardzo długich tytułów */
        width: 100%;
        text-align: center;
    }

    /* Wyśrodkowanie samego przycisku z ikonką */
    .toggle-list-btn {
        width: 100%;
        justify-content: center;
    }

    .list-header-row .search-box {
        width: 100%;
        justify-content: center; /* Wyśrodkowanie paska wyszukiwania */
    }

    .list-header-row .search-box input {
        max-width: 100%; /* Pozwala wyszukiwarce zająć pełną szerokość ekranu telefonu */
    }

    .events-type-toggle {
        display: flex;
        flex-wrap: wrap; /* Pozwala przyciskom zejść niżej */
        border-radius: 12px; /* Zmieniamy zaokrąglenie z 50px (kształt pigułki wygląda źle w wielu rzędach) */
        padding: 5px;
        gap: 6px;
        justify-content: center;
    }

    .toggle-btn {
        flex: 1 1 auto; /* Przyciski rozszerzają się, by wypełnić lukę */
        padding: 10px 15px; /* Mniejszy, wygodniejszy padding */
        font-size: 13px; /* Mniejszy font */
        border-radius: 8px; /* Dopasowane do kontenera */
        text-align: center;
    }

    .meta-flex-container {
        justify-content: center; /* Centrowanie meta-tagów na telefonie */
    }
    
    .meta-sep {
        display: none; /* Ukrywamy " | ", zamiast tego flex dodaje ładne odstępy */
    }

    /* Zmniejszenie głównego tytułu wyników, żeby nie dominował ekranu */
    .results-title {
        font-size: 18px;
        padding: 8px 15px;
    }
}