/* #148 — Layout-Stil fuer die SuperAdmin-App. Minimal & klar.
   Inter via Google Fonts (CDN), tabular-nums fuer alle Zahlen,
   ruhige Farbpalette (Slate). */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    font-size: 14px;
    line-height: 1.5;
    color: #1e293b;
    background: #f8fafc;
}

table, .tabular { font-variant-numeric: tabular-nums; }

code, pre, .mono {
    font-family: 'JetBrains Mono', Cascadia Code, Consolas, monospace;
    font-size: 13px;
}

/* ─── App-Shell ─────────────────────────────────────────────────── */

.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    background: #0f172a;
    color: #e2e8f0;
    padding: 20px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.brand {
    display: flex;
    flex-direction: column;
    padding: 0 20px 10px;
    border-bottom: 1px solid #1e293b;
}
.brand strong { font-size: 16px; color: #f8fafc; font-weight: 600; }
.brand span { font-size: 11px; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 0 8px;
}
.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    padding: 6px 12px 4px;
}

/* :where(a) → Spezifitaet 0, damit Nav-Klassen jederzeit gewinnen */
:where(.sidebar a) {
    color: #cbd5e1;
    text-decoration: none;
    display: block;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
}
.sidebar a:hover {
    background: #1e293b;
    color: #f8fafc;
}
.sidebar a.active {
    background: #2563eb;
    color: white;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 20px;
    border-top: 1px solid #1e293b;
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.user-email {
    font-weight: 500;
    color: #e2e8f0;
    word-break: break-all;
}
.logout-button {
    background: transparent;
    color: #94a3b8;
    border: 1px solid #1e293b;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
}
.logout-button:hover { color: #f8fafc; border-color: #334155; }

.main-content {
    overflow-y: auto;
    padding: 24px 32px;
}

/* ─── Tenant-Cards (Liste) ───────────────────────────────────────── */

.tenant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.tenant-card {
    display: block;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.tenant-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.15);
    transform: translateY(-1px);
}
.tenant-card.locked {
    background: #f8fafc;
    border-color: #cbd5e1;
}
.tenant-card.locked .tenant-card-name { color: #64748b; }

.tenant-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.tenant-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
}
.tenant-card-badges {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    flex-shrink: 0;
}
.tenant-card-email {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 12px;
    word-break: break-all;
}
.tenant-card-metrics {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
}
.tenant-card-metric {
    display: flex;
    flex-direction: column;
}
.tenant-card-metric-right { margin-left: auto; text-align: right; }
.tenant-card-metric-value {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.tenant-card-metric-value-sm {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    font-variant-numeric: tabular-nums;
}
.tenant-card-metric-label {
    font-size: 10px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ─── Danger Zone ────────────────────────────────────────────────── */

.danger-zone {
    border-color: #fecaca;
    background: #fef2f2;
}
.btn-danger {
    background: #b91c1c;
    color: white;
    border: none;
}
.btn-danger:hover { background: #991b1b; }
.btn-danger:disabled { background: #fca5a5; cursor: not-allowed; }

/* ─── Metric-Cards (Detail-Pages) ────────────────────────────────── */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.metric-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 16px;
}
.metric-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.metric-value-sm {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    padding: 6px 0;
}
.metric-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
}

/* ─── Info-Row (Detail-Stammdaten) ───────────────────────────────── */

.info-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0;
}
.info-row-label {
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}
.info-row-value {
    color: #0f172a;
    font-size: 14px;
    word-break: break-all;
}
.info-row-value.mono {
    font-family: 'JetBrains Mono', Cascadia Code, Consolas, monospace;
    font-size: 12px;
    color: #475569;
}

/* ─── Modal ──────────────────────────────────────────────────────── */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 100;
}
.modal-card {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 10px;
    padding: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
    z-index: 101;
}
.modal-card h2 {
    font-size: 17px;
    margin: 0 0 4px;
    color: #0f172a;
}

/* ─── Page-Header ────────────────────────────────────────────────── */

.page-header {
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}
.page-header h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
}
.page-header p {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 13px;
}

/* ─── Cards ──────────────────────────────────────────────────────── */

.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 4px;
    color: #0f172a;
}
.card-description {
    color: #64748b;
    font-size: 12px;
    margin: 0 0 16px;
}

/* ─── Forms ──────────────────────────────────────────────────────── */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}
.form-group small {
    font-size: 11px;
    color: #94a3b8;
}
.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    background: white;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-group input[type="checkbox"] { width: 16px; height: 16px; }

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.btn {
    border: none;
    padding: 7px 14px;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #cbd5e1; cursor: not-allowed; }
.btn-secondary { background: white; color: #475569; border: 1px solid #cbd5e1; }
.btn-secondary:hover { background: #f1f5f9; }

/* ─── Status / Messages ──────────────────────────────────────────── */

.alert {
    padding: 10px 14px;
    border-radius: 5px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}
.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}
.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.badge-test { background: #fef3c7; color: #92400e; }
.badge-live { background: #dcfce7; color: #166534; }

/* ─── Identity-Pages (Login/Register/Manage) ─────────────────────── */
/* Das Template nutzt Bootstrap-Klassennamen, wir haben kein Bootstrap
   geladen — daher hier ein eigenes Shim das die wichtigsten Klassen
   nachbaut, plus ein zentriertes Auth-Layout fuer die /Account/*-Seiten. */

:where(h1, h2, h3, h4) { margin: 0 0 12px; }

/* AccountLayout — eigener Shell ohne Sidebar */
.auth-shell {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
    color: #f8fafc;
}
.auth-brand strong {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.auth-brand span {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 2px;
}
.auth-main {
    width: 100%;
    max-width: 400px;
}
.auth-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2), 0 10px 10px -5px rgba(0,0,0,0.1);
}
.auth-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px;
}
.auth-subtitle {
    color: #64748b;
    font-size: 13px;
    margin: 0 0 20px;
}
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0 12px;
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.auth-footer-links {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}
.auth-footer-links a {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
}
.auth-footer-links a:hover { text-decoration: underline; }

/* Floating-Label Inputs */
.form-floating {
    position: relative;
    margin-bottom: 14px;
}
.form-floating input.form-control {
    width: 100%;
    height: 48px;
    padding: 18px 12px 6px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    font-family: inherit;
}
.form-floating input.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-floating > label.form-label {
    position: absolute;
    top: 6px;
    left: 12px;
    font-size: 11px;
    color: #64748b;
    pointer-events: none;
}
.form-floating input.form-control::placeholder { color: transparent; }

/* Plain form-control + form-label (Manage-Pages) */
input.form-control, select.form-select, textarea.form-control {
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    font-family: inherit;
}
input.form-control:focus, select.form-select:focus, textarea.form-control:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 4px;
}

/* Buttons */
.btn {
    display: inline-block;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
}
.btn-primary {
    background: #2563eb;
    color: white;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-link {
    background: transparent;
    color: #2563eb;
    padding: 4px 8px;
}
.btn-link:hover { text-decoration: underline; }
.btn-lg { padding: 12px 18px; font-size: 15px; font-weight: 600; }
.btn.w-100 { width: 100%; display: block; }

/* Checkbox */
.checkbox label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
input.form-check-input { width: 16px; height: 16px; cursor: pointer; }

/* Diverse Helpers */
.mb-3 { margin-bottom: 14px; }
.mt-2 { margin-top: 8px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-danger { color: #b91c1c; font-size: 12px; }
.text-secondary { color: #64748b; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }

/* hr in Identity-Cards dezenter */
section hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 14px 0;
}

section h1, section h2 {
    font-size: 18px;
    color: #0f172a;
}
section h3 { font-size: 15px; color: #0f172a; }
section p { color: #475569; line-height: 1.5; margin: 8px 0; }
section a { color: #2563eb; text-decoration: none; }
section a:hover { text-decoration: underline; }

/* Body-Level Headings ausserhalb der Cards (z.B. das einsame "Log in") */
body > article > h1,
body > h1 {
    max-width: 680px;
    margin: 40px auto 0;
    padding: 0 20px 8px;
    font-size: 24px;
    font-weight: 600;
    color: #0f172a;
    text-align: center;
}

/* Brand-Header vor Identity-Pages — verlinkt zurück zur Login-Page */
body > article > h1::before {
    content: "Luma Pro";
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #2563eb;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* legacy */
h1:focus { outline: none; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; font-size: 12px; }
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}
.blazor-error-boundary::after { content: "An error has occurred." }
