/* ============================================================
   Chytré nástroje – Blazor Server
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-w: 240px;
    --sidebar-collapsed: 60px;
    --radius: 10px;
    --shadow: 0 1px 4px rgba(0,0,0,0.1);
}

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

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

/* ── Layout ─────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    transition: margin-left .25s;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width .25s;
    z-index: 100;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed + .main-content {
    margin-left: var(--sidebar-collapsed);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-title {
    font-weight: 700;
    font-size: 15px;
    color: #f1f5f9;
    white-space: nowrap;
}

.toggle-btn {
    background: rgba(255,255,255,.1);
    border: none;
    color: #f1f5f9;
    border-radius: 6px;
    width: 32px; height: 32px;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}
.toggle-btn:hover { background: rgba(255,255,255,.2); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.user-avatar { font-size: 20px; }
.user-name { font-size: 13px; color: #94a3b8; white-space: nowrap; }

.nav-list {
    list-style: none;
    padding: 10px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    margin: 2px 8px;
    transition: background .15s;
    white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,.08); }
.nav-link.active { background: var(--sidebar-active); color: white; }
.nav-icon { font-size: 18px; flex-shrink: 0; }
.nav-label { font-size: 13.5px; font-weight: 500; }

.sidebar-footer {
    padding: 12px 8px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.logout-btn {
    width: 100%;
    background: rgba(220, 38, 38, .15);
    border: none;
    color: #fca5a5;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
}
.logout-btn:hover { background: rgba(220, 38, 38, .3); }

/* ── Pages ─────────────────────────────────── */
.page-content {
    padding: 28px 32px;
    max-width: 1200px;
}

.page-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.page-desc {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

/* ── Cards ─────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.card h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 14px;
}

/* ── Forms ─────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 14px;
    background: #f8fafc;
    color: var(--text);
    outline: none;
    transition: border-color .15s;
}
.form-control:focus { border-color: var(--primary); background: #fff; }

.form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 140px; }

/* ── Buttons ─────────────────────────────────── */
.btn-primary, .btn-secondary, .btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }

button:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon-danger {
    background: none; border: none; color: var(--danger);
    cursor: pointer; font-size: 14px; padding: 2px 6px;
}
.ml-2 { margin-left: 8px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 18px; }
.mb-2 { margin-bottom: 10px; }

/* ── Lists & Checklists ─────────────────────────────────── */
.checklist-box, .list-box {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #f8fafc;
}

.check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
}
.check-item:last-child { border-bottom: none; }
.check-item:hover { background: #e2e8f0; }

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #f0f4ff; }
.list-item.selected { background: #dbeafe; font-weight: 600; }

.radio-item { cursor: pointer; }

/* ── Alerts ─────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13.5px;
    margin-bottom: 14px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Progress ─────────────────────────────────── */
.progress-section {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}
.progress-bar-wrap {
    flex: 1;
    height: 10px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width .3s ease;
}

/* ── Logs ─────────────────────────────────── */
.log-scroll {
    max-height: 260px;
    overflow-y: auto;
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 12.5px;
    background: #0f172a;
    border-radius: 8px;
    padding: 12px;
}
.log-line {
    padding: 2px 0;
    color: #94a3b8;
}
.log-ok { color: #4ade80; }
.log-err { color: #f87171; }

/* ── Detail Card ─────────────────────────────────── */
.detail-card .detail-row {
    font-size: 13.5px;
    margin-bottom: 8px;
    color: var(--text);
}
.detail-card .detail-row strong { color: var(--text-muted); margin-right: 6px; }

/* ── Profile indicators ─────────────────────────────────── */
.profile-name { font-weight: 500; }
.profile-state { font-size: 12px; color: var(--text-muted); }

/* ── Actions row ─────────────────────────────────── */
.actions-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.count-badge {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 99px;
    border: 1px solid var(--border);
}

/* ── Toggle row ─────────────────────────────────── */
.toggle-row {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    width: fit-content;
}
.toggle-row button {
    border: none;
    padding: 8px 18px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    background: #f1f5f9;
    color: var(--text);
}
.toggle-row .btn-primary {
    background: var(--primary);
    color: white;
}

/* ── IP display ─────────────────────────────────── */
.ip-display {
    font-family: monospace;
    font-size: 13px;
    color: var(--primary);
    background: #dbeafe;
    padding: 5px 10px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 6px;
}

/* ── Info box ─────────────────────────────────── */
.info-box {
    font-size: 12.5px;
    font-family: monospace;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 10px 14px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.8;
}

/* ── File input ─────────────────────────────────── */
.file-input {
    display: block;
    font-size: 13px;
}
.file-badge {
    margin-top: 10px;
    background: #dbeafe;
    color: var(--primary);
    padding: 6px 12px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
}

/* ── Table ─────────────────────────────────── */
.table-wrap { overflow-x: auto; max-height: 300px; overflow-y: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: #f1f5f9;
    padding: 9px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    position: sticky; top: 0;
}
.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.row-ok { background: #f0fdf4; }
.row-err { background: #fef2f2; }

/* ── Spinner ─────────────────────────────────── */
.spinner-text { color: var(--text-muted); font-size: 13px; padding: 12px 0; }
.empty-hint { color: var(--text-muted); font-size: 13.5px; padding: 12px 0; }

/* ── Modal ─────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
}
.modal-box {
    background: white;
    border-radius: 12px;
    padding: 30px;
    min-width: 340px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-box h3 { font-size: 18px; margin-bottom: 14px; }
.warning-text { color: var(--danger); font-size: 13px; margin-top: 6px; }
.modal-actions { display: flex; gap: 12px; margin-top: 20px; }

/* ── Login ─────────────────────────────────── */
.login-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%);
}
.login-wrapper { width: 100%; padding: 20px; }
.login-box {
    background: white;
    border-radius: 16px;
    padding: 40px;
    max-width: 400px;
    margin: 0 auto;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
}
.login-header {
    text-align: center;
    margin-bottom: 28px;
}
.logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.login-header h1 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-header p { color: var(--text-muted); font-size: 14px; }

.btn-login {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
}
.btn-login:hover { background: var(--primary-hover); }

/* ── Blazor error ─────────────────────────────────── */
#blazor-error-ui {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 12px 16px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    color: #b91c1c;
    font-size: 13px;
    z-index: 999;
}
#blazor-error-ui.blazor-error-boundary { display: flex; gap: 12px; align-items: center; }

/* Online indicator */
.online { color: #16a34a; font-size: 12px; font-weight: 600; }
