:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --text: #1e293b;
    --muted: #64748b;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --danger: #ef4444;
    --success: #22c55e;
    --warn: #f59e0b;
    --border: #e2e8f0;
    --shadow: 0 2px 8px rgba(0,0,0,0.06);
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 1.25rem; }

.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.logo {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.nav a:hover { color: var(--primary); }

.user-badge {
    background: #e0e7ff;
    color: #3730a3;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.main { flex: 1; padding: 2rem 1.25rem; }

.footer {
    text-align: center;
    padding: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.25rem; margin-bottom: 0.75rem; }

.muted { color: var(--muted); margin-bottom: 1rem; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.2;
    background: var(--border);
    color: var(--text);
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn:hover { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.btn-outline { background: var(--card); border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: #f8fafc; border-color: #cbd5e1; }

.btn-outline-primary {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--primary-dark);
}

.btn-outline-primary:hover {
    background: #dbeafe;
    border-color: var(--primary);
    color: #1d4ed8;
}

.btn-outline-danger {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.btn-outline-danger:hover {
    background: #fee2e2;
    border-color: var(--danger);
    color: #991b1b;
}

.btn-outline-success {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.btn-outline-success:hover {
    background: #dcfce7;
    border-color: #22c55e;
    color: #166534;
}

.btn-small { padding: 0.35rem 0.65rem; font-size: 0.8rem; border-radius: 7px; }

/* Odkazy jako tlačítka — prohlížeč jinak přebíjí barvu textu */
a.btn,
a.btn:hover,
a.btn:focus,
a.btn:visited {
    text-decoration: none;
}

a.btn-primary,
a.btn-primary:hover,
a.btn-primary:focus,
a.btn-primary:visited {
    color: #fff;
    background-color: var(--primary);
}

a.btn-primary:hover {
    background-color: var(--primary-dark);
}

a.btn-danger,
a.btn-danger:hover,
a.btn-danger:focus,
a.btn-danger:visited {
    color: #fff;
    background-color: var(--danger);
}

a.btn-danger:hover {
    background-color: #dc2626;
}

a.btn-outline-primary,
a.btn-outline-primary:hover,
a.btn-outline-primary:focus,
a.btn-outline-primary:visited {
    color: var(--primary-dark);
}

a.btn-outline-danger,
a.btn-outline-danger:hover,
a.btn-outline-danger:focus,
a.btn-outline-danger:visited {
    color: #b91c1c;
}

a.btn-outline-success,
a.btn-outline-success:hover,
a.btn-outline-success:focus,
a.btn-outline-success:visited {
    color: #15803d;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }

.auth-box {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--card);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.auth-link { margin-top: 1rem; text-align: center; }
.auth-link a { color: var(--primary); font-weight: 700; }
.hint { font-size: 0.85rem; color: var(--muted); margin-top: 1rem; text-align: center; }

.form label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="datetime-local"],
.form input[type="file"],
.form select {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-narrow { max-width: 480px; }
.form-actions { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.card {
    background: var(--card);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.card h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.stats { display: flex; gap: 1rem; font-size: 0.9rem; color: var(--muted); margin-top: 0.5rem; }

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card);
    border-radius: 12px;
    margin-top: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.header-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.section {
    background: var(--card);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th, .table td {
    padding: 0.6rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th { color: var(--muted); font-size: 0.85rem; }
.row-active { background: #f0fdf4; }

.table th.actions-col,
.table td.actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.table .actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.table .actions .btn {
    flex-shrink: 0;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-admin { background: #ede9fe; color: #5b21b6; }

.vec-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.vec-card {
    border: 2px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    background: white;
}

.vec-borrowed .vec-photo,
.vec-borrowed .vec-photo-placeholder,
.vec-borrowed .vec-info {
    opacity: 0.55;
    filter: grayscale(0.55);
}

.vec-photo {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
}

.vec-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: #f1f5f9;
    height: 100px;
}

.vec-info {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}

.vec-actions {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem;
    border-top: 1px solid var(--border);
    background: #f8fafc;
}

.vec-actions .btn {
    flex: 1;
    min-width: 0;
}

.vec-picker { border: 2px solid var(--border); border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.vec-picker legend { font-weight: 700; padding: 0 0.5rem; }

.vec-grid-picker { margin-top: 0.75rem; }

.vec-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.vec-pick:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.vec-pick input { margin-bottom: 0.25rem; }

.vec-photo-small {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}

.vec-photo-small.vec-photo-placeholder {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
}

code { background: #f1f5f9; padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.9em; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.modal-dialog {
    position: relative;
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
}

.modal-dialog h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.modal-dialog .muted {
    margin-bottom: 0.75rem;
}

.modal-dialog p strong {
    color: var(--danger);
}

body.modal-open {
    overflow: hidden;
}

#trida-delete-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

@media (max-width: 600px) {
    .page-header { flex-direction: column; }
}
