/* --- Import přátelského fontu z Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&display=swap');

/* --- Základní styly a reset --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: #f0f4f8;
    color: #333;
    padding: 20px;
}

/* --- Téma pozadí pro profil.php --- */
body.theme-bg {
    background: linear-gradient(to bottom, #a0d2eb, #e5eaf5);
    position: relative;
    overflow-x: hidden;
}

body.theme-bg::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23b3d9a0" fill-opacity="1" d="M0,224L48,208C96,192,192,160,288,165.3C384,171,480,213,576,240C672,267,768,277,864,256C960,235,1056,181,1152,160C1248,139,1344,149,1392,154.7L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom center;
    background-size: cover;
    z-index: 0;
}

/* --- Hlavní kontejner --- */
.container {
    max-width: 1200px; /* Zvětšeno pro lepší zobrazení admina na PC */
    margin: 0 auto;
    background-color: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    position: relative;
    z-index: 1;
}

h1 {
    color: #2c5282;
    margin-bottom: 20px;
    text-align: center;
}

/* Nadpisy uvnitř sekcí budou zarovnané vlevo, aby ladily s obsahem */
.sekce h2, .sekce h3 {
    color: #2c5282;
    margin-bottom: 20px;
    text-align: left;
}
hr { border: none; border-top: 1px solid #e0e7ee; margin: 30px 0; }

/* --- Styly pro zprávy (úspěch/chyba) --- */
.zprava { padding: 15px; border-radius: 8px; margin-bottom: 20px; text-align: center; }
.uspech { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.chyba { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* --- Obecné formuláře a tlačítka --- */
input, button, .button {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 1em;
    width: 100%;
}
button, .button {
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    text-align: center;
}
button:hover, .button:hover {
    background-color: #2980b9;
}
/* Sjednotíme styly pro všechna tlačítka, včetně těch pro smazání/deaktivaci */
.button-smazat {
    display: inline-block;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 1em;
    color: white;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    background-color: #e74c3c; /* Červená barva */
    transition: background-color 0.3s;
}

.button-smazat:hover {
    background-color: #c0392b; /* Tmavší červená po najetí */
}

/* --- Tabulka (Responzivní) --- */
.table-wrapper {
    overflow-x: auto; /* Povolí horizontální skrolování na mobilech */
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e7ee;
    vertical-align: middle;
}
th {
    background-color: #f0f4f8;
    color: #6a7f9a;
    font-weight: 700;
}
tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

/* =========================================== */
/* === STYLY PRO PROFIL.PHP (STRÁNKA DÍTĚTE) === */
/* =========================================== */

.header {
    text-align: center;
    border-bottom: 2px solid #e0e7ee;
    padding-bottom: 15px;
    position: relative;
}
.header h1 { font-size: 2.5em; font-weight: 900; }
.header p { color: #6a7f9a; font-size: 1.1em; }

.prehled {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 30px 0;
}
.stat-box {
    background-color: #ffffff;
    border: 2px solid #e0e7ee;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(44, 82, 130, 0.1);
}
.stat-box h2 { font-size: 1.2em; color: #6a7f9a; border: none; font-weight: 700; }
.points { font-size: 3.5em; font-weight: 900; color: #f6ad55; line-height: 1; }

.notifikace-ikona { position: absolute; top: 10px; right: 15px; font-size: 28px; cursor: pointer; color: #f6ad55; }
.pocet-notifikaci { position: absolute; top: -5px; right: -10px; background-color: #e53e3e; color: white; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; display: flex; justify-content: center; align-items: center; font-weight: bold; border: 2px solid white; }
.notifikace-seznam { position: absolute; top: 60px; right: 15px; width: 300px; background-color: #fff; border: 1px solid #ddd; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); z-index: 1000; }
.notifikace-seznam h4 { margin: 0; padding: 15px; border-bottom: 1px solid #eee; }
.notifikace-seznam ul { list-style: none; }
.notifikace-seznam li { padding: 15px; border-bottom: 1px solid #eee; }
.notifikace-seznam li:last-child { border-bottom: none; }
.notifikace-seznam p { padding: 15px; color: #888; }

@media (min-width: 600px) {
    .prehled { flex-direction: row; justify-content: space-around; }
    .header h1 { font-size: 3em; }
}


/* =========================================== */
/* === STYLY PRO ADMIN.PHP (ADMINISTRACE) ==== */
/* =========================================== */

.sekce {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #fdfdff;
    border-radius: 12px;
    border: 1px solid #e0e7ee;
}

.form-grid { display: grid; grid-template-columns: 1fr auto; gap: 15px; align-items: center; }
.form-grid-dite { display: grid; gap: 15px; }
.form-grid-odmena { display: grid; gap: 15px; }

.skener-wrapper { display: flex; gap: 10px; }
.skener-wrapper input { flex-grow: 1; }
#qr-reader video { width: 100% !important; height: auto !important; border-radius: 8px; border: 2px solid #ccc; }
.seznam-kodu { display: flex; flex-wrap: wrap; gap: 5px 10px; background-color: #eef2f7; padding: 10px; border-radius: 8px; margin-top: 15px; }
.seznam-kodu span { background-color: #fff; padding: 2px 6px; border-radius: 4px; font-family: monospace; border: 1px solid #d1dce8; }

/* Responzivní layout pro administraci */
.admin-wrapper {
    display: grid;
    grid-template-columns: 1fr; /* Na mobilech vše pod sebou */
    gap: 30px;
}
@media (min-width: 992px) {
    .admin-wrapper {
        grid-template-columns: 1fr 1fr; /* Dva sloupce na PC */
    }
    /* Definujeme, které sekce se roztáhnou přes celou šířku */
    .sekce-full-width {
        grid-column: 1 / -1;
    }
}
@media (min-width: 768px) {
    .form-grid-dite { grid-template-columns: 1fr 1fr; }
    .form-grid-dite .skener-wrapper, .form-grid-dite button[type="submit"] { grid-column: 1 / -1; }
    .form-grid-odmena { grid-template-columns: 1fr 1fr 1fr auto; align-items: center; }
}

/* --- Responzivní tlačítka v tabulce administrace --- */
.td-akce {
    display: flex;
    flex-wrap: wrap; /* Povolí zalamování prvků */
    gap: 5px;        /* Vytvoří mezeru mezi tlačítky */
    align-items: center;
}

.td-akce .button {
    flex-grow: 1; /* Tlačítka se pokusí rovnoměrně roztáhnout */
    flex-basis: 120px; /* Minimální šířka, než se tlačítko zalomí */
}


/* --- Vylepšení responzivity pro mobilní telefony --- */
@media (max-width: 600px) {
    body {
        /* Zmenšíme vnější okraj na mobilu, aby nebyl tak velký */
        padding: 10px;
    }

    .container {
        /* Zmenšíme vnitřní okraj v hlavním boxu */
        padding: 15px 20px;
    }
}

/* --- Oprava přetékání dlouhých QR kódů na mobilu --- */
.seznam-kodu span {
    overflow-wrap: break-word;
    word-break: break-all;
}

/* --- Styly pro Progress Bary (Účast/Chování) --- */
.progress-bar-container {
    width: 100%;
    background-color: #e0e7ee; /* Světle šedé pozadí pro prázdnou část baru */
    border-radius: 10px;
    height: 25px; /* Výška baru */
    margin-top: 10px;
    position: relative;
    overflow: hidden; /* Důležité pro zaoblení vnitřního baru */
}

.progress-bar {
    height: 100%;
    width: 0%; /* Výchozí šířka, bude nastavena JS */
    border-radius: 10px;
    background-color: #f6ad55; /* Výchozí barva (oranžová/žlutá), bude přepsána JS */
    transition: width 0.5s ease-in-out, background-color 0.5s ease-in-out; /* Plynulá animace */
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #333; /* Barva textu přes bar */
    font-weight: 700;
    font-size: 0.9em;
    text-shadow: 0 0 3px rgba(255,255,255,0.7); /* Aby byl text lépe čitelný */
    white-space: nowrap; /* Zabrání zalomení textu */
}

/* Úprava pro stat-box, aby text a bar byly vycentrované */
.stat-box h2 {
    text-align: center;
}

/* --- Styly pro systém zpráv --- */
.chat-wrapper {
    display: flex;
    border: 1px solid #e0e7ee;
    border-radius: 12px;
    overflow: hidden;
    min-height: 60vh;
}
.chat-sidebar {
    width: 250px;
    border-right: 1px solid #e0e7ee;
    background-color: #f9fafb;
}
.chat-sidebar h3 {
    padding: 15px;
    margin: 0;
    background-color: #f0f4f8;
    border-bottom: 1px solid #e0e7ee;
}
.chat-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.chat-sidebar li a {
    display: block;
    padding: 15px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #e0e7ee;
    position: relative;
}
.chat-sidebar li.active a, .chat-sidebar li a:hover {
    background-color: #e5eaf5;
}
.neprecteno-badge {
    background-color: #e74c3c;
    color: white;
    font-size: 0.8em;
    padding: 2px 7px;
    border-radius: 10px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}
.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.chat-box {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #fdfdff;
}
.zprava-bublina {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    clear: both;
}
.zprava-bublina p { margin: 0; }
.cas-zpravy {
    font-size: 0.75em;
    color: #666;
    display: block;
    margin-top: 5px;
    text-align: right;
}
.zprava-bublina.odeslana {
    background-color: #3498db;
    color: white;
    float: right;
    border-bottom-right-radius: 4px;
}
.zprava-bublina.odeslana .cas-zpravy { color: #f1f1f1; }
.zprava-bublina.prijata {
    background-color: #e0e7ee;
    color: #333;
    float: left;
    border-bottom-left-radius: 4px;
}
.chat-form {
    display: flex;
    border-top: 1px solid #e0e7ee;
    padding: 10px;
}
.chat-form textarea {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px;
    resize: none;
    height: 50px;
    font-family: 'Nunito', sans-serif;
}
.chat-form button {
    margin-left: 10px;
    width: auto;
}

/* --- Styly pro Nástěnku --- */
.form-grid-nastenka {
    display: grid;
    gap: 15px;
}
.form-grid-nastenka textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 1em;
}
.nastenka-admin-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.nastenka-admin-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    background-color: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e0e7ee;
}
.nastenka-admin-item p {
    margin-top: 5px;
    font-size: 0.9em;
}
.nastenka-admin-item form {
    flex-shrink: 0;
    margin-left: 15px;
}

.nastenka-wrapper {
    display: grid;
    gap: 20px;
}
.nastenka-prispevek {
    background-color: #fff;
    border: 1px solid #e0e7ee;
    border-left: 5px solid #3498db;
    padding: 15px 20px;
    border-radius: 8px;
}
.nastenka-prispevek h4 {
    color: #2c5282;
    margin-bottom: 5px;
}
.nastenka-prispevek small {
    color: #6a7f9a;
    font-size: 0.8em;
    margin-bottom: 10px;
    display: block;
}

/* --- Styly pro systém záložek v profilu --- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e0e7ee;
    margin-bottom: 20px;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1em;
    font-family: 'Nunito', sans-serif;
    color: #6a7f9a;
    font-weight: 700;
    position: relative;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px; /* Posune tlačítko, aby jeho spodní okraj překryl okraj kontejneru */
}

.tab-link.active {
    color: #2c5282;
    border-bottom-color: #3498db;
}

.tab-content {
    display: none; /* Ve výchozím stavu jsou všechny obsahy skryté */
}

.tab-content.active {
    display: block; /* Zobrazí se jen obsah s třídou .active */
}

/* Notifikační tečka na záložce */
.notifikace-tecka {
    display: inline-block;
    width: 10px;
    height: 10px;
    background-color: #e74c3c;
    border-radius: 50%;
    margin-left: 5px;
    animation: puls 1.5s infinite;
}

/* Animace pulzování pro tečku */
@keyframes puls {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(231, 76, 60, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

/* --- Úprava stylů pro záložky s ikonami --- */

/* Třída pro skrytí textu (kvůli přístupnosti) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.tab-nav {
    justify-content: space-around; /* Rovnoměrně rozmístí ikony */
}

.tab-link {
    font-size: 1.5em; /* Zvětší ikony */
    padding: 12px 15px;
    flex-grow: 1; /* Každá záložka zabere stejný prostor */
    text-align: center;
}

/* Úprava pozice notifikační tečky pro ikony */
.tab-link .notifikace-tecka {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
}

/* --- Odznáček pro notifikace na tlačítkách --- */
.notifikace-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    border: 2px solid white;
}

/* --- Styly pro odznaky --- */
.odznak-nahled {
    width: 40px;
    height: 40px;
    vertical-align: middle;
}
.form-grid-odznak {
    display: grid;
    gap: 15px;
}
@media (min-width: 768px) {
    .form-grid-odznak { grid-template-columns: 1fr 1fr 1fr auto; align-items: center; }
}

.odznaky-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 20px;
    padding-top: 20px;
}
.odznak {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.odznak img {
    width: 80px;
    height: 80px;
    margin-bottom: 10px;
    transition: transform 0.3s ease;
}
.odznak:hover img {
    transform: scale(1.1);
}
.odznak span {
    font-size: 0.9em;
    font-weight: 700;
    color: #333;
}

/* --- Styly pro Lightbox (zvětšení odznaku) --- */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}
.lightbox-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    position: relative;
    max-width: 90%;
    max-height: 90%;
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}
.lightbox-close {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #888;
    cursor: pointer;
}
.lightbox-close:hover {
    color: #333;
}
#lightbox-obrazek {
    max-width: 150px;
    max-height: 150px;
    margin-bottom: 15px;
}
#lightbox-nazev {
    margin: 0 0 10px;
    text-align: center;
}
#lightbox-popis {
    margin: 0;
    color: #666;
}
.odznak-obrazek {
    cursor: pointer;
}

/* --- Styly pro záložku Odměny --- */
.odmeny-wrapper h2 {
    text-align: left;
    border-bottom: 2px solid #e0e7ee;
    padding-bottom: 10px;
}

.odmena-item {
    padding: 15px 0;
    border-bottom: 1px solid #f0f4f8;
}

.odmena-item:last-child {
    border-bottom: none;
}

.odmena-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.odmena-info h4 {
    margin: 0;
    color: #2c5282;
    flex-grow: 1;
}

.odmena-info p {
    margin: 0;
    color: #6a7f9a;
    font-size: 0.9em;
}

.odmena-info small {
    font-weight: 700;
    color: #333;
    background-color: #eef2f7;
    padding: 3px 8px;
    border-radius: 5px;
}

/* Styl pro odměny s limitem */
.odmena-limit-badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 50%;
    background-color: #3498db;
    color: white;
    font-size: 0.8em;
    font-weight: bold;
    margin-left: 5px;
    vertical-align: top;
    line-height: 1;
}

/* Úprava pro odměny v profilu */
.odmeny-wrapper .odmena-item {
    padding: 15px;
    background-color: #f7f7f7;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    margin-bottom: 20px;
}

.odmeny-wrapper .odmena-item:hover {
    transform: translateY(-5px);
}

/* Styl pro zvýraznění řádku s dítětem, které se blíží k odměně */
.radka-zvyraznena {
    background-color: #fffbe6 !important; /* Světle žlutá */
    border-left: 5px solid #f6ad55; /* Zlatý okraj */
}

/* Úprava pro formulář na přidávání odměn */
.form-grid-odmena {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: center;
}

.form-grid-odmena input[type="text"],
.form-grid-odmena input[type="number"],
.form-grid-odmena select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.form-grid-odmena label {
    grid-column: 1 / 2;
    text-align: right;
    font-weight: bold;
}

.form-grid-odmena label[for="typ_limitu"] {
    grid-column: 1 / 2;
    text-align: right;
}

.form-grid-odmena #pocet_limitu_div {
    grid-column: 2 / 3;
}

.form-grid-odmena button {
    grid-column: 1 / -1;
    padding: 10px 20px;
}

/* Styl pro náhled odznaků */
.odznak-nahled {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* Základní styl pro formulářové skupiny */
.form-skupina {
    margin-bottom: 20px;
}

/* Styly pro inputy a selecty */
.form-skupina input[type="text"],
.form-skupina input[type="number"],
.form-skupina select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1em;
    box-sizing: border-box; /* Zahrne padding do šířky */
    transition: border-color 0.3s;
}

.form-skupina input:focus,
.form-skupina select:focus {
    border-color: #007bff;
    outline: none;
}

/* Styl pro checkbox a label */
.form-skupina-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.form-skupina-checkbox input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
}

.form-skupina-checkbox label {
    font-weight: normal;
    font-size: 1em;
}

/* Styl pro tlačítko */
button[name="pridat_odmenu"] {
    width: 100%;
    padding: 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s;
}

button[name="pridat_odmenu"]:hover {
    background-color: #218838;
}

/* Upravený styl pro formulář Odměn */
.form-grid-odmena {
    display: grid;
    grid-template-columns: 1fr 2fr; /* Upravené sloupce pro lepší zarovnání */
    gap: 15px;
    align-items: center;
}

.form-grid-odmena .checkbox-container {
    grid-column: 1 / -1; /* Roztáhne na celou šířku */
}

.form-grid-odmena label {
    text-align: right;
    font-weight: bold;
}

.form-grid-odmena input[type="text"],
.form-grid-odmena input[type="number"],
.form-grid-odmena select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.form-grid-odmena button {
    grid-column: 1 / -1; /* Tlačítko se roztáhne přes celou šířku */
    padding: 10px 20px;
    margin-top: 10px;
}

/* Styl pro náhled odznaků */
.odznak-nahled {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

/* Styl pro zvýraznění řádku */
.radka-zvyraznena {
    background-color: #fffbe6 !important; /* Světle žlutá */
    border-left: 5px solid #f6ad55; /* Zlatý okraj */
}