/* ==========================================================================
   CodeTrack – vzhled (Fáze 10a). Nadstavba nad Bootstrap 5.
   ========================================================================== */

:root {
    /* barvy */
    --bg:            #f6f7f9;
    --surface:       #ffffff;
    --surface-2:     #f1f3f6;
    --border:        #e6e8ee;
    --border-strong: #d7dae2;
    --text:          #1b2330;
    --text-muted:    #6a7482;
    --text-faint:    #98a1ad;

    --primary:       #5a5bd6;
    --primary-600:   #4b4cc4;
    --primary-050:   #eeeefc;
    --accent:        #e0457b;   /* běžící stopky / důraz */

    --green:  #2f9e5f;
    --amber:  #cf8a1c;
    --red:    #d84a44;

    /* geometrie */
    --radius:    10px;
    --radius-sm: 8px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 2px rgba(20,30,50,.06), 0 1px 3px rgba(20,30,50,.04);
    --shadow:    0 4px 12px rgba(20,30,50,.08), 0 1px 3px rgba(20,30,50,.05);

    --sidebar-w: 240px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body.ct-body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-600); }

/* ---------- app shell ---------- */

.ct-app {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.ct-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.ct-page-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(246,247,249,.85);
    backdrop-filter: saturate(1.4) blur(6px);
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.ct-page-head h1 {
    font-size: 20px;
    font-weight: 650;
    margin: 0;
    letter-spacing: -.01em;
}
.ct-page-head .ct-page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.ct-content { padding: 24px 28px 48px; flex: 1; }
.ct-content > .container,
.ct-content > .container-fluid { padding: 0; max-width: 1160px; }

/* ---------- sidebar ---------- */

.ct-sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.ct-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 14px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.02em;
}
.ct-brand .ct-logo {
    width: 26px; height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: grid; place-items: center;
    color: #fff; font-size: 14px; font-weight: 800;
}

.ct-ws-switch { padding: 0 12px 12px; }
.ct-ws-switch summary {
    list-style: none;
    cursor: pointer;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 8px;
}
.ct-ws-switch summary::-webkit-details-marker { display: none; }
.ct-ws-switch summary::after { content: "\F282"; font-family: "bootstrap-icons"; margin-left: auto; font-size: 12px; }
.ct-ws-switch[open] summary { border-color: var(--primary); color: var(--text); }
.ct-ws-switch .ct-ws-menu { padding: 4px 0 0; }
.ct-ws-switch button {
    width: 100%; text-align: left; background: none; border: 0;
    padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); cursor: pointer;
}
.ct-ws-switch button:hover { background: var(--surface-2); color: var(--text); }
.ct-ws-switch button.active { color: var(--primary); font-weight: 600; }

.ct-nav-group { padding: 10px 12px 2px; }
.ct-nav-group-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-faint);
    padding: 6px 12px;
}
.ct-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    position: relative;
}
.ct-nav-item .bi { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.ct-nav-item:hover { background: var(--surface-2); color: var(--text); }
.ct-nav-item.active {
    background: var(--primary-050);
    color: var(--primary-600);
    font-weight: 600;
}
.ct-nav-item.active::before {
    content: "";
    position: absolute; left: 0; top: 6px; bottom: 6px;
    width: 3px; border-radius: 3px; background: var(--primary);
}

.ct-sidebar-foot {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding: 10px 12px 14px;
}
.ct-user {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; border-radius: var(--radius-sm);
}
.ct-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary-050); color: var(--primary-600);
    display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.ct-user .ct-user-name { font-weight: 600; font-size: 13px; }
.ct-user .ct-user-role { font-size: 11px; color: var(--text-faint); }

/* mobilní přepínač sidebaru */
.ct-menu-toggle, #ctSidebarToggle { display: none; }
.ct-menu-btn {
    display: none;
    background: var(--surface); border: 1px solid var(--border);
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    align-items: center; justify-content: center; font-size: 18px; color: var(--text);
}

/* ---------- komponenty (nadstavba Bootstrapu) ---------- */

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; }

.btn { border-radius: var(--radius-sm); font-weight: 600; }
.btn-sm { border-radius: 7px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-600); border-color: var(--primary-600); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border-strong); }
.btn-outline-secondary:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-strong);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-050);
}
.form-label { font-weight: 600; color: var(--text-muted); font-size: 12px; }

.table { --bs-table-border-color: var(--border); }
.table > thead th {
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--text-faint); font-weight: 700; border-bottom: 1px solid var(--border);
}
.table > tbody td { border-color: var(--border); }

.list-group-item { border-color: var(--border); }
.list-group-item-action:hover { background: var(--surface-2); }

.alert { border-radius: var(--radius); border: 1px solid var(--border); }

.badge { font-weight: 600; border-radius: var(--radius-pill); }

.dropdown-menu { border-color: var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }

hr { border-color: var(--border); opacity: 1; }

.font-monospace { font-variant-numeric: tabular-nums; }

/* ---------- statistické dlaždice / graf (přehled, reporty) ---------- */

.ct-stat { border-radius: var(--radius); }
.ct-stat .card-body { padding: 16px 18px; }
.ct-stat .text-uppercase { letter-spacing: .05em; font-size: 11px; color: var(--text-faint); }

.ct-bar {
    margin-top: 6px; height: 6px;
    background: var(--surface-2); border-radius: 3px; overflow: hidden;
}
.ct-bar > span {
    display: block; height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .ct-app { grid-template-columns: 1fr; }
    .ct-sidebar {
        position: fixed; z-index: 60; width: min(84vw, 300px);
        transform: translateX(-100%); transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    #ctSidebarToggle:checked ~ .ct-app .ct-sidebar { transform: translateX(0); }
    #ctSidebarToggle:checked ~ .ct-backdrop { display: block; }
    .ct-backdrop {
        display: none; position: fixed; inset: 0; z-index: 55;
        background: rgba(15,20,30,.35);
    }
    .ct-menu-btn { display: inline-flex; }
    .ct-page-head { padding: 12px 16px; }
    .ct-content { padding: 16px; }
}
