/* ============================================================
   AUTH SYSTÉM – STYL
   ============================================================
   Umístění: libovolné (např. /css/auth-styl.css)
   Aktivace: v auth/config.php nastavit
       define('AUTH_CSS', '/css/auth-styl.css');

   Funguje bez jakýchkoliv změn v PHP souborech.
   Styluje čistě pomocí HTML elementů – žádné třídy nejsou
   potřeba.
   ============================================================ */


/* ------------------------------------------------------------
   GOOGLE FONTS
   Montserrat 300/500 – tři velikosti (viz níže)
   IBM Plex Serif 200  – jedna velikost pro veškerý text
   ------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;500&family=IBM+Plex+Serif:ital,wght@0,200;1,200&display=swap');


/* ------------------------------------------------------------
   TYPOGRAFICKÁ STUPNICE MONTSERRAT
   ============================================================
   Velikost A – 2.6rem  ... hlavní nadpis stránky (h1), jednou, weight 300
   Velikost B – 1.05rem ... nadpisy sekcí (h2, h3), weight 300
   Velikost C – 0.78rem ... nejmenší (th weight 500, button/label weight 300)
                            = shodná s IBM Plex Serif optickou velikostí
   IBM Plex Serif 200   ... 0.875rem pro veškerý ostatní text
   ------------------------------------------------------------ */


/* ------------------------------------------------------------
   PROMĚNNÉ
   ------------------------------------------------------------ */
:root {
    /* Pozadí */
    --bg-hlavni:      #141414;   /* tělo stránky = barva mezer mezi bloky */
    --bg-obsah:       #222222;   /* světlejší bloky obsahu */
    --bg-prvek:       #2a2a2a;   /* inputy, tabulky, textarea */
    --bg-prvek-focus: #313131;   /* input při focusu */

    /* Písmo */
    --text-hlavni:    #d0d0d0;
    --text-jemny:     #7a7a7a;
    --text-nadpis:    #eeeeee;

    /* Akcent – tmavě červená */
    --akcent:         #5c1010;   /* pozadí tlačítek, th */
    --akcent-hover:   #7a1515;   /* hover tlačítek */
    --akcent-svetly:  #c0392b;   /* text, h1, h3, odkazy */
    --akcent-okraj:   #4a0d0d;   /* okraje akcentových prvků */

    /* Ocelová šedá */
    --ocel:           #3a4455;   /* okraje inputů, tabulek */
    --ocel-svetly:    #6a7a90;   /* labely, h2, pomocný text */

    /* Stavy */
    --chyba-text:     #f08080;
    --uspech-text:    #68d391;

    /* Rozměry */
    --pruh-max:       620px;
    --sekce-mezera:   1.6rem;    /* výška tmavé mezery mezi bloky */
    --sekce-padding:  1.4rem;    /* vnitřní odsazení bloků */
    --polomer-blok:   6px;       /* zaoblení rohů bloků */
    --polomer-prvek:  4px;       /* zaoblení inputů, tlačítek */

    /* Stíny */
    --stin-blok:      0 2px 12px rgba(0, 0, 0, 0.45);
    --stin-input:     inset 0 1px 3px rgba(0, 0, 0, 0.3);
    --stin-input-focus: 0 0 0 2px rgba(192, 57, 43, 0.25);
}


/* ------------------------------------------------------------
   ZÁKLAD
   ------------------------------------------------------------ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-hlavni);
    color: var(--text-hlavni);
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-size: 0.875rem;         /* IBM Plex Serif – trochu větší než dřív */
    font-weight: 200;
    line-height: 1.75;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    animation: fadein 0.2s ease-in;
}


/* ------------------------------------------------------------
   OBSAHOVÝ PRUH
   ------------------------------------------------------------ */
body > * {
    width: 100%;
    max-width: var(--pruh-max);
}


/* ------------------------------------------------------------
   BLOKY OBSAHU – světlejší pozadí, zaoblení, stín
   ------------------------------------------------------------ */
body > h1,
body > h2,
body > h3,
body > p,
body > form,
body > table,
body > section,
body > ol,
body > ul,
body > textarea {
    background-color: var(--bg-obsah);
    padding-left: var(--sekce-padding);
    padding-right: var(--sekce-padding);
    padding-top: var(--sekce-padding);
    padding-bottom: var(--sekce-padding);
    border-radius: var(--polomer-blok);
    box-shadow: var(--stin-blok);
}

/* Tabulka – padding jen nahoře/dole, šířku řídí buňky */
body > table {
    padding-left: 0;
    padding-right: 0;
    overflow: hidden;            /* zaoblení se projeví i na th/td */
}

/* Mezery – každý blok dostane mezeru nahoře */
body > h1,
body > h2,
body > h3,
body > p,
body > form,
body > table,
body > section,
body > ol,
body > ul,
body > textarea {
    margin-top: var(--sekce-mezera);
}

/* hr = čistá tmavá mezera, žádná čára */
body > hr {
    border: none;
    background: transparent;
    height: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

/* h2 těsně za h1 – stejný blok, bez mezery nahoře */
body > h1 + h2 {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    padding-top: 0;
}

/* h1 když za ním následuje h2 – zaoblení jen nahoře, bez čáry dole */
body > h1:has(+ h2) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding-bottom: 0.3rem;
    box-shadow: var(--stin-blok);  /* stejný stín jako ostatní bloky, bez čáry */
}

/* h3 blok má o trochu světlejší pozadí než ostatní bloky */
body > h3 {
    background-color: #292929;
}
body > *:last-child {
    margin-bottom: var(--sekce-mezera);
}

/* Elementy uvnitř formuláře a sekcí – bez extra pozadí a stínu */
form > *,
section > * {
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
    margin-top: 0;
    padding-left: 0;
    padding-right: 0;
}


/* ------------------------------------------------------------
   TYPOGRAFIE – MONTSERRAT
   ------------------------------------------------------------ */

/* === VELIKOST A: hlavní nadpis stránky, jednou === */
h1 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 2.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--akcent-svetly);
    line-height: 1.15;
}

/* === VELIKOST B: nadpisy sekcí === */
h2,
h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 1.05rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

h2 {
    color: #9ab0c8;              /* světlejší modrošedá – čitelná na tmavém i světlém */
}

h3 {
    color: var(--akcent-svetly);
}

/* === VELIKOST C: th, button, label, indikátory ===
   (shodná s IBM Plex Serif = 0.78rem, aby text vypadal stejně velký) */

p {
    font-size: 0.875rem;         /* IBM Plex Serif velikost */
}

strong {
    color: var(--text-nadpis);
    font-weight: 300;
}

p > strong:first-child {
    color: var(--chyba-text);
}

em {
    color: var(--text-jemny);
    font-style: italic;
}


/* ------------------------------------------------------------
   ODKAZY
   ------------------------------------------------------------ */
a {
    color: var(--akcent-svetly);
    text-decoration: none;
    border-bottom: 1px solid var(--akcent-okraj);
    transition: color 0.15s, border-color 0.15s;
}

a:hover,
a:focus {
    color: #e74c3c;
    border-bottom-color: #e74c3c;
    outline: none;
}


/* ------------------------------------------------------------
   FORMULÁŘE
   ------------------------------------------------------------ */
form {
    width: 100%;
    max-width: var(--pruh-max);
}

form p {
    padding: 0;
    margin-bottom: 0.9rem;
    box-shadow: none;
    border-radius: 0;
    margin-top: 0;
}

/* === VELIKOST C: label === */
label {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ocel-svetly);
    margin-bottom: 0;
    padding-bottom: 0;
    line-height: 1;              /* pevná výška řádku – zabrání dědění 1.75 z body */
}

/* Inline label pro checkbox – jiný styl */
label:has(input[type="checkbox"]) {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 200;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: normal;
    color: var(--text-hlavni);
    cursor: pointer;
}


/* ------------------------------------------------------------
   INPUTY
   ------------------------------------------------------------ */
input[type="text"],
input[type="email"],
input[type="password"] {
    display: block;
    width: 100%;
    background-color: var(--bg-prvek);
    color: var(--text-hlavni);
    border: 1px solid var(--ocel);
    border-radius: var(--polomer-prvek);
    padding: 0.45rem 0.7rem;
    font-size: 0.875rem;
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 200;
    box-shadow: var(--stin-input);
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
    outline: none;
    margin-top: 0.15rem;         /* minimální optický odstup od labelu */
    margin-bottom: 0;
    line-height: 1.4;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    background-color: var(--bg-prvek-focus);
    border-color: var(--akcent-svetly);
    box-shadow: var(--stin-input), var(--stin-input-focus);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    color: var(--ocel-svetly);
    opacity: 0.6;
}

/* Inline inputy v tabulce admin.php */
table input[type="password"] {
    width: auto;
    display: inline-block;
    padding: 0.2rem 0.4rem;
    font-size: 0.78rem;
    margin-top: 0;
}

input[type="checkbox"] {
    width: 0.85rem;
    height: 0.85rem;
    accent-color: var(--akcent-svetly);
    cursor: pointer;
    flex-shrink: 0;
}


/* ------------------------------------------------------------
   TEXTAREA
   ------------------------------------------------------------ */
textarea {
    display: block;
    width: 100%;
    background-color: var(--bg-prvek);
    color: #98c898;              /* terminálová zelená pro SQL */
    border: 1px solid var(--ocel);
    border-radius: var(--polomer-prvek);
    padding: 0.75rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    line-height: 1.55;
    resize: vertical;
    outline: none;
    box-shadow: var(--stin-input);
}

textarea:focus {
    border-color: var(--akcent-svetly);
    box-shadow: var(--stin-input), var(--stin-input-focus);
}


/* ------------------------------------------------------------
   TLAČÍTKA – VELIKOST C (0.78rem Montserrat)
   ------------------------------------------------------------ */
button[type="submit"],
button[type="button"] {
    background-color: var(--akcent);
    color: #e8e8e8;
    border: 1px solid var(--akcent-okraj);
    border-radius: var(--polomer-prvek);
    padding: 0.48rem 1.1rem;
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
    margin-top: 0.3rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

button[type="submit"]:hover,
button[type="button"]:hover {
    background-color: var(--akcent-hover);
    border-color: var(--akcent-hover);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

button[type="submit"]:focus,
button[type="button"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.4);
}

button:disabled {
    background-color: #1c1c1c;
    color: var(--text-jemny);
    border-color: #2a2a2a;
    cursor: not-allowed;
    box-shadow: none;
}

button:disabled:hover {
    background-color: #1c1c1c;
    border-color: #2a2a2a;
    box-shadow: none;
}

/* Inline formuláře – odhlášení, smazání v tabulce */
form[style*="display:inline"],
form[style*="display: inline"] {
    display: inline;
    width: auto;
    margin: 0;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
    border-radius: 0;
}

form[style*="display:inline"] button,
form[style*="display: inline"] button {
    margin-top: 0;
    padding: 0.2rem 0;
    font-size: 0.78rem;
    min-width: 7rem;             /* stejná šířka pro Smazat i Změnit heslo */
    text-align: center;
}


/* ------------------------------------------------------------
   INDIKÁTOR SÍLY HESLA – VELIKOST C
   ------------------------------------------------------------ */
#heslo-sila,
#novy-heslo-sila {
    display: inline-block;
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--text-jemny);
    margin-top: 0.2rem;
}

#tlacitko-duvod,
#novy-tlacitko-duvod {
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--text-jemny);
    margin-left: 0.4rem;
}


/* ------------------------------------------------------------
   TABULKY
   ------------------------------------------------------------ */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

/* === VELIKOST C: záhlaví tabulky – weight 500 pro lepší čitelnost === */
table th {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background-color: var(--akcent);
    color: #e8e8e8;
    text-align: left;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--akcent-okraj);
}

table td {
    background-color: var(--bg-prvek);
    color: var(--text-hlavni);
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--ocel);
    vertical-align: middle;
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 200;
    font-size: 0.875rem;
}

table tr:nth-child(even) td {
    background-color: #262626;
}

table tr:hover td {
    background-color: #2d2d2d;
    transition: background-color 0.1s;
}

table td em {
    color: var(--text-jemny);
    font-style: italic;
}


/* ------------------------------------------------------------
   KÓDOVÉ ELEMENTY
   ------------------------------------------------------------ */
code {
    background-color: var(--bg-prvek);
    color: #98c898;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85em;
    padding: 0.1em 0.35em;
    border-radius: var(--polomer-prvek);
    border: 1px solid var(--ocel);
}


/* ------------------------------------------------------------
   SEZNAMY
   ------------------------------------------------------------ */
ol, ul {
    padding-left: 1.4rem;
    font-family: 'IBM Plex Serif', Georgia, serif;
    font-weight: 200;
    font-size: 0.875rem;
}

ol li, ul li {
    margin-bottom: 0.25rem;
    line-height: 1.65;
}


/* ------------------------------------------------------------
   RESPONSIVNÍ DESIGN
   ------------------------------------------------------------ */
@media (max-width: 680px) {
    :root {
        --pruh-max: 100%;
        --sekce-padding: 1rem;
        --sekce-mezera: 1rem;
        --polomer-blok: 0px;     /* na mobilu bez zaoblení – bloky jdou od kraje */
    }

    h1 {
        font-size: 1.6rem;
    }

    h2, h3 {
        font-size: 0.95rem;
    }

    table td form[style*="display:inline"],
    table td form[style*="display: inline"] {
        display: block;
        margin-bottom: 0.3rem;
    }

    table td form[style*="display:inline"] button,
    table td form[style*="display: inline"] button {
        width: 100%;
    }

    /* iOS: font-size ≥ 16px zabrání zoomu při focusu */
    input[type="text"],
    input[type="email"],
    input[type="password"] {
        font-size: 1rem;
    }

    table input[type="password"] {
        display: block;
        width: 100%;
        margin-bottom: 0.3rem;
        font-size: 1rem;
    }
}

@media (max-width: 400px) {
    h1 {
        font-size: 1.3rem;
        letter-spacing: 0.08em;
    }

    button[type="submit"],
    button[type="button"] {
        width: 100%;
    }
}


/* ------------------------------------------------------------
   PŘECHOD PŘI NAČTENÍ
   ------------------------------------------------------------ */
@keyframes fadein {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}