/* ============================================================
   LastVault Admin — Dark Theme
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    background: #0A0A0A;
    color: #E0E0E0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    color-scheme: dark;
}

a {
    color: #C9A84C;
    text-decoration: none;
}

a:hover {
    color: #dfc06a;
}

h1, h2, h3, h4 {
    color: #F0F0F0;
    font-weight: 600;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

h1:focus {
    outline: none;
}

/* ── Admin Shell Layout ───────────────────────────────────── */

.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */

.sidebar {
    width: 240px;
    min-width: 240px;
    background: #111111;
    border-right: 1px solid #222;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #222;
}

.sidebar-brand img {
    height: 28px;
    width: auto;
}

.brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #C9A84C;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #999;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    color: #E0E0E0;
    background: rgba(201, 168, 76, 0.05);
}

.nav-item.active {
    color: #C9A84C;
    background: rgba(201, 168, 76, 0.08);
    border-left-color: #C9A84C;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
    stroke: #C9A84C;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #222;
}

.version-text {
    font-size: 0.75rem;
    color: #555;
}

/* ── Main Content ─────────────────────────────────────────── */

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
    min-height: 100vh;
}

/* ── Cards ────────────────────────────────────────────────── */

.card {
    background: #141414;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.card-header {
    font-size: 1rem;
    font-weight: 600;
    color: #F0F0F0;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #222;
}

/* ── Stat Cards ───────────────────────────────────────────── */

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #141414;
    border: 1px solid #222;
    border-left: 4px solid #C9A84C;
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card:hover {
    border-color: #C9A84C66;
}

.stat-card .stat-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

.stat-card .stat-label,
.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.stat-card .stat-value,
.stat-value {
    font-size: 14px;
    font-weight: 700;
    color: #E0E0E0;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

/* ── Tables ───────────────────────────────────────────────── */

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #222;
}

table,
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    background: #111;
    color: #C9A84C;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #222;
}

tbody tr {
    border-bottom: none;
}

tbody tr:nth-child(odd) {
    background: #111;
}

tbody tr:nth-child(even) {
    background: #161616;
}

tbody tr:hover {
    background: #1a1a1a;
}

tbody td {
    padding: 12px 16px;
    color: #ccc;
    border-bottom: none;
}

/* ── Buttons ──────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

button,
input[type="submit"],
input[type="button"] {
    font-family: inherit;
}

.btn-gold,
button.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, #C9A84C, #E8C55A, #C9A84C);
    color: #0A0A0A;
    box-shadow: 0 2px 8px rgba(201, 168, 76, 0.25);
}

.btn-gold:hover,
button.btn-gold:hover {
    background: linear-gradient(135deg, #D4B85C 0%, #F0D06A 50%, #D4B85C 100%);
    box-shadow: 0 4px 16px rgba(201, 168, 76, 0.35);
    transform: translateY(-1px);
}

.btn-gold:active,
button.btn-gold:active {
    transform: translateY(0);
}

.btn-gold:disabled,
button.btn-gold:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost,
button.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: transparent;
    color: #888;
    border: 1px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-ghost:hover,
button.btn-ghost:hover {
    border-color: #C9A84C;
    color: #C9A84C;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: transparent;
    color: #C9A84C;
    border: 1px solid #C9A84C;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: rgba(201, 168, 76, 0.1);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #E53935 0%, #D32F2F 100%);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Form Inputs ──────────────────────────────────────────── */

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="tel"],
textarea,
select,
.input-dark {
    width: 100%;
    padding: 10px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #E0E0E0;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

select option {
    background: #111;
    color: #E0E0E0;
}

input:focus,
textarea:focus,
select:focus,
.input-dark:focus {
    outline: none;
    border-color: #C9A84C;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

input::placeholder,
textarea::placeholder,
.input-dark::placeholder {
    color: #555;
}

label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-group {
    margin-bottom: 16px;
}

/* ── Badges ───────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success,
.badge-green {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(46, 125, 50, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.badge-danger,
.badge-red {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(211, 47, 47, 0.15);
    color: #EF5350;
    border: 1px solid rgba(239, 83, 80, 0.3);
}

.badge-warning,
.badge-amber {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 160, 0, 0.15);
    color: #FFA726;
    border: 1px solid rgba(255, 167, 38, 0.3);
}

.badge-info {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(33, 150, 243, 0.15);
    color: #42A5F5;
    border: 1px solid rgba(66, 165, 245, 0.3);
}

/* ── Grid Helpers ─────────────────────────────────────────── */

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ── Alert / Toast ────────────────────────────────────────── */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(46, 125, 50, 0.12);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4CAF50;
}

.alert-error {
    background: rgba(211, 47, 47, 0.12);
    border: 1px solid rgba(239, 83, 80, 0.3);
    color: #EF5350;
}

.alert-warning {
    background: rgba(255, 160, 0, 0.12);
    border: 1px solid rgba(255, 167, 38, 0.3);
    color: #FFA726;
}

/* ── Loading ──────────────────────────────────────────────── */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #333;
    border-top-color: #C9A84C;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    color: #888;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Code / Monospace ─────────────────────────────────────── */

code, .mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    background: #1a1a1a;
    padding: 2px 6px;
    border-radius: 4px;
    color: #C9A84C;
}

/* ── Scrollbar ────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0A0A0A;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* ── Blazor Error UI ──────────────────────────────────────── */

#blazor-error-ui {
    background: #1a1a1a;
    border-top: 2px solid #C9A84C;
    color: #E0E0E0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    z-index: 9999;
    display: none;
    color-scheme: dark;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
    color: #999;
}

.blazor-error-boundary {
    background: rgba(211, 47, 47, 0.1);
    border: 1px solid rgba(211, 47, 47, 0.3);
    padding: 16px;
    border-radius: 8px;
    color: #EF5350;
}

.blazor-error-boundary::after {
    content: "An error has occurred.";
}

/* ── Validation ───────────────────────────────────────────── */

.valid.modified:not([type=checkbox]) {
    outline: none;
    border-color: #4CAF50;
}

.invalid {
    outline: none;
    border-color: #EF5350;
}

.validation-message {
    color: #EF5350;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* ── Bootstrap-compat text helpers ────────────────────────── */

.text-danger {
    color: #EF5350;
}

/* ── Auth Pages ───────────────────────────────────────────── */

.auth-page {
    min-height: 100vh;
    background: #0A0A0A;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.auth-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 16px;
    padding: 40px 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.auth-card-wide {
    max-width: 520px;
}

.auth-container:has(.auth-card-wide) {
    max-width: 560px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    height: 36px;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #F0F0F0;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 0.85rem;
    color: #666;
}

.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.auth-alert svg {
    flex-shrink: 0;
}

.auth-btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px 20px;
    font-size: 0.95rem;
}

.auth-btn-group {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.auth-btn-group .btn-ghost {
    flex: 0 0 auto;
}

.auth-btn-group .btn-gold {
    flex: 1;
}

.auth-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #1a1a1a;
    font-size: 0.75rem;
    color: #444;
}

.auth-redirect {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #666;
    font-size: 0.9rem;
}

/* Input with icon */

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    pointer-events: none;
}

.input-with-icon {
    padding-left: 42px !important;
}

/* TOTP input */

.totp-input {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 1.2rem !important;
    letter-spacing: 6px;
    text-align: center;
}

.totp-input-large {
    width: 100%;
    padding: 14px 20px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #E0E0E0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 1.8rem !important;
    letter-spacing: 10px;
    text-align: center;
    transition: border-color 0.2s;
}

.totp-input-large:focus {
    outline: none;
    border-color: #C9A84C;
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

/* Lockout banner */

.lockout-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: rgba(211, 47, 47, 0.08);
    border: 1px solid rgba(211, 47, 47, 0.25);
    border-radius: 10px;
    padding: 20px;
    color: #EF5350;
}

.lockout-banner strong {
    display: block;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.lockout-banner p {
    font-size: 0.85rem;
    color: #999;
    margin: 0;
}

/* Spinner small */

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* QR Section (TOTP setup) */

.setup-steps {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
}

.step {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #333;
    color: #555;
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step.active {
    border-color: #C9A84C;
    color: #C9A84C;
    background: rgba(201, 168, 76, 0.1);
}

.step.done {
    border-color: #4CAF50;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.step-line {
    width: 48px;
    height: 2px;
    background: #333;
}

.step-line.active {
    background: #4CAF50;
}

.qr-section {
    text-align: center;
    margin-bottom: 24px;
}

.qr-wrapper {
    display: inline-block;
    background: #0A0A0A;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.qr-image {
    width: 200px;
    height: 200px;
    image-rendering: pixelated;
}

.qr-instructions h3 {
    font-size: 1rem;
    color: #E0E0E0;
    margin-bottom: 6px;
}

.qr-instructions p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 12px;
}

.secret-reveal {
    margin-top: 8px;
}

.secret-key {
    margin-top: 10px;
    padding: 10px 16px;
    background: #0A0A0A;
    border: 1px solid #222;
    border-radius: 8px;
    display: inline-block;
}

.secret-key code {
    font-size: 0.9rem;
    letter-spacing: 2px;
    color: #C9A84C;
    word-break: break-all;
}

/* Verify section */

.verify-section {
    text-align: center;
    margin-bottom: 24px;
}

.verify-section h3 {
    font-size: 1.1rem;
    color: #E0E0E0;
    margin-bottom: 6px;
}

.verify-section p {
    font-size: 0.85rem;
    color: #666;
}

/* Success section */

.success-section {
    text-align: center;
    padding: 20px 0;
}

.success-icon {
    margin-bottom: 16px;
}

.success-section h3 {
    font-size: 1.2rem;
    color: #4CAF50;
    margin-bottom: 8px;
}

.success-section p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 24px;
}

/* Main topbar (logout button) */

.main-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* ── Delete / Modal ───────────────────────────────────────── */

.btn-ghost.btn-danger {
    color: #EF5350;
    background: none;
    border: none;
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-ghost.btn-danger:hover {
    color: #fff;
    background: rgba(239, 83, 80, 0.15);
}

.btn-danger-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 20px;
    font-size: 0.875rem;
    font-weight: 600;
    background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger-solid:hover {
    background: linear-gradient(135deg, #E53935 0%, #D32F2F 100%);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 24px 28px;
    max-width: 460px;
    width: 90%;
    color: #E0E0E0;
}

.modal-box h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #EF5350;
}

.modal-box p {
    font-size: 0.9rem;
    color: #999;
    line-height: 1.5;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
        min-width: 60px;
    }

    .sidebar .brand-text,
    .sidebar .nav-item span,
    .sidebar .version-text {
        display: none;
    }

    .sidebar-brand {
        justify-content: center;
        padding: 16px 8px;
    }

    .nav-item {
        justify-content: center;
        padding: 12px 8px;
        border-left: none;
        border-bottom: 2px solid transparent;
    }

    .nav-item.active {
        border-left: none;
        border-bottom-color: #C9A84C;
    }

    .main-content {
        margin-left: 60px;
        padding: 20px;
    }

    .stat-cards {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}
