

/* =========================================================
   SG Theme – single source of truth for colours, type and
   reusable components. Link once, use on every page.
   Change --sg-brand here and the whole app follows.
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Rubik:wght@400;500;600;700&display=swap');

:root {
    /* Brand */
    --sg-brand: #E11B00;
    --sg-brand-rgb: 225, 27, 0;
    --sg-brand-dark: #B91600;
    --sg-brand-light: #FF4A33;

    /* Surfaces (darkest → lightest) */
    --sg-bg: #0B0909;
    --sg-panel: #130E0E;
    --sg-surface: #1B1515;
    --sg-surface-2: #251D1D;

    /* Lines & text */
    --sg-line: #342B2B;
    --sg-line-hover: #4A3E3E;
    --sg-text: #F4EFEF;
    --sg-muted: #AFA4A4;
    --sg-placeholder: #6E6262;

    /* Status */
    --sg-danger-text: #FF7A66;
    --sg-success: #2FBF71;
    --sg-warning: #F5A524;

    /* Shape & type */
    --sg-radius: 14px;
    --sg-radius-sm: 10px;
    --sg-font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --sg-ring: 0 0 0 4px rgba(var(--sg-brand-rgb), .22);

    color-scheme: dark;
}

/* ---------- Base ---------- */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--sg-bg);
    color: var(--sg-text);
    font-family: var(--sg-font);
}

a { color: var(--sg-brand-light); }
a:hover { color: #fff; }

::selection { background: rgba(var(--sg-brand-rgb), .45); color: #fff; }

:focus-visible { outline: 2px solid var(--sg-brand); outline-offset: 3px; }

/* ---------- Bootstrap 5 mapping (so existing pages follow the theme) ---------- */
:root {
    --bs-primary: var(--sg-brand);
    --bs-primary-rgb: var(--sg-brand-rgb);
    --bs-body-bg: var(--sg-bg);
    --bs-body-color: var(--sg-text);
    --bs-body-font-family: var(--sg-font);
    --bs-secondary-color: var(--sg-muted);
    --bs-border-color: var(--sg-line);
    --bs-link-color: var(--sg-brand-light);
    --bs-link-hover-color: #fff;
    --bs-tertiary-bg: var(--sg-surface);
    --bs-emphasis-color: #fff;
}

.btn-primary {
    --bs-btn-bg: var(--sg-brand);
    --bs-btn-border-color: var(--sg-brand);
    --bs-btn-hover-bg: var(--sg-brand-dark);
    --bs-btn-hover-border-color: var(--sg-brand-dark);
    --bs-btn-active-bg: var(--sg-brand-dark);
    --bs-btn-active-border-color: var(--sg-brand-dark);
    --bs-btn-disabled-bg: var(--sg-brand);
    --bs-btn-disabled-border-color: var(--sg-brand);
    --bs-btn-focus-shadow-rgb: var(--sg-brand-rgb);
}

.btn-outline-primary {
    --bs-btn-color: var(--sg-brand-light);
    --bs-btn-border-color: var(--sg-brand);
    --bs-btn-hover-bg: var(--sg-brand);
    --bs-btn-hover-border-color: var(--sg-brand);
    --bs-btn-active-bg: var(--sg-brand-dark);
    --bs-btn-active-border-color: var(--sg-brand-dark);
}

.form-control, .form-select {
    color: var(--sg-text);
    background-color: var(--sg-surface);
    border-color: var(--sg-line);
    border-radius: var(--sg-radius);
}
.form-control::placeholder { color: var(--sg-placeholder); }
.form-control:focus, .form-select:focus {
    color: var(--sg-text);
    background-color: var(--sg-surface);
    border-color: var(--sg-brand);
    box-shadow: var(--sg-ring);
}
.form-check-input:checked { background-color: var(--sg-brand); border-color: var(--sg-brand); }

.card, .modal-content, .dropdown-menu, .list-group-item, .offcanvas {
    --bs-card-bg: var(--sg-surface);
    background-color: var(--sg-surface);
    border-color: var(--sg-line);
    color: var(--sg-text);
}
.card-header, .card-footer, .modal-header, .modal-footer { background: var(--sg-surface-2); border-color: var(--sg-line); }
.dropdown-item { color: var(--sg-text); }
.dropdown-item:hover { background: var(--sg-surface-2); color: #fff; }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--sg-text);
    --bs-table-border-color: var(--sg-line);
    --bs-table-striped-bg: rgba(255, 255, 255, .03);
    --bs-table-hover-bg: rgba(var(--sg-brand-rgb), .08);
}

.page-item.active .page-link { background: var(--sg-brand); border-color: var(--sg-brand); }
.page-link { background: var(--sg-surface); border-color: var(--sg-line); color: var(--sg-text); }
.nav-pills .nav-link.active, .badge.bg-primary { background-color: var(--sg-brand) !important; }
.text-primary { color: var(--sg-brand-light) !important; }
.bg-primary { background-color: var(--sg-brand) !important; }
.border-primary { border-color: var(--sg-brand) !important; }

/* ---------- Reusable components (work in any page, no ::deep needed) ---------- */
.sg-field { margin-bottom: 20px; }
.sg-field > label { display: block; margin-bottom: 8px; font-size: .92rem; font-weight: 500; }

.sg-input {
    width: 100%;
    box-sizing: border-box;
    padding: 14px 16px;
    font: inherit;
    color: var(--sg-text);
    background: var(--sg-surface);
    border: 1.5px solid var(--sg-line);
    border-radius: var(--sg-radius);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.sg-input::placeholder { color: var(--sg-placeholder); }
.sg-input:hover { border-color: var(--sg-line-hover); }
.sg-input:focus { border-color: var(--sg-brand); box-shadow: var(--sg-ring); }

.sg-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    font: inherit;
    font-weight: 600;
    border: 0;
    border-radius: var(--sg-radius);
    cursor: pointer;
    transition: background .15s ease, transform .1s ease;
}
.sg-btn:disabled { opacity: .75; cursor: progress; }
.sg-btn-block { display: flex; width: 100%; }

.sg-btn-primary { color: #fff; background: var(--sg-brand); box-shadow: 0 12px 28px rgba(var(--sg-brand-rgb), .28); }
.sg-btn-primary:hover:not(:disabled) { background: var(--sg-brand-dark); }
.sg-btn-primary:active:not(:disabled) { transform: translateY(1px); }

.sg-btn-ghost { color: var(--sg-text); background: var(--sg-surface-2); border: 1px solid var(--sg-line); }
.sg-btn-ghost:hover:not(:disabled) { border-color: var(--sg-brand); }

.sg-link { color: var(--sg-text); text-decoration: none; border-bottom: 1px solid var(--sg-brand); }
.sg-link:hover { color: #fff; border-bottom-width: 2px; }

.sg-alert {
    margin-bottom: 20px;
    padding: 12px 14px;
    font-size: .92rem;
    color: #FFD9D3;
    background: rgba(var(--sg-brand-rgb), .14);
    border: 1px solid rgba(var(--sg-brand-rgb), .55);
    border-radius: var(--sg-radius-sm);
}

.sg-card {
    background: var(--sg-surface);
    border: 1px solid var(--sg-line);
    border-radius: 18px;
    padding: 24px;
}

.sg-muted { color: var(--sg-muted); }

.sg-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sg-spin .7s linear infinite;
}
@keyframes sg-spin { to { transform: rotate(360deg); } }

/* Blazor validation (global so every EditForm matches) */
.validation-message { margin-top: 6px; font-size: .85rem; color: var(--sg-danger-text); }
.invalid { outline: none !important; border-color: var(--sg-danger-text) !important; }
.valid.modified:not([type=checkbox]) { outline: none !important; border-color: var(--sg-success) !important; }

@media (prefers-reduced-motion: reduce) {
    .sg-spinner { animation-duration: 1.6s; }
    .sg-input, .sg-btn { transition: none; }
}

/* =========================================================
   PAGE KIT (added for list/form pages) – reusable everywhere.
   If you have edited theme.css yourself, paste just this part.
   ========================================================= */
:root { --sg-danger: #D93636; }

/* Page header */
.sg-page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}
.sg-page-title { margin: 0; font-size: 1.6rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; color: var(--sg-text); }
.sg-page-sub { margin: 4px 0 0; color: var(--sg-muted); }

/* Cards with header / body / footer */
.sg-card--flush { padding: 0; overflow: hidden; }
.sg-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--sg-line); }
.sg-card-title { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--sg-text); }
.sg-card-body { padding: 22px; }
.sg-card-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 22px; border-top: 1px solid var(--sg-line); background: var(--sg-surface-2); }

/* Buttons */
.sg-btn-sm { padding: 8px 14px; font-size: .88rem; border-radius: var(--sg-radius-sm); }
.sg-btn-danger { color: #fff; background: var(--sg-danger); }
.sg-btn-danger:hover:not(:disabled) { filter: brightness(.9); }

.sg-icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    color: var(--sg-muted); background: transparent;
    border: 1px solid var(--sg-line); border-radius: var(--sg-radius-sm);
    cursor: pointer; transition: color .15s ease, border-color .15s ease;
}
.sg-icon-btn:hover:not(:disabled) { color: var(--sg-text); border-color: var(--sg-brand); }
.sg-icon-btn--danger:hover:not(:disabled) { color: var(--sg-danger-text); border-color: var(--sg-danger-text); }
.sg-icon-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Search box with icon */
.sg-search { position: relative; flex: 1; min-width: 200px; }
.sg-search .bi { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--sg-placeholder); pointer-events: none; }
.sg-search .sg-input { padding-left: 42px; }

/* Segmented filter */
.sg-segment { display: inline-flex; gap: 4px; padding: 4px; background: var(--sg-surface-2); border: 1px solid var(--sg-line); border-radius: var(--sg-radius); }
.sg-segment button { padding: 8px 14px; font: inherit; font-size: .9rem; color: var(--sg-muted); background: transparent; border: 0; border-radius: var(--sg-radius-sm); cursor: pointer; }
.sg-segment button:hover { color: var(--sg-text); }
.sg-segment button.active { color: #fff; background: var(--sg-brand); }

/* On/off switch – use on a checkbox: <label class="sg-switch"><InputCheckbox /> …</label> */
.sg-switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }
.sg-switch input {
    appearance: none; -webkit-appearance: none; position: relative; flex-shrink: 0;
    width: 46px; height: 26px; margin: 0; cursor: pointer;
    background: var(--sg-surface-2); border: 1.5px solid var(--sg-line); border-radius: 999px;
    transition: background .15s ease, border-color .15s ease;
}
.sg-switch input::after {
    content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: var(--sg-muted); transition: transform .15s ease, background .15s ease;
}
.sg-switch input:checked { background: var(--sg-brand); border-color: var(--sg-brand); }
.sg-switch input:checked::after { transform: translateX(20px); background: #fff; }

/* Table */
.sg-table-wrap { overflow-x: auto; }
.sg-table { width: 100%; border-collapse: collapse; font-size: .95rem; color: var(--sg-text); }
.sg-table th { padding: 14px 18px; text-align: left; font-size: .85rem; font-weight: 600; white-space: nowrap; color: var(--sg-muted); background: var(--sg-surface-2); border-bottom: 1px solid var(--sg-line); }
.sg-table td { padding: 14px 18px; vertical-align: middle; border-bottom: 1px solid var(--sg-line); }
.sg-table tbody tr:last-child td { border-bottom: 0; }
.sg-table tbody tr:hover { background: rgba(var(--sg-brand-rgb), .06); }
.sg-col-num { width: 64px; color: var(--sg-muted); }
.sg-col-actions { width: 1%; white-space: nowrap; text-align: right; }
.sg-th-sort { display: inline-flex; align-items: center; gap: 6px; padding: 0; font: inherit; font-weight: 600; color: inherit; background: none; border: 0; cursor: pointer; }
.sg-th-sort:hover { color: var(--sg-text); }

/* Status badges */
.sg-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 12px; font-size: .82rem; font-weight: 500; border: 1px solid transparent; border-radius: 999px; }
.sg-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sg-badge--success { color: var(--sg-success); background: rgba(47, 191, 113, .12); border-color: rgba(47, 191, 113, .35); }
.sg-badge--muted { color: var(--sg-muted); background: rgba(175, 164, 164, .1); border-color: var(--sg-line); }

/* Success message */
.sg-alert--success {
    
     margin-bottom: 20px;
    padding: 12px 14px;
    font-size: .92rem;
      border-radius: var(--sg-radius-sm);
       border: 1px solid rgba(var(--sg-brand-rgb), .55);
    color: #C9F3DB; background: rgba(47, 191, 113, .12); border-color: rgba(47, 191, 113, .45); }

/* Empty state */
.sg-empty { padding: 48px 24px; text-align: center; color: var(--sg-muted); }
.sg-empty .bi { display: block; margin-bottom: 12px; font-size: 2rem; color: var(--sg-placeholder); }
.sg-empty strong { display: block; margin-bottom: 4px; color: var(--sg-text); }

/* Pager */
.sg-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; font-size: .9rem; color: var(--sg-muted); border-top: 1px solid var(--sg-line); }
.sg-pager-ctrl { display: flex; align-items: center; gap: 10px; }

/* Full-height pages: wrap a page's content in <div class="sg-fill"> and a table
   (SC_Table) or any flexible block inside it will take the remaining screen height. */
.sg-fill {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
