:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-gray: #f8f9fa;
    --gray: #dee2e6;
    --dark-gray: #495057;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
body { font-family: var(--font-family); max-width: 1200px; margin: auto; padding: 20px; color: #333; background-color: #fdfdfd; }
input, select { padding: 9px; font-size: 14px; border-radius: 4px; border: 1px solid #ccc; box-sizing: border-box; margin: 0; width: 100%; }
button, .file-btn-label { padding: 10px 15px; margin: 5px; font-size: 14px; border-radius: 4px; cursor: pointer; color: white; border: none; transition: background-color 0.2s; text-align: center; }
button { background-color: #00995D; }
button:hover { background-color: #007A4A; }
.file-btn-label { background-color: #007bff; display: inline-block; }
.file-btn-label:hover { background-color: #0069d9; }
button.print-btn { background-color: #5a6268; }
button.print-btn:hover { background-color: #4a4f54; }
button.clear-btn { background-color: #dc3545; }
button.clear-btn:hover { background-color: #c82333; }
button.logout-btn { background-color: #6c757d; }
button.logout-btn:hover { background-color: #5a6268; }
button.enter-score-btn { background-color: #ff9800; }
button.enter-score-btn:hover { background-color: #fb8c00; }
button:disabled { background-color: #a0a0a0; cursor: not-allowed; }
.result { background: #f8f9fa; padding: 15px; margin-top: 25px; border-radius: 8px; border: 1px solid #dee2e6;}
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { border: 1px solid #ccc; padding: 8px; text-align: center; vertical-align: middle; }
th { background-color: #e9ecef; }
select.score-input { width: 60px; padding: 6px; }
h1, h2, h3 { text-align: center; color: #495057; }
.content-box { background-color: #fff; padding: 20px; border-radius: 8px; border: 1px solid #dee2e6; margin-bottom: 20px; }
.footer-buttons { margin-top: 15px; }
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#loginContainer { max-width: 400px; margin: 100px auto; padding: 30px; border: 1px solid #dee2e6; border-radius: 8px; background-color: #fff; text-align: center; }
#loginContainer input { margin-top: 10px; margin-bottom: 15px; }
#loginContainer button { width: 100%; }
#errorMessage { color: #dc3545; margin-top: 10px; display: none; }
#fileControls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; }
#loadFileBtn { display: none; }
#printHeader { display: none; }
.filter-controls { text-align: center; margin-bottom: 15px; }
.filter-controls label { margin: 0 5px; }
.filter-controls select { margin: 0 5px; width: auto; min-width: 120px;}
.search-input-container { margin-bottom: 15px; }
.competition-title-container { margin-bottom: 20px; text-align: center; }
.competition-title-container label { display: block; margin-bottom: 5px; font-weight: bold; }
.competition-title-container input { max-width: 500px; margin: 0 auto; }
.logo-container { margin-bottom: 20px; }
#loginContainer .logo-container img { max-width: 100%; height: auto; max-height: 200px; display: block; margin: 0 auto; }
#appContainer .logo-container { display: flex; justify-content: center; margin-top: 20px; margin-bottom: 30px; }
#appContainer .logo-container img { max-width: 200px; height: auto; display: block; }
#loadingSpinner { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(255, 255, 255, 0.7); justify-content: center; align-items: center; flex-direction: column; gap: 10px; z-index: 1000; font-weight: bold; color: #555; box-sizing: border-box; }
#loadingSpinner::before { content: ''; border: 5px solid #f3f3f3; border-top: 5px solid #3498db; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
#messageContainer { display: none; padding: 12px; margin: 0 auto; border-radius: 4px; text-align: center; font-weight: bold; position: fixed; top: 20px; left: 50%; transform: translateX(-50%); width: fit-content; max-width: 90%; box-shadow: 0 2px 10px rgba(0,0,0,0.1); z-index: 999; }
#messageContainer.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
#messageContainer.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
#messageContainer.info { background-color: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

@media (max-width: 768px) {
    body { padding: 10px; }
    h1 { font-size: 1.5em; }
    h2 { font-size: 1.2em; }
    button, .file-btn-label { width: calc(100% - 10px); }
    .filter-controls select { width: calc(50% - 10px); margin-bottom: 5px;}
    th, td { font-size: 0.8em; padding: 6px; }
    button { padding: 8px 10px; font-size: 12px; }
    #messageContainer { max-width: 95%; left: 5%; transform: translateX(0); }
}

@media print {
    body { padding: 0; margin: 0; }
    .no-print, .no-print * { display: none !important; }
    #appContainer { display: block !important; }
    #printableResults { display: block !important; box-shadow: none; border: none; margin: 0 20mm; }
    #printHeader { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; padding: 15px 20mm; border-bottom: 1px solid #ccc; top: 0; left: 0; right: 0; background-color: #fff; z-index: 999; box-sizing: border-box; width: 100%; }
    #printHeader .logo-container { display: block !important; margin: 0; flex-shrink: 0; }
    #printHeader .logo-container img { max-width: 150px; height: auto; }
    #printDate { font-size: 14px; text-align: right; padding-top: 5px; flex-grow: 1; }
    #printTitle { flex-grow: 1; text-align: center; font-size: 1.5em; font-weight: bold; margin: 0 10px; }
    h1, h2, h3 { margin-bottom: 20px; font-size: 1.2rem; }
    table { page-break-inside: auto; font-size: 0.9rem; }
    tr { page-break-inside: avoid; page-break-after: auto; }
    thead { display: table-header-group; }
    .result { border: none !important; box-shadow: none !important; padding: 0 !important; margin-bottom: 30px; }
}
/* Style dla przełącznika publikacji (NOWE WERSJA) */
.publish-control {
    display: flex;
    align-items: center;
    justify-content: center; /* Wyśrodkuj elementy */
    margin: 15px 0; /* Zmniejsz marginesy, aby zajmowało mniej miejsca */
    gap: 12px; /* Zmniejsz odstęp między elementami */
    padding: 10px 20px; /* Dodaj trochę paddingu */
    background-color: #f9f9f9; /* Lekkie tło */
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); /* Delikatny cień */
    flex-wrap: wrap; /* Pozwól elementom zawijać się na mniejszych ekranach */
}

.publish-control label {
    font-weight: bold;
    font-size: 1.1em; /* Nieco mniejsza czcionka */
    color: #333;
    margin: 0; /* Usuń domyślne marginesy label */
    flex-shrink: 0; /* Nie pozwól, aby label się kurczył */
}

#publishStatusText {
    font-weight: bold;
    font-size: 1.1em; /* Taka sama czcionka jak label */
    min-width: 90px; /* Upewnij się, że tekst ma wystarczająco miejsca i nie miga */
    text-align: left;
    transition: color 0.3s ease; /* Płynna zmiana koloru */
}

/* Podstawowy styl przełącznika */
.switch {
    position: relative;
    display: inline-block;
    width: 50px; /* Węższy */
    height: 28px; /* Niższy */
    flex-shrink: 0; /* Nie pozwól, aby przełącznik się kurczył */
}

/* Ukryj domyślny checkbox */
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

/* Styl "ścieżki" przełącznika */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px; /* Zaokrąglone rogi pasujące do wysokości */
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); /* Wklęsły efekt */
}

/* Styl "gałki" przełącznika */
.slider:before {
    position: absolute;
    content: "";
    height: 20px; /* Mniejsza gałka */
    width: 20px; /* Mniejsza gałka */
    left: 4px; /* Odsunięcie od lewej */
    bottom: 4px; /* Odsunięcie od dołu */
    background-color: white;
    transition: .4s;
    border-radius: 50%; /* Okrągła gałka */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Lekki cień gałki */
}

/* Zmiana koloru ścieżki po włączeniu */
input:checked + .slider {
    background-color: #28a745; /* Zielony dla opublikowanych */
}

/* Przesunięcie gałki po włączeniu */
input:checked + .slider:before {
    transform: translateX(22px); /* Przesunięcie o 22px (50px - 4px - 4px - 20px) */
}

/* Dodatkowe wizualne wskazówki dla stanu nieopublikowanego */
.publish-control.unpublished .switch input:not(:checked) + .slider {
    background-color: #dc3545; /* Czerwony dla ukrytych */
}

/* --- Style dla przycisku czyszczenia w polach wyszukiwania --- */
.search-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 20px;
    color: #999;
    display: none; /* Domyślnie ukryty */
    line-height: 1;
}

.clear-search-btn:hover {
    color: #333;
}