/* =========================================================
   USTAWIENIA OGÓLNE
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding-bottom: 34px;
    font-family: Arial, sans-serif;
    background: #f3f6fb;
    color: #1f2937;
}

h1,
h2,
h3 {
    margin-top: 0;
}

a {
    color: inherit;
}

.muted {
    color: #6b7280;
}

tr:target {
    background: #fff3cd;
    outline: 2px solid #facc15;
}

/* =========================================================
   NAWIGACJA
   ========================================================= */

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 32px;
    background: #0f172a;
    color: #fff;
}

.navbar .brand {
    font-size: 22px;
    font-weight: 700;
}

.top-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

.top-nav > a,
.top-nav .dropbtn,
.logout-form button {
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.top-nav > a:hover,
.top-nav .dropbtn:hover,
.logout-form button:hover {
    text-decoration: underline;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.dropbtn::-webkit-details-marker {
    display: none;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    overflow: hidden;
    z-index: 9999;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.dropdown[open] .dropdown-content {
    display: block;
}

.dropdown-right .dropdown-content {
    right: 0;
    left: auto;
}

.dropdown-content a {
    display: block;
    width: 100%;
    padding: 12px 16px;
    color: #111827 !important;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background: #f1f5f9;
    text-decoration: none;
}

.logout-form {
    display: inline-block;
    margin: 0;
}

.logout-form button {
    padding: 0;
    margin: 0;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

/* =========================================================
   UKŁAD STRONY
   ========================================================= */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.container.wide-container {
    max-width: none;
    margin: 30px 0;
}

.card,
.stat-box {
    width: 100%;
    padding: 24px;
    margin-bottom: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.stats-grid .card {
    text-align: center;
}

.stats-grid h2 {
    margin-bottom: 8px;
    font-size: 36px;
}

.stat-box .label {
    margin-bottom: 8px;
    color: #6b7280;
    font-size: 14px;
}

.stat-box .value {
    color: #111827;
    font-size: 30px;
    font-weight: 700;
}

.footer {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    width: 100%;
    padding: 4px 10px;
    background: rgba(243, 246, 251, 0.95);
    color: #222;
    font-size: 12px;
    text-align: center;
}

/* =========================================================
   PRZYCISKI
   ========================================================= */

.btn,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    margin: 0 6px 6px 0;
    border: 0;
    border-radius: 8px;
    box-sizing: border-box;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.btn {
    background: #2563eb;
}

.btn:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #475569;
}

.btn-secondary:hover {
    background: #334155;
}

.actions {
    margin-top: 20px;
}

/* =========================================================
   FORMULARZE I FILTRY
   ========================================================= */

.form-group {
    margin-bottom: 18px;
}

.form-group label,
.admin-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 700;
}




.form-control,
.admin-form select,
.admin-form input,
.admin-form textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 15px;
}




.admin-form input[type="checkbox"],
.admin-form input[type="radio"],
.form-control[type="checkbox"],
.form-control[type="radio"] {
    width: auto;
    min-height: 0;
    height: 18px;
    width: 18px;
    padding: 0;
    margin: 0 6px 0 0;
    vertical-align: middle;
    accent-color: #2563eb;
}



.admin-form label:has(input[type="checkbox"]),
.admin-form label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: 8px;
}



.form-control:focus,
.admin-form select:focus,
.admin-form input:focus,
.admin-form textarea:focus {
    outline: 2px solid rgba(37, 99, 235, 0.18);
    border-color: #2563eb;
}

textarea.form-control,
.admin-form textarea {
    min-height: 120px;
    resize: vertical;
}

.admin-form .form-group {
    margin-bottom: 18px;
}

/* Wspólny układ filtrów, np. data od, data do, liga */
.filters,
.filtry,
.filtry-meczow {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.filters .form-group,
.filtry .form-group,
.filtry-meczow .form-group {
    min-width: 180px;
    margin: 0;
}

.filters .filter-grow,
.filtry .filter-grow,
.filtry-meczow .liga-filter {
    flex: 1 1 260px;
}

.filters .filter-actions,
.filtry .przyciski,
.filtry-meczow .przyciski {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.filters .filter-actions .btn,
.filters .filter-actions .btn-secondary,
.filtry .przyciski .btn,
.filtry .przyciski .btn-secondary,
.filtry-meczow .przyciski .btn,
.filtry-meczow .przyciski .btn-secondary {
    margin: 0;
}

.sedziowie-lista {
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.sedziowie-lista label {
    display: block;
    margin-bottom: 6px;
}

/* =========================================================
   TABELE
   ========================================================= */

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
}

th {
    background: #f9fafb;
    color: #374151;
    font-size: 14px;
}

tr:hover {
    background: #f9fbff;
}

.mecze-card {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mecze-card table {
    width: 100%;
    min-width: 1050px;
}

.mecze-card .btn,
.mecze-card .btn-secondary,
.card table .btn,
.card table .btn-secondary {
    width: auto;
    display: inline-flex;
    white-space: nowrap;
}

/* =========================================================
   BADGE / STATUSY
   ========================================================= */

.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge-planowany {
    background: #fef3c7;
    color: #92400e;
}

.badge-potwierdzony {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-zagrany {
    background: #dcfce7;
    color: #166534;
}

.badge-odwolany {
    background: #fee2e2;
    color: #991b1b;
}

/* =========================================================
   ALERTY
   ========================================================= */

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-weight: 700;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* =========================================================
   PROFIL SĘDZIEGO
   ========================================================= */

.profil-sedziego {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
}

.profil-dane {
    flex: 1;
}

.sedzia-photo,
.sedzia-photo-empty {
    width: 180px;
    height: 220px;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.sedzia-photo {
    object-fit: cover;
    object-position: center;
}

.sedzia-photo-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

/* =========================================================
   AKTUALNOŚCI I GALERIA
   ========================================================= */

.news-link {
    color: #1f2937;
    text-decoration: none;
}

.news-link:hover {
    color: #2563eb;
}

.news-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
}

.news-content {
    flex: 1;
}

.news-content h3 {
    margin: 0 0 10px;
}

.news-content p {
    margin-bottom: 10px;
}

.news-image {
    width: 220px;
    flex-shrink: 0;
}

.news-image img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 10px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 25px;
}

.gallery-item {
    padding: 10px;
}

.gallery-item img {
    width: 100%;
    height: 450px;
    object-fit: contain;
    background: #f3f4f6;
    border-radius: 12px;
}

.gallery-admin {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 18px;
}

.gallery-admin-item {
    width: 240px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
}

.gallery-admin-item img {
    width: 100%;
    height: 180px;
    margin-bottom: 10px;
    object-fit: contain;
    background: #f3f4f6;
    border-radius: 8px;
}

/* =========================================================
   COOKIES
   ========================================================= */

.cookie-banner {
    position: fixed;
    right: 20px;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px;
    background: #111827;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.cookie-banner a {
    color: #93c5fd;
    text-decoration: underline;
}

.cookie-text {
    max-width: 900px;
    line-height: 1.5;
}

.cookie-actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

.cookie-actions .btn,
.cookie-actions .btn-secondary {
    margin: 0;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (min-width: 769px) and (max-width: 1100px) {
    .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card table {
        min-width: 950px;
    }

    .mecze-card table {
        min-width: 1050px;
    }
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* =========================================================
   TELEFON
   ========================================================= */

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 18px;
        padding: 18px;
    }

    .navbar .brand {
        font-size: 22px;
        line-height: 1.25;
    }

    .top-nav {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }

    .top-nav > a,
    .top-nav > details,
    .top-nav > form {
        flex: 1 1 calc(50% - 5px);
        min-width: 135px;
        margin: 0;
    }

    .top-nav > a,
    .top-nav .dropbtn,
    .logout-form button {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 8px;
        text-align: center;
        text-decoration: none;
    }

    .dropdown {
        display: block;
        width: auto;
    }

    .logout-form {
        display: block;
        width: auto;
    }

    .dropdown-content,
    .dropdown-right .dropdown-content {
        position: static;
        width: 100%;
        min-width: 0;
        margin-top: 6px;
        box-shadow: none;
    }

    .dropdown-content a {
        width: 100%;
        white-space: normal;
    }

    .container,
    .container.wide-container {
        margin: 18px 0;
        padding: 0 12px;
    }

    .card,
    .stat-box {
        padding: 14px;
    }

    .card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card table {
        min-width: 850px;
    }

    .mecze-card table {
        min-width: 1050px;
    }

    input,
    select,
    textarea {
        max-width: 100%;
    }

    .btn,
    .btn-secondary {
        width: 100%;
        max-width: 100%;
        margin: 0 0 8px;
    }

    .card table .btn,
    .card table .btn-secondary,
    .mecze-card .btn,
    .mecze-card .btn-secondary {
        width: auto;
        margin-right: 6px;
    }

    .filters,
    .filtry,
    .filtry-meczow {
        display: block;
    }

    .filters .form-group,
    .filtry .form-group,
    .filtry-meczow .form-group,
    .filters .filter-grow,
    .filtry .filter-grow,
    .filtry-meczow .liga-filter {
        width: 100%;
        min-width: 0;
        margin-bottom: 12px;
    }

    .filters .filter-actions,
    .filtry .przyciski,
    .filtry-meczow .przyciski {
        display: block;
        width: 100%;
    }

    .profil-sedziego,
    .news-item {
        flex-direction: column;
    }

    .news-image {
        width: 100%;
    }

    .news-image img {
        height: 220px;
    }

    .gallery {
        grid-template-columns: 1fr;
    }

    .gallery-item img {
        height: 300px;
    }

    .cookie-banner {
        right: 10px;
        bottom: 10px;
        left: 10px;
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-actions {
        flex-direction: column;
    }
}
