/* ---------------------------------------------------------------------
   Design tokens - SMWIspat LogBook admin theme. Deliberately no CDN/
   webfont dependency (an on-prem, potentially internet-less deployment
   per this project's own hosting notes) - every icon here is an inline
   SVG data-URI or a plain glyph, same technique the stock Blazor
   template already used for its two nav icons, just extended to a full
   icon set and color system.
   ------------------------------------------------------------------ */
:root {
    --swi-sidebar-from: #0f172a;
    --swi-sidebar-to: #1e293b;
    /* Brand palette taken directly from the company logo (Sangam Steel) -
       red as the primary accent, teal as a secondary accent for info/
       highlight states, matching the "of business"/steel-bar mark rather
       than a generic Bootstrap/AdminLTE color. */
    --swi-accent: #d2232a;
    --swi-accent-dark: #a81b21;
    --swi-accent-teal: #00a99d;
    --swi-accent-teal-dark: #00847b;
    --swi-content-bg: #f1f5f9;
    --swi-card-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
    --swi-card-shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12), 0 4px 10px rgba(15, 23, 42, 0.06);
    --swi-card-radius: 0.65rem;
    --swi-radius-sm: 0.4rem;
    --swi-radius-lg: 0.9rem;
    --swi-text-muted: #64748b;
    --swi-border: #e2e8f0;
    --swi-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --swi-sidebar-width: 258px;
    --swi-sidebar-width-mini: 4.25rem;
}

/* 'Inter' is requested for the premium-ERP look; deliberately NOT loaded
   from a CDN/webfont service (this app targets on-prem/offline-capable
   deployment, see ARCHITECTURE.md hosting notes) - it's simply first in
   the stack and used automatically on any machine that already has it
   installed, with the exact same system-font fallback as before otherwise,
   so nothing regresses on a plant PC without it. */
html, body {
    font-family: 'Inter', 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--swi-content-bg);
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------------
   Small shared utility patterns reused across dashboard/list/report pages -
   centralized so every page gets the same premium empty/loading treatment
   instead of ad hoc "no data" text.
   ------------------------------------------------------------------ */
.swi-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 3rem 1.5rem;
    color: var(--swi-text-muted);
    text-align: center;
}

.swi-empty-state-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--swi-content-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.4rem;
}

.swi-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 0.15rem solid rgba(15, 23, 42, 0.12);
    border-top-color: var(--swi-accent);
    border-radius: 50%;
    display: inline-block;
    animation: swi-spin 0.7s linear infinite;
    vertical-align: -0.2rem;
}

@keyframes swi-spin {
    to { transform: rotate(360deg); }
}

.swi-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

.swi-status-pill::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: currentColor;
}

a, .btn-link {
    color: var(--swi-accent-dark);
}

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

    .btn-primary:hover, .btn-primary:focus {
        background-color: var(--swi-accent-dark);
        border-color: var(--swi-accent-dark);
    }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--swi-accent);
}

.content {
    padding-top: 1.1rem;
    padding-bottom: 2rem;
}

/* Card polish applied globally so every page (Home, Records, Reports,
   Admin screens) picks up the same premium look without per-page CSS. */
.card {
    border: 1px solid var(--swi-border);
    border-radius: var(--swi-card-radius);
    box-shadow: var(--swi-card-shadow);
    transition: box-shadow var(--swi-transition), transform var(--swi-transition);
}

.card-title {
    font-weight: 600;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--swi-border);
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.85rem 1.1rem;
}

h1, .h1 {
    font-weight: 600;
    font-size: 1.6rem;
    color: #0f172a;
}

/* Every page follows the same <h1> + <p class="text-muted"> header shape -
   style it once here so every screen gets a consistent, separated header
   band instead of each page floating its own spacing. */
article.content > h1:first-child,
article.content > .page-header {
    margin-bottom: 0.35rem;
}

article.content > p.text-muted:first-of-type,
article.content > .page-header p.text-muted {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--swi-border);
    max-width: 900px;
}

h5, .h5 {
    font-weight: 600;
    color: #1e293b;
}

/* ---------------------------------------------------------------------
   Tables - every admin grid uses plain Bootstrap .table with no styling.
   ------------------------------------------------------------------ */
.table {
    --bs-table-bg: transparent;
    font-size: 0.9rem;
    background: #fff;
    border-radius: var(--swi-card-radius);
    overflow: hidden;
}

/* Branded header bar (matches the sidebar's dark steel gradient) instead of
   a plain light-gray row - reads as a deliberately designed enterprise grid
   rather than an unstyled HTML table. */
.table > thead {
    background: linear-gradient(180deg, var(--swi-sidebar-to) 0%, var(--swi-sidebar-from) 100%);
}

    .table > thead > tr > th {
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.92);
        border-bottom: 2px solid var(--swi-accent);
        padding: 0.75rem 1rem;
        white-space: nowrap;
    }

.table > tbody > tr > td {
    padding: 0.65rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--swi-border);
}

.table > tbody > tr:last-child > td {
    border-bottom: none;
}

.table-hover > tbody > tr:hover > td,
.table > tbody > tr:hover > td {
    background-color: #f8fafc;
}

/* A bare .table isn't already inside a .card on most pages - wrap it in
   the same card treatment so it doesn't look like a raw HTML table
   floating in whitespace. */
.table-responsive, .table {
    box-shadow: var(--swi-card-shadow);
    border: 1px solid var(--swi-border);
}

/* Belt-and-braces: a wide table should scroll WITHIN its own box, never
   force the whole page to scroll sideways. Bootstrap's .table-responsive
   already sets overflow-x:auto, but this is restated explicitly (and
   applied as a fallback directly to any bare .table too) so a page that
   forgets the wrapper degrades gracefully instead of blowing out the
   layout on narrow/tablet screens. */
/* Opt-in: caps a table's height and scrolls its ROWS internally (sticky
   header) instead of letting the table grow the whole page - toolbar/pager
   stay put above/below. Added to .table-responsive rather than replacing
   it, so horizontal AND vertical overflow are both handled by one wrapper. */
.swi-table-scroll {
    max-height: 65vh;
    overflow-y: auto;
}

    .swi-table-scroll thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        /* A sticky cell needs its OWN opaque background - the gradient set
           on the parent <thead> doesn't "follow" a stickied descendant, so
           without this the header would turn transparent once pinned. */
        background-color: var(--swi-sidebar-from);
    }

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.content, body, html {
    overflow-x: hidden;
}

.table {
    max-width: 100%;
}

/* ---------------------------------------------------------------------
   Buttons - consistent radius/weight, accent-colored outline variants
   instead of Bootstrap's stock blue/green/red mix.
   ------------------------------------------------------------------ */
.btn {
    border-radius: var(--swi-radius-sm);
    font-weight: 500;
    font-size: 0.88rem;
    transition: background-color var(--swi-transition), border-color var(--swi-transition), color var(--swi-transition), box-shadow var(--swi-transition);
}

.btn-sm {
    font-size: 0.8rem;
}

.btn-outline-primary {
    color: var(--swi-accent-dark);
    border-color: var(--swi-accent);
}

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

/* ---------------------------------------------------------------------
   List groups (Master Data hub, Reports hub, role picker) - make them
   read as a navigable menu, not a bare bulleted list.
   ------------------------------------------------------------------ */
.list-group-item {
    border-color: var(--swi-border);
    padding: 0.85rem 1.1rem;
    font-size: 0.92rem;
}

.list-group-item-action {
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

    .list-group-item-action::after {
        content: "\203A";
        color: var(--swi-text-muted);
        font-size: 1.1rem;
        font-weight: 700;
    }

    .list-group-item-action:hover {
        background-color: #f8fafc;
        color: var(--swi-accent-dark);
    }

.list-group {
    border-radius: var(--swi-card-radius);
    overflow: hidden;
    box-shadow: var(--swi-card-shadow);
}

/* ---------------------------------------------------------------------
   Forms - tighter, more deliberate spacing than Bootstrap's defaults.
   ------------------------------------------------------------------ */
.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.3rem;
}

.form-control, .form-select {
    border-color: var(--swi-border);
    font-size: 0.9rem;
}

    .form-control:focus, .form-select:focus {
        border-color: var(--swi-accent);
    }

/* ---------------------------------------------------------------------
   Alerts/badges - softer, tinted backgrounds instead of Bootstrap's
   saturated defaults.
   ------------------------------------------------------------------ */
.alert {
    border: none;
    border-radius: var(--swi-card-radius);
    font-size: 0.88rem;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background-color: #dcfce7;
    color: #166534;
}

.badge {
    font-weight: 600;
    padding: 0.35em 0.6em;
    border-radius: 0.35rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxN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LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ---------------------------------------------------------------------
   Responsive polish - single codebase, no separate mobile views. Tablet
   gets tighter spacing/larger tap targets; phone gets full-width stacked
   cards/tables and full-screen modals, per the enterprise-ERP responsive
   requirement (Desktop/Tablet/Mobile from ONE set of Razor components).
   ------------------------------------------------------------------ */
@media (max-width: 991.98px) {
    .btn, .form-control, .form-select {
        min-height: 2.5rem;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td {
        padding: 0.6rem 0.75rem;
    }
}

@media (max-width: 575.98px) {
    .content {
        padding-left: 0.25rem;
        padding-right: 0.25rem;
    }

    .modal-dialog {
        margin: 0;
        max-width: 100%;
        height: 100%;
    }

    .modal-content {
        height: 100%;
        border-radius: 0;
    }

    .kpi-card, .card {
        border-radius: var(--swi-radius-sm);
    }
}

/* Hover-lift used by KPI/dashboard cards and anything opting in explicitly -
   NOT applied to every .card globally, since static data-entry cards (forms)
   shouldn't visually "float" on hover. */
.swi-card-interactive:hover {
    box-shadow: var(--swi-card-shadow-lg);
    transform: translateY(-2px);
}