/* assets/style.css */
:root {
    --primary: #27894A;
    --secondary: #D8C58C;
    --bg-dark: #1E1A16;
    --white: #FFFFFF;
    --text-dark: #27894A;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

body {
    background: url("../uploads/Tlo_3.png") no-repeat center center fixed,
                linear-gradient(135deg, var(--primary), var(--secondary));
    background-size: cover;
    background-attachment: fixed;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-dark);
    line-height: 1.4;
    min-height: 100vh;
}

/* Header & Navigation */
header {
    background-color: var(--primary);
    padding: 15px 30px;
    text-align: center;
    border-bottom: 2px solid var(--secondary);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header nav {
    flex-grow: 1;
}

header nav a {
    margin: 0 10px;
    text-decoration: none;
    color: var(--white);
    font-weight: bold;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

header nav a:hover {
    color: var(--secondary);
}

.img-right {
    width: 120px;
    height: auto;
}

/* Containers */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 25px;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow);
}

/* Forms */
h1, h2, h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

.form-section {
    border: 1px solid var(--primary);
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    background-color: var(--white);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: var(--primary);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--primary);
    border-radius: 4px;
    background-color: #f9f9f9;
}

/* Buttons */
button, .btn {
    background-color: var(--primary);
    color: var(--white);
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

button:hover, .btn:hover {
    background-color: var(--secondary);
    color: var(--primary);
}

/* Tables & Management (menage.php) */
.score-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.score-table td, .score-table th {
    border: 1px solid var(--secondary);
    padding: 10px;
    text-align: center;
}

.improved { background-color: rgba(39, 137, 74, 0.2); }
.worse { background-color: rgba(216, 197, 140, 0.4); }

.message {
    padding: 12px;
    background-color: var(--secondary);
    color: var(--primary);
    font-weight: bold;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* Charts */
canvas {
    max-width: 100%;
    margin: 0 auto;
}

select {
    appearance: none; /* Usuwa domyślną strzałkę przeglądarki */
    background-color: #ffffff;
    border: 2px solid var(--primary); /* Zielona ramka */
    border-radius: 8px;
    padding: 10px 40px 10px 15px; /* Większy margines z prawej na nową strzałkę */
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    
    /* Własna, ładna strzałka w kolorze zielonym (SVG) */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%2327894A%22%20d%3D%22M10.293%203.293L6%207.586%201.707%203.293A1%201%200%2000.293%204.707l5%205a1%201%200%20001.414%200l5-5a1%201%200%2010-1.414-1.414z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 12px;
    
    min-width: 220px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Efekt po najechaniu myszką */
select:hover {
    border-color: var(--secondary); /* Zmienia ramkę na złotą */
    background-color: #f9f9f9;
}

/* Efekt po kliknięciu (focus) */
select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(216, 197, 140, 0.3); /* Delikatna złota poświata */
}

/* Opcje wewnątrz listy */
select option {
    padding: 10px;
    background-color: #ffffff;
    color: #333;
}


/* --- RESPONSIVE DESIGN --- */

/* 1. Tablety i mniejsze laptopy (poniżej 1024px) */
@media (max-width: 1024px) {
    .container {
        width: 95%;
        padding: 15px;
    }
    
    /* Zmiana siatek z 3-4 kolumn na 2 */
    .top-grid, 
    .detail-grid, 
    .charts-row,
    .forms {
        grid-template-columns: 1fr 1fr !important;
    }

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

/* 2. Duże telefony i małe tablety (poniżej 768px) */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        padding: 10px;
    }

    header nav {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 10px;
    }

    header nav a {
        margin: 5px;
        font-size: 0.85rem;
        background: rgba(255,255,255,0.1);
        padding: 5px 10px;
        border-radius: 4px;
    }

    .img-right {
        width: 75px;
    }

    /* Wszystkie siatki przechodzą w jedną kolumnę */
    .top-grid, 
    .detail-grid, 
    .charts-row, 
    .charts-grid,
    .forms,
    .history-grid,
    div[style*="display: grid"],
    div[style*="display: flex"] {
        display: block !important;
    }

    .form-section {
        margin-bottom: 15px;
        padding: 15px;
    }

    /* Wyśrodkowanie zdjęcia zawodnika */
    .player-info, .form-section div[style*="text-align: center"] {
        text-align: center;
        margin-bottom: 15px;
    }

    .player-photo {
        width: 150px;
        height: 170px;
        margin: 0 auto;
    }

    /* Boisko - musi być elastyczne */
    .pitch-container {
        max-width: 100%;
        height: auto;
    }

    /* Tabele wyników - ułatwienie czytania na pionowym ekranie */
    .score-table input {
        width: 60px !important;
        padding: 5px;
    }

    .score-table td {
        padding: 5px;
        font-size: 0.9rem;
    }

    /* Wykresy - pełna szerokość */
    canvas {
        width: 100% !important;
        height: auto !important;
        max-height: 300px;
    }
}

/* 3. Małe telefony (poniżej 480px) */
@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.2rem; }

    header nav a {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* Ukrywamy ikony tooltipów na bardzo małych ekranach, żeby nie psuły tabel */
    .info-icon {
        display: none;
    }

    .btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }

    /* Dostosowanie kropek na boisku, żeby były łatwiejsze do kliknięcia palcem */
    .pos-dot {
        width: 20px;
        height: 20px;
        font-size: 7px;
    }
}

/* Poprawka dla tabel, aby nie wychodziły poza ekran */
.score-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

/* Stylizacja listy wyboru grup */
.group-scroll-box {
    max-height: 180px;           /* Stała wysokość z przewijaniem */
    overflow-y: auto;            /* Pasek przewijania tylko gdy potrzebny */
    border: 1px solid var(--primary); /* Zielona ramka */
    border-radius: 6px;
    background-color: #fff;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); /* Lekki cień wewnątrz */
}

/* Pojedynczy wiersz (grupa) */
.group-item {
    display: flex;               /* Układ elastyczny */
    align-items: center;         /* Wyrównanie w pionie */
    padding: 10px 15px;          /* Odstępy wewnątrz wiersza */
    border-bottom: 1px solid #eee; /* Linia oddzielająca */
    cursor: pointer;             /* Kursor rączki */
    transition: background 0.2s; /* Płynna zmiana koloru */
    margin: 0;                   /* Reset marginesów etykiety */
    color: #333;
}

/* Efekt po najechaniu na wiersz */
.group-item:hover {
    background-color: rgba(39, 137, 74, 0.1); /* Bardzo jasna zieleń */
}

/* Usuwamy linię pod ostatnim elementem */
.group-item:last-child {
    border-bottom: none;
}

/* Wygląd checkboxa */
.group-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;          /* Odstęp między kratką a tekstem */
    accent-color: var(--primary); /* Zielony kolor "ptaszka" */
    cursor: pointer;
    box-shadow: none;            /* Reset cienia z ogólnych stylów */
}

/* Stylizacja paska przewijania (dla nowoczesnych przeglądarek) */
.group-scroll-box::-webkit-scrollbar {
    width: 8px;
}
.group-scroll-box::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}
.group-scroll-box::-webkit-scrollbar-thumb {
    background: var(--secondary); /* Złoty suwak */
    border-radius: 4px;
}
.group-scroll-box::-webkit-scrollbar-thumb:hover {
    background: var(--primary);   /* Zielony po najechaniu */
}