/* ================================
   BASE
================================ */

:root {
    --color-bg: #f7f4ef;
    --color-surface: #fffdfa;
    --color-border: #e0d6c8;
    --color-primary: #c89a5b;
    --color-primary-dark: #b98b4f;
    --color-text: #3f2d20;
    --color-muted: #8a725d;
    --color-danger: #e50000;
    --color-success: #2f7d4a;
    --radius: 12px;
    --transition: 0.15s ease;
    --sidebar-width: 260px;
    --topbar-height: 4rem;
}

html,
body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    margin: 0;
    padding: 0;
    min-height: 100%;
}

a,
.btn-link {
    color: var(--color-primary);
}


/* ================================
   BUTTON
================================ */

.btn {
    height: 38px;
    padding: 0 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
}

.btn:hover {
    border-color: var(--color-primary);
    background: #f5efe6;
}

.btn-primary {
    color: #fff;
    background: var(--color-primary);
    border: none;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}


/* ================================
   ICON BUTTON
================================ */

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.icon-btn i {
    font-size: 18px;
    color: var(--color-text);
}

.icon-btn:hover {
    background: #f5efe6;
    border-color: var(--color-primary);
}

.icon-btn:hover i {
    color: var(--color-primary);
}


/* ================================
   INPUTS
================================ */

.input {
    width: 100%;
    height: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 0 0.8rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: all var(--transition);
    box-sizing: border-box;
}

.input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(200, 154, 91, 0.14);
}

.input::placeholder {
    color: #a6907b;
}


/* ================================
   LAYOUT
================================ */

.page {
    display: flex;
    min-height: 100vh;
    width: 100%;
    background: var(--color-bg);
}

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    border-right: 1px solid #e8dfd2;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: #fffdf9;
    position: relative;
    z-index: 5;
}

main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content {
    padding: 1.1rem 1rem 1rem 1rem;
    flex: 1;
    box-sizing: border-box;
}

h1:focus {
    outline: none;
}

@media (max-width: 768px) {
    .page {
        display: block;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        border-right: none;
        background: transparent;
        display: block;
    }

    main {
        width: 100%;
    }

    .content {
        padding: 1rem;
    }
}


/* ================================
   CARD
================================ */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(63, 45, 32, 0.04);
}

.card h4 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}


/* ================================
   SHARED UI
=============================== */

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.panel-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-text);
}

/* Shared subtitle line below a panel title (agency name, counts, hints …) */
.page-subtitle {
    display: block;
    margin: 0.15rem 0 0;
    font-size: 0.9rem;
    color: var(--color-muted);
}

.section-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
}

.field-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #5f4a38;
}

.alert-success {
    background: #e6f3ea;
    color: var(--color-success);
    border-color: #cde7d6;
}

.alert-danger {
    background: #fdeeee;
    color: #9a3f35;
    border-color: #efc7c1;
}

.alert-warning {
    background: #fdf7e8;
    color: #7d5b12;
    border-color: #ecd89a;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.auth-card {
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 18px;
    padding: 2rem;
}

.input-wrap {
    width: 100%;
}


/* ================================
   SPACING
================================ */

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}


/* ================================
   VALIDATION
================================ */

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--color-danger);
}

.validation-message {
    color: var(--color-danger);
}

.error-box {
    margin-top: 1rem;
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius);
    border: 1px solid #efc7c1;
    background: #fdf1ef;
    color: #9a3f35;
}


/* ================================
   ERROR UI
================================ */

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PC9zdmc+) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}


/* ================================
   FORMS
================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
    font-weight: 600;
    color: #5f4a38;
}

.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;
}

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}


/* ================================
   TABLE & PAGINATION
================================ */

.table-wrap {
    overflow-x: auto;
}

.table-base {
    width: 100%;
    border-collapse: collapse;
}

.table-base th,
.table-base td {
    padding: 0.85rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}

.table-base th {
    background: #fbf8f3;
    font-weight: 600;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pagination-dots {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: var(--color-muted);
    font-weight: 600;
}

@media (max-width: 640px) {
    .pagination {
        width: 100%;
        justify-content: flex-end;
    }
}


/* ================================
   STATUS BADGES
================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 0.75rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    border: 1px solid transparent;
    white-space: nowrap;
}

.status-pending {
    background: #f6e7bf;
    color: #7d5b12;
    border-color: #ecd89a;
}

.status-success {
    background: #e6f3ea;
    color: var(--color-success);
    border-color: #cde7d6;
}

.status-error {
    background: #fdeeee;
    color: #a43e3e;
    border-color: #f3cccc;
}

.status-default {
    background: #f2ece4;
    color: #725d48;
    border-color: #e3d8cb;
}

.status-preinfo {
    background: #e7edf6;
    color: #3d5378;
    border-color: #cdd9ec;
}


/* ================================
   STATES
================================ */

.empty-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-muted);
}


/* ================================
   TOPBAR
================================ */

.topbar {
    min-height: var(--topbar-height);
    height: var(--topbar-height);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    background: #fbf8f3;
    border-bottom: 1px solid #e8dfd2;
    box-sizing: border-box;
    padding: 0 1rem;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-form {
    margin: 0;
}

.topbar-action {
    width: 44px;
    height: 44px;
    border: 1px solid #dccfbe;
    border-radius: 14px;
    background: #fffdfa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 2px rgba(63, 45, 32, 0.04);
    transition: all 0.15s ease;
}

.topbar-action i {
    font-size: 1.2rem;
    color: #5a4634;
}

.topbar-action:hover {
    background: #f8f1e8;
    border-color: #c89a5b;
}

.topbar-action:hover i {
    color: #b98b4f;
}

.topbar-action:active {
    transform: translateY(1px);
}

/* ================================
   LANGUAGE SELECTOR
================================ */

.lang-selector {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.lang-selector-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    color: #5a4634;
    pointer-events: none;
}

.lang-selector-select {
    height: 44px;
    padding: 0 2rem 0 2.25rem;
    border: 1px solid #dccfbe;
    border-radius: 14px;
    background: #fffdfa;
    color: #5a4634;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: 0 1px 2px rgba(63, 45, 32, 0.04);
    transition: all 0.15s ease;
}

.lang-selector-select:hover {
    background: #f8f1e8;
    border-color: #c89a5b;
}

.lang-selector-select:focus {
    outline: none;
    border-color: #c89a5b;
}

.lang-selector::after {
    content: "";
    position: absolute;
    right: 14px;
    width: 0.5rem;
    height: 0.5rem;
    border-right: 2px solid #8a725d;
    border-bottom: 2px solid #8a725d;
    transform: rotate(45deg) translateY(-2px);
    pointer-events: none;
}

/* Keep the selector usable on the minimal login / 2FA screens. */
.auth-lang-selector {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}


/* ================================
   LEGACY
================================ */

.logout-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #e0d6c8;
    background: #fffdfa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn i {
    font-size: 18px;
    color: #5a4634;
}

.logout-btn:hover {
    background: #f5efe6;
    border-color: #c89a5b;
}

.logout-btn:hover i {
    color: #c89a5b;
}




/* ================================
   PERSISTENT NOTIFICATION BANNERS
================================ */
.banner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
    box-sizing: border-box;
}

.banner-icon {
    font-size: 1.35rem;
    flex-shrink: 0;
    margin-top: 2px; 
    display: inline-flex;
    line-height: 1;
    opacity: 0.85;
    transition: opacity var(--transition) !important;
}

.banner-text {
    flex: 1;
    padding-top: 0.05rem;
}

.banner-info {
    background: #e8f0f7;
    color: #3a6b8c;
    border-color: #d0e2f0;
}

    .banner-info .banner-icon {
        color: #3a6b8c;
    }

.banner-warning {
    background: #fdf7e8;
    color: #7d5b12;
    border-color: #ecd89a;
}

    .banner-warning .banner-icon {
        color: #7d5b12;
    }

.banner-critical {
    background: #fdeeef;
    color: #a43e3e;
    border-color: #f3cccc;
}

    .banner-critical .banner-icon {
        color: #a43e3e;
    }

.banner-container {
    width: 100%;
    max-width: 720px;
    margin: 0 auto 1rem auto;
}


/*=======
    modal
    =======*/

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1040;
    pointer-events: auto;
    transition: opacity 0.2s ease-in-out;
}

.modal-content {
    position: relative;
    z-index: 1050;
}

.force-pw-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(30, 20, 10, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9000;
}

.force-pw-modal {
    width: 100%;
    max-width: 440px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(63, 45, 32, 0.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.force-pw-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    background: #fbf8f3;
}

/* Header row with a title on the left and a ✕ close button on the right */
.modal-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

    .modal-header-row .icon-btn {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
    }

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

    .force-pw-header h5 {
        margin: 0;
        font-size: 1rem;
        font-weight: 700;
        color: var(--color-text);
    }

.force-pw-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.force-pw-footer {
    padding: 1rem 1.25rem 1.25rem 1.25rem;
    border-top: 1px solid var(--color-border);
    background: #fffdfa;
    display: flex;
    justify-content: flex-end;
}

.banner-success {
    background: #e6f3ea;
    color: #2f7d4a;
    border-color: #cde7d6;
}

    .banner-success .banner-icon {
        color: #2f7d4a;
    }

    /*TOTP*/
.totp-grid {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.totp-box {
    width: 42px;
    height: 48px;
    text-align: center;
    font-size: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    outline: none;
}

    .totp-box:focus {
        border-color: var(--color-primary);
        box-shadow: 0 0 0 2px rgba(0,0,0,0.05);
    }