/* 1. OGÓLNE I TŁO */
body {
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
    color: #f8fafc;
    text-align: center;
    font-family: 'Inter', -apple-system, sans-serif;
    margin: 0;
    padding-top: 50px;
    /* miejsce na topBar */
    min-height: 100vh;
}

/* Efekt Skeletonu */
.skeleton {
    background: #1e293b;
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
    height: 20px;
    width: 100%;
}

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

/* Ukrywanie właściwego contentu podczas ładowania */
.hidden {
    display: none !important;
}

/* Styl dla placeholderów w tabeli */
.skeleton-cell {
    height: 40px;
    margin: 5px 0;
}

/* 2. TOP BAR & RULES */
#topBar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: #020617;
    color: #94a3b8;
    font-size: 11px;
    text-align: center;
    padding: 8px 10px;
    z-index: 1000;
    border-bottom: 1px solid #1e293b;
}

#rulesBtn {
    position: fixed;
    top: 40px;
    /* obniżone pod topBar */
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #1e293b;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: 0.2s;
    z-index: 1000;
}

/* KONTENER DLA ZĘBATKI */
.settings-container {
    position: fixed;
    top: 40px; 
    right: 65px; /* Umieszczona obok rulesBtn (który ma right: 15px + szerokość 40px + odstęp) */
    z-index: 1000;
}

#settings-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #1e293b;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#settings-btn:hover {
    background: #334155;
    transform: rotate(45deg); /* Delikatny obrót zębatki przy najechaniu */
}

/* PANEL USTAWIEŃ */
.settings-panel {
    position: absolute;
    top: 50px;
    right: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 15px;
    width: 200px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: left;
    contain: content;
}

.settings-panel h4 {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-panel hr {
    border: 0;
    border-top: 1px solid #334155;
    margin: 10px 0;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #f8fafc;
    padding: 5px 0;
}

/* CUSTOM CHECKBOX (Stylizacja radio/checkbox) */
#cb-radio {
    appearance: none; /* Ukrywamy standardowy wygląd */
    width: 20px;
    height: 20px;
    background: #0f172a;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    transition: 0.2s;
}

#cb-radio:checked {
    background: #3b82f6;
}

#cb-radio:checked::after {
    content: "✔";
    position: absolute;
    color: white;
    font-size: 14px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* 3. WYSZUKIWARKA I LISTA */
#search {
    width: 90%;
    max-width: 400px;
    font-size: 16px;
    padding: 14px 20px;
    border-radius: 25px;
    border: 2px solid #334155;
    background: #1e293b;
    color: white;
    outline: none;
    transition: 0.3s;
    margin-top: 20px;
}

#search:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

ul {
    list-style: none;
    padding: 0;
    margin: 5px auto 0;
    background: #1e293b;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: left;
}

li {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #334155;
    transition: 0.2s;
}

li:hover {
    background: #334155;
}

/* 4. PRZYCISKI */
button:not(#rulesBtn, #cookie-banner button) {
    width: 90%;
    max-width: 300px;
    font-size: 15px;
    font-weight: bold;
    padding: 12px;
    margin-top: 15px;
    cursor: pointer;
    border-radius: 8px;
    border: none;
    background: #3b82f6;
    color: white;
    transition: 0.2s;
}

button:not(#rulesBtn, #cookie-banner button):hover {
    background: #2563eb;
    transform: translateY(-2px);
}

/* 5. GŁÓWNA TABELA - EFEKT KART */
.table-container {
    overflow-x: auto;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
}

#table {
    min-width: 700px;
    margin: 30px auto;
    border-collapse: separate;
    border-spacing: 0 8px;
    /* odstęp między wierszami */
}

#table th {
    padding: 12px;
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

#table td {
    padding: 14px 8px;
    background: #1e293b;
    border: none;
    font-weight: 500;
}

/* Zaokrąglanie wierszy */
#table td:first-child {
    border-radius: 8px 0 0 8px;
}

#table td:last-child {
    border-radius: 0 8px 8px 0;
}

/* 6. KOLORY STATUSÓW */
.green {
    background: #16a34a !important;
    color: white;
}

.red {
    background: #dc2626 !important;
    color: white;
}

.orange {
    background: #ca8a04 !important;
    color: white;
}

/* 7. MODAL - POPRAWIONY */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    justify-content: center;
    /* Zmieniamy na flex-start + padding, żeby przy długich treściach 
       zawsze dało się przewinąć od samej góry */
    align-items: flex-start; 
    padding: 20px;
    z-index: 2000;
    overflow-y: auto; /* Pozwala przewijać całe tło modala jeśli trzeba */
}

.modal-content {
    background: #1e293b;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    border: 1px solid #334155;
    position: relative;
    
    /* Ograniczamy wysokość modala i dodajemy wewnętrzny suwak */
    max-height: 85vh; /* Modal zajmie max 85% wysokości ekranu */
    overflow-y: auto; /* To doda upragniony suwak (scrollbar) */
    
    /* Estetyka suwaka dla przeglądarek Webkit (Chrome, Safari, Edge) */
    scrollbar-width: thin;
    scrollbar-color: #3b82f6 #1e293b;
}

/* Opcjonalnie: ładniejszy wygląd paska przewijania dla Chrome/Edge */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-thumb {
    background-color: #3b82f6;
    border-radius: 10px;
}

/* 8. MINI TABELA (WYNIK DO SHARE) */
#miniTable {
    width: auto;
    /* Tabela nie powinna zajmować 100% szerokości */
    margin: 20px auto;
    /* Środkowanie */
    border-collapse: separate;
    border-spacing: 3px;
    /* Przerwy między kafelkami */
}

#miniTable td {
    /* Absolutne uproszczenie kafelków */
    width: 15px !important;
    height: 15px !important;
    border: none !important;
    outline: none !important;
    transition: none !important;
}

/* Fix dla Wrapper-a */
.miniTableWrapper {
    display: flex;
    justify-content: center;
    /* Środkowanie wewnątrz modala */
    width: 100%;
}

/* 9. COOKIE BANNER (ZAAKTUALIZOWANY) */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #111;
    color: white;
    display: none;
    /* Sterowane przez JS, ale tutaj musi być flex po pokazaniu */
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    z-index: 999999;
    /* Bardzo wysoki priorytet */
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
    font-family: sans-serif;
}

#cookie-banner button {
    all: unset;
    background: #f8fafc;
    color: #0f172a;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
}

/* */
/* Standardowe kolory */
.green { background-color: #43a047; color: white; }
.red { background-color: #e53935; color: white; }

/* Tryb dla daltonistów - nadpisywanie kolorów */
/* Prawidłowy: Niebieski (#0077ff), Błędny: Pomarańczowy (#ff8800) */
body.colorblind-mode .green {
    background-color: #0077ff !important;
}

body.colorblind-mode .red {
    background-color: #ff8800 !important;
}

/* 10. ANIMACJA */
.animate-row {
    animation: slideFade 0.4s ease forwards;
}

@keyframes slideFade {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }

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

/* Specjalne ustawienia pod telefony */
@media (max-width: 600px) {
    #cookie-banner {
        flex-direction: column;
        /* Tekst nad przyciskiem */
        text-align: center;
        padding: 25px 15px;
    }

    #cookie-banner span {
        font-size: 13px;
        line-height: 1.4;
    }

    #cookie-banner button {
        width: 100%;
        /* Duży przycisk łatwy do kliknięcia kciukiem */
        max-width: 200px;
        padding: 12px;
    }
}