/* =========================================
   1. ZÁKLADNÍ NASTAVENÍ A TYPOGRAFIE
   ========================================= */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background-color: #f4f6f9; 
    color: #333;
    margin: 0; 
    padding: 0; 
}

h2 { color: #2c3e50; border-bottom: 2px solid #e9ecef; padding-bottom: 10px; margin-bottom: 20px; }
h3 { color: #34495e; margin-top: 0; }

a { text-decoration: none; color: #007bff; transition: 0.2s; }
a:hover { text-decoration: underline; }

.container { 
    padding: 20px; 
    max-width: 1400px; 
    margin: 20px auto; 
    background: white; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    border-radius: 8px;
    min-height: 80vh; 
}

/* =========================================
   2. NAVIGACE (Hlavička)
   ========================================= */
.navbar { 
    background-color: #2c3e50 !important; 
    padding: 10px 20px; 
    color: white; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar a { 
    color: white !important; 
    padding: 8px 15px; 
    border-radius: 4px; 
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95em;
}

.navbar a:hover { background-color: #34495e; text-decoration: none; }

/* Tlačítka v navbaru */
.btn-admin { color: #ffc107 !important; border: 1px solid #ffc107; font-weight: bold; margin-left: 10px;}
.btn-admin:hover { background: #ffc107; color: white !important; }
.btn-logout { color: #ff6b6b !important; border: 1px solid #ff6b6b; font-weight: bold; margin-left: 10px; }
.btn-logout:hover { background: #ff6b6b; color: white !important; }

.admin-icon, .logout-icon { display: none; }

/* =========================================
   3. TABULKY, MATICE A ŘAZENÍ
   ========================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    background: white;
}

th, td { 
    border: 1px solid #dee2e6; 
    padding: 12px; 
    text-align: center; 
}

th { 
    background-color: #f8f9fa; 
    color: #475569;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
}

/* Řazení */
th.sortable { cursor: pointer; position: relative; padding-right: 25px; }
th.sortable:hover { background-color: #e9ecef; }
th.th-sort-asc::after { content: '^'; position: absolute; right: 8px; font-size: 0.7em; }
th.th-sort-desc::after { content: 'ˇ'; position: absolute; right: 8px; font-size: 0.7em; }

tbody tr:hover { background-color: #fcfcfc; }
.text-left { text-align: left; }

/* =========================================
   4. ODZNAKY (Badges) A STAVY
   ========================================= */
.badge { 
    display: inline-block;
    padding: 4px 10px; 
    border-radius: 4px; 
    font-size: 0.75em; 
    font-weight: bold; 
    text-transform: uppercase;
    white-space: nowrap;
}

.vpn-ASOLVPN  { background: #e3f2fd; color: #0d47a1; border: 1px solid #bbdefb; }
.vpn-FORTIVPN { background: #f1f8e9; color: #33691e; border: 1px solid #dcedc8; }
.vpn-MSVPN    { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.vpn-CISCOVPN { background: #fce7f3; color: #be185d; border: 1px solid #fbcfe8; }
.vpn-GLOBALVPN { background: #f3e8ff; color: #7e22ce; border: 1px solid #e9d5ff; }

/* Roletky stavu v index.php */
select.stav-zmena { 
    padding: 6px; 
    border-radius: 4px; 
    border: 1px solid #ccc; 
    width: 100%; 
    cursor: pointer; 
    font-weight: bold;
    font-size: 0.9em;
}

.stav-0 { background-color: #fff3cd !important; color: #856404 !important; border: 1px solid #ffeeba !important; }
.stav-1 { background-color: #d4edda !important; color: #155724 !important; border: 1px solid #c3e6cb !important; }
.stav-2 { background-color: #e2e3e5 !important; color: #383d41 !important; border: 1px solid #d6d8db !important; }

/* =========================================
   5. ADMINISTRACE A DIALOGY
   ========================================= */
.card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.form-row { margin-bottom: 15px; }
.form-row label { display: block; margin-bottom: 5px; font-weight: bold; font-size: 0.9em; color: #555; }

input[type="text"], input[type="password"], select, textarea {
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}

/* Styly pro Dialogy (vyskakovací okna pro mazání) */
dialog {
    border: none;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    padding: 25px;
    max-width: 400px;
}
dialog::backdrop { background: rgba(0,0,0,0.5); }

.btn-save { background: #28a745; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-save:hover { background: #218838; }
.btn-danger { background: #dc3545; color: white; padding: 10px 20px; border-radius: 4px; border: none; cursor: pointer; }

/* =========================================
   6. LOGIN BOX
   ========================================= */
.login-box { 
    background: white; padding: 40px; border-radius: 8px; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1); width: 100%; max-width: 380px; 
    margin: auto;
}

/* =========================================
   7. TOAST NOTIFIKACE
   ========================================= */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; }
.toast { 
    background: #333; color: white; padding: 12px 20px; border-radius: 4px; margin-top: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1); opacity: 0; transform: translateY(20px);
    transition: 0.3s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #28a745; border-left: 5px solid #1e7e34; }
.toast.error { background: #dc3545; border-left: 5px solid #a71d2a; }

/* =========================================
   8. MOBILNÍ RESPONSIVITA (Klíčové)
   ========================================= */
@media (max-width: 600px) {
    .navbar { padding: 10px; }
    
    /* Skrytí textů, zobrazení ikonek */
    .admin-text, .logout-text, .user-name-label { display: none; }
    .admin-icon, .logout-icon { display: inline; font-size: 1.2em; }
    
    .navbar a { padding: 8px 10px; margin-right: 2px; }
    
    .container { padding: 10px; margin: 10px auto; width: calc(100% - 20px); }
    
    th, td { padding: 8px 4px; font-size: 0.75em; }
    
    /* Na mobilu matici zmenšíme, aby se víc vešlo */
    select.stav-zmena { padding: 4px; font-size: 0.8em; }
}
/* --- FORMÁTOVÁNÍ ČASU V HISTORII --- */
.bunka-cas {
    font-size: 0.9em;
    color: #666;
    white-space: nowrap; /* Na PC zůstane v jedné lince */
    text-align: center;
}

.bunka-cas .cas {
    margin-left: 5px;
    color: #999;
}

/* RESPONZIVITA PRO MOBILY */
@media (max-width: 600px) {
    .bunka-cas {
        white-space: normal; /* Povolí zalomení */
        line-height: 1.2;
    }

    .bunka-cas .datum {
        display: block; /* Vynutí nový řádek 
        font-weight: bold; */
        color: #333;
        font-size: 0.70em;
    }

    .bunka-cas .cas {
        display: block; /* Vynutí nový řádek */
        margin-left: 0;
        font-size: 0.70em;
    }
}
