/* ══════════════════════════════════════════
   FMS — Global Stylesheet  v2
   Sidebar / topbar / layout styles live in
   Sidebar.razor and MainLayout.razor.
   This file owns: base, shell, login, wizard,
   dashboard, error page, bootstrap overrides.
   ══════════════════════════════════════════ */

/* ── Base ── */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f1f5f9;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link {
    color: #2563b0;
    text-decoration: none;
}

    a:hover {
        color: #1d50a0;
    }

/* ── Bootstrap overrides ── */
.btn-primary {
    color: #fff;
    background-color: #2563b0;
    border-color: #1d50a0;
    border-radius: 9px;
    font-weight: 600;
}

    .btn-primary:hover,
    .btn-primary:focus {
        background-color: #1d50a0;
        border-color: #1a4490;
    }

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem rgba(37,99,176,.35);
    outline: none;
}

.form-control,
.form-select {
    border-radius: 9px;
    border-color: #e2e8f0;
    font-size: .875rem;
    color: #0f172a;
    background: #f8fafc;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

    .form-control:focus,
    .form-select:focus {
        border-color: #2563b0;
        background: #fff;
        color: #0f172a;
    }

.form-label {
    font-size: .8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: .35rem;
}

h1:focus {
    outline: none;
}

/* ── Validation ── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid #059669;
}

.invalid {
    outline: 1px solid #dc2626;
}

.validation-message {
    color: #dc2626;
    font-size: .78rem;
    margin-top: .2rem;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ── Floating labels ── */
.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;
}

/* ══════════════════════════════════════════
   App shell
   Sidebar is position:fixed.
   --sidebar-closed / --sidebar-open mirror
   the values in Sidebar.razor so MainLayout
   can transition its margin-left smoothly.
   ══════════════════════════════════════════ */
:root {
    --sidebar-closed: 66px;
    --sidebar-open: 230px;
    --sidebar-t: 0.26s cubic-bezier(.4,0,.2,1);
}

.app-shell {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
}

/* ══════════════════════════════════════════
   Login page
   ══════════════════════════════════════════ */
.login-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow: hidden;
    background-color: #0b1d3a;
}

.login-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    pointer-events: none;
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(7,20,47,.85), rgba(22,68,144,.65));
    z-index: 2;
    pointer-events: none;
}

.login-card {
    position: relative;
    z-index: 3;
    background: rgba(255,255,255,.97);
    border-radius: 24px;
    padding: 2.5rem;
    width: min(420px, 90vw);
    box-shadow: 0 24px 50px rgba(10,35,85,.35);
    backdrop-filter: blur(10px);
}

.login-brand {
    font-size: 2.5rem;
    font-weight: 900;
    color: #1b6ec2;
    letter-spacing: 3px;
}

.login-subtitle {
    color: #5b6b80;
    margin-bottom: 2rem;
}

.login-card .input-group-text {
    background: #f2f6ff;
    border: 1px solid #d9e3f7;
    color: #1b6ec2;
    border-radius: 12px 0 0 12px;
}

.login-card .form-control {
    border-radius: 0 12px 12px 0;
    border-color: #d9e3f7;
    background: #fff;
}

.login-card .btn-primary {
    border-radius: 999px;
    padding: .65rem 1.5rem;
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(27,110,194,.28);
}

.login-card .btn-outline-primary {
    border-radius: 999px;
}

/* ══════════════════════════════════════════
   Setup wizard (CreateCompany layout)
   ══════════════════════════════════════════ */
.wizard-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f4f8ff 0%, #fff 100%);
    padding: 3rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-card {
    width: min(980px, 95vw);
    background: #fff;
    border-radius: 28px;
    padding: 2.5rem;
    box-shadow: 0 24px 48px rgba(17,45,90,.14);
}

.wizard-header {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.wizard-title {
    margin: 0;
    font-size: 2rem;
    color: #0f2b5b;
    font-weight: 800;
}

.wizard-subtitle {
    margin: .35rem 0 0;
    color: #5c6f8f;
}

.wizard-steps {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .35rem;
    font-size: .85rem;
    color: #7a8baa;
}

    .wizard-step span {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 2px solid #c6d6f2;
        font-weight: 700;
        color: #7a8baa;
        background: #f2f6ff;
    }

    .wizard-step.active span,
    .wizard-step.complete span {
        background: #2563b0;
        border-color: #2563b0;
        color: #fff;
    }

    .wizard-step.complete {
        color: #2563b0;
    }

.wizard-divider {
    width: 48px;
    height: 2px;
    background: #d3e2fb;
    border-radius: 2px;
}

.wizard-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.wizard-card .form-control {
    border-radius: 10px;
    border-color: #dbe5f5;
}

.wizard-card .btn-primary,
.wizard-card .btn-outline-primary {
    border-radius: 999px;
    padding: .6rem 1.75rem;
}

/* ══════════════════════════════════════════
   Dashboard
   ══════════════════════════════════════════ */
.dashboard-hero {
    border-radius: 18px;
    background: linear-gradient(135deg, #1b6ec2, #4b9cff);
    color: #fff;
}

    .dashboard-hero .card-title {
        font-size: 1.8rem;
        font-weight: 700;
    }

.hero-actions {
    display: flex;
    gap: .75rem;
}

.kpi-card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    transition: box-shadow .15s, transform .15s;
}

    .kpi-card:hover {
        box-shadow: 0 4px 16px rgba(0,0,0,.1);
        transform: translateY(-2px);
    }

.kpi-primary {
    background: #eff6ff;
}

.kpi-accent {
    background: #fff4f0;
}

.kpi-soft {
    background: #f0fdf4;
}

.kpi-neutral {
    background: #f6f7fb;
}

.kpi-label {
    font-size: .78rem;
    text-transform: uppercase;
    color: #7b8aa5;
    letter-spacing: .08em;
    font-weight: 700;
}

.kpi-value {
    font-size: 1.65rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -.02em;
}

.kpi-trend {
    font-size: .82rem;
}

.dashboard-section {
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #fff;
    min-height: 240px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.dashboard-placeholder {
    height: 180px;
    border-radius: 12px;
    border: 1px dashed #c7d3e8;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a8baa;
    background: #f7f9fd;
    font-size: .875rem;
}

/* ══════════════════════════════════════════
   Error page
   ══════════════════════════════════════════ */
.app-error {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    padding: 2rem;
}

.app-error-card {
    background: #fff;
    border-radius: 18px;
    padding: 2.5rem;
    max-width: 520px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(15,35,85,.12);
    border: 1px solid #e2e8f0;
}

    .app-error-card h1 {
        font-size: 1.8rem;
        font-weight: 800;
        color: #0f172a;
    }

    .app-error-card p {
        color: #5b6b80;
        margin: 1rem 0 2rem;
    }

.app-error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Blazor error UI (MainLayout styles visible version) ── */
#blazor-error-ui {
    display: none;
}

/* ══════════════════════════════════════════
   Shared utility classes
   ══════════════════════════════════════════ */

/* Generic page wrapper */
.fms-page {
    padding: 1.75rem 1.5rem 3rem;
    max-width: 1420px;
    margin: 0 auto;
}

/* Card base */
.fms-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    overflow: hidden;
}

/* Status badges */
.fms-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.fms-badge-ok {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.fms-badge-warn {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.fms-badge-err {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.fms-badge-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.fms-badge-muted {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

/* Table helpers */
.fms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

    .fms-table th {
        padding: 10px 14px;
        text-align: left;
        font-size: .7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: #64748b;
        background: #f8fafc;
        border-bottom: 1.5px solid #e2e8f0;
        white-space: nowrap;
    }

    .fms-table td {
        padding: 11px 14px;
        border-bottom: 1px solid #f1f5f9;
        color: #0f172a;
        vertical-align: middle;
    }

    .fms-table tbody tr:last-child td {
        border-bottom: none;
    }

    .fms-table tbody tr:hover td {
        background: #fafbff;
    }

/* Scrollbar polish */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 99px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }
