/* ===== Global theme tokens (used by all isolated components) ===== */
:root {
    color-scheme: dark;
    /* Core palette from your spec */
    --c-bg: #252735; /* canvas (outside cards)          */
    --c-chrome: #1C1C25; /* sidebar + topbar + cards         */
    --c-input: #282932; /* inputs, list header background   */
    --c-btn: #0077FE; /* primary buttons                  */
    /* Text & lines */
    --c-text: #E7E8ED; /* general text (labels etc)        */
    --c-row-fg: white; /* listview row text                */
    --c-row-bg: #1C1C25; /* listview body rows */
    --c-input-bg: #282932; /* inputs/selects background */
    --c-input-fg: #94959E; /* inputs/selects text/placeholder */
    --c-head-fg: white; /* list header text                 */
    --c-line: rgba(255,255,255,.08);
    /* Accents/utility */
    --c-muted: #A7A8B1;
    --c-btn-hover: #1A86FF;
    /* checkbox */
    --c-checkbox-border: #282932; /* outline color */
    --c-checkbox-bg: #282932; /* checked background */
    --c-checkbox-check: #d4d6d5;
}

/* Baseline so even unstyled bits read dark */
html, body {
    background: var(--c-bg);
    color: var(--c-text);
}

/* So Bootstrap-y things don’t fight the palette */
.form-control, .form-select, .card, .table {
    color: var(--c-text);
    border-color: var(--c-line);
}

/* ---------- Global input look (dark) ---------- */
.form-control,
.form-select,
textarea.form-control {
    background: var(--c-input-bg);
    color: var(--c-input-fg);
    border: 1px solid var(--c-line);
    border-radius: 10px;
}

    .form-control::placeholder {
        color: var(--c-input-fg);
        opacity: .82;
    }

    /* select dropdown text/background */
    .form-select option {
        color: var(--c-input-fg);
        background: var(--c-row-bg);
    }

    /* disabled still readable */
    .form-control:disabled,
    .form-select:disabled {
        background: #262733;
        color: #767783;
        opacity: 1;
    }


/* ===================== */
/* Sidebar menu (GLOBAL) */
/* ===================== */

.sidebar .menu, .sidebar .menu * {
    list-style: none;
}

.sidebar .menu {
    padding: 14px 10px 28px;
    color: var(--c-text);
}

/* small fallback so the column is never “blank” even if component CSS
   hasn’t loaded yet (actual background is set in MainLayout.razor.css) */
.sidebar {
    background-color: var(--c-chrome);
}

    .sidebar .menu .menu-section {
        color: var(--c-muted);
        font-size: .78rem;
        letter-spacing: .12em;
        text-transform: uppercase;
        padding: 8px 10px;
        margin: 8px 8px 4px;
    }

    .sidebar a {
        color: var(--c-text);
        text-decoration: none; /* kill default blue underline */
    }

        .sidebar a:hover {
            color: var(--c-text);
        }

    /* Main items */
    .sidebar .menu .item {
        display: flex;
        align-items: center;
        gap: .7rem;
        padding: 10px 12px;
        margin: 4px 8px;
        border-radius: 10px;
        background: transparent;
        border: 1px solid transparent;
        color: var(--c-text);
        cursor: pointer;
    }

        .sidebar .menu .item:hover {
            background: #0f1a2e;
            border-color: var(--c-line);
        }

        .sidebar .menu .item.active {
            background: #1a2743;
            border-color: var(--c-line);
        }

        .sidebar .menu .item .ic {
            width: 1.25rem;
            text-align: center;
            opacity: .9;
        }

        /* Toggle button that opens submenu */
        .sidebar .menu .item.btn-like {
            border: 1px solid var(--c-line);
        }

        .sidebar .menu .item .chev {
            margin-left: auto;
            opacity: .75;
        }

    /* Submenu */
    .sidebar .menu .submenu {
        display: none;
        padding-left: 6px;
    }

        .sidebar .menu .submenu.show {
            display: block;
        }

    .sidebar .menu .subitem {
        display: block;
        padding: 8px 16px;
        margin: 3px 14px;
        border-radius: 8px;
        border: 1px dashed transparent;
        color: var(--c-text);
        text-decoration: none;
    }

        .sidebar .menu .subitem:hover {
            background: #0f1a2e;
            border-color: var(--c-line);
        }

        .sidebar .menu .subitem.active {
            background: #1f2a40;
            border-color: var(--c-line);
        }

/* target both raw inputs and Bootstrap's .form-check-input */
input[type="checkbox"],
.form-check-input {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    border-radius: 6px; /* rounded square */
    background-color: var(--c-row-bg); /* match row bg / appear transparent */
    border: 2px solid var(--c-checkbox-border);
    box-shadow: none !important;
    display: inline-grid;
    place-content: center;
    transition: border-color .15s ease, background-color .15s ease;
}

    /* hover/focus polish */
    input[type="checkbox"]:hover,
    .form-check-input:hover {
        border-color: #343644;
    }

    input[type="checkbox"]:focus,
    .form-check-input:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(0,119,254,.15) !important; /* subtle focus ring */
    }

    /* checked state: solid bg + SVG tick */
    input[type="checkbox"]:checked,
    .form-check-input:checked {
        background-color: var(--c-checkbox-bg) !important;
        border-color: var(--c-checkbox-border) !important;
    }

        input[type="checkbox"]:checked::after,
        .form-check-input:checked::after {
            content: "";
            width: 12px;
            height: 12px;
            background-repeat: no-repeat;
            background-size: 100% 100%;
            /* inline SVG so we control the color exactly */
            background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'>\
<polyline points='3.5 9 6.5 12 12.5 5' fill='none' stroke='%23d4d6d5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/>\
</svg>");
        }

    /* disabled (optional) */
    input[type="checkbox"]:disabled,
    .form-check-input:disabled {
        opacity: .5;
        cursor: not-allowed;
    }

/* ====== LOGIN STATE HELPERS (sidebar hidden) ====== */
/* When we tag the shell with .no-sidebar (logged out), ensure workspace spans fully */

/* Base grid (when logged in) – if you already define this elsewhere, keep your values */
.shell {
    display: grid;
    grid-template-columns: 260px 1fr; /* sidebar + content */
}
    /* When logged out (no sidebar/topbar), use a single column */
    .shell.no-sidebar {
        grid-template-columns: 1fr !important;
    }
    /* Defensive: ensure workspace can shrink/stretch fully */
    .shell .workspace {
        min-width: 0;
    }
    /* We already hide sidebar with .no-sidebar; keep for certainty */
    .shell.no-sidebar .sidebar {
        display: none !important;
    }
    /* Optional: when topbar is not rendered, nothing to do here.
   The class .no-topbar is kept if you want to style differently */
    .shell.no-topbar .workspace {
        width: 100%;
        min-width: 0;
    }

    .shell.no-sidebar .workspace {
        width: 100%;
        min-width: 0;
    }

    /* ====== LOGIN STATE HELPERS (sidebar/topbar hidden) ====== */
    .shell.no-sidebar .sidebar {
        display: none !important;
    }

    .shell.no-sidebar .workspace {
        width: 100%;
        min-width: 0;
    }

/* safe, no visual shift */

/* Remove the transient focus ring the router applies to headings on navigation */
h1:focus, h2:focus, h3:focus {
    outline: none !important;
    box-shadow: none !important;
}
