/* ===== Variables ===== */
:root {
    --color-bg: #0f0f12;
    --color-surface: #18181c;
    --color-border: #2a2a30;
    --color-text: #e4e4e7;
    --color-text-muted: #a1a1aa;
    --color-primary: #6366f1;
    --color-primary-hover: #818cf8;
    --color-accent: #22d3ee;
    --color-success: #34d399;
    --color-danger: #f87171;
    --font-sans: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.25);
}

/* ===== Base ===== */
html, body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-top: 0;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { color: var(--color-primary-hover); }

/* ===== App shell ===== */
.app-page {
    display: flex;
    min-height: 100vh;
}

.app-topbar {
    display: none;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
}
.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}
.app-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-text);
}
.app-toggler {
    background: none;
    border: none;
    color: var(--color-text);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.app-toggler span {
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.app-sidebar {
    width: 240px;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: 1rem 0;
    flex-shrink: 0;
}
.app-sidebar.collapse {
    display: none;
}
.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-nav-link {
    padding: 0.6rem 1rem;
    color: var(--color-text-muted);
    border-radius: var(--radius);
    margin: 0 0.5rem;
    transition: background .15s, color .15s;
}
.app-nav-link:hover, .app-nav-link.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--color-primary);
}
.app-nav-icon {
    opacity: 0.8;
    margin-right: 0.5rem;
    font-size: 0.85em;
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 1.5rem;
}
.app-content {
    max-width: 1000px;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .app-topbar { display: block; }
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 52px;
        bottom: 0;
        z-index: 100;
        box-shadow: var(--shadow);
    }
    .app-sidebar.collapse { display: none; }
    .app-main { padding: 1rem; }
}

/* ===== Forms & buttons (app) ===== */
.btn-primary {
    background: var(--color-primary);
    border: none;
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
}
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary, .btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
}
.btn-secondary:hover, .btn-outline-secondary:hover {
    background: var(--color-surface);
    border-color: var(--color-text-muted);
}
.form-control {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    width: 100%;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
.form-label { color: var(--color-text-muted); margin-bottom: 0.25rem; display: block; }
.alert-danger { background: rgba(248,113,113,0.15); color: var(--color-danger); border: 1px solid var(--color-danger); border-radius: var(--radius); padding: 0.75rem; }
.alert-success { background: rgba(52,211,153,0.15); color: var(--color-success); border-radius: var(--radius); padding: 0.75rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { color: var(--color-text-muted); font-weight: 500; }
.table-striped tbody tr:nth-child(odd) { background: rgba(255,255,255,0.02); }
/* Tabellen im Dark-Theme: kein weißer Hintergrund */
.app-main .table,
.app-main .table th,
.app-main .table td,
.app-main .table thead,
.app-main .table tbody,
.app-main .table tbody tr {
    background: transparent !important;
    background-color: transparent !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}
.app-main .table {
    background: var(--color-surface) !important;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.app-main .table thead th {
    background: rgba(0,0,0,0.2) !important;
    color: var(--color-text-muted) !important;
    font-weight: 500;
    border-bottom: 1px solid var(--color-border);
}
.app-main .table tbody td {
    border-bottom: 1px solid var(--color-border);
}
.app-main .table-striped tbody tr:nth-child(odd) {
    background: rgba(255,255,255,0.03) !important;
}
.app-main .table-striped tbody tr:nth-child(even) {
    background: transparent !important;
}
.app-main .table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08) !important;
}
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.card-body { padding: 1.25rem; }
.card-title { color: var(--color-text) !important; }
.card-text { color: var(--color-text) !important; }
/* Billing & App-Inhalte: Lesbarkeit auf dunklem Hintergrund */
.app-main,
.app-content {
    color: var(--color-text);
}
.app-main h1,
.app-main h2,
.app-main h3,
.app-main h4,
.app-main h5,
.app-main h6 { color: var(--color-text) !important; }
.app-main .card,
.app-main .card-body,
.app-main .card-title,
.app-main .card-text,
.app-main p,
.app-main li { color: var(--color-text); }
.app-main .text-muted,
.app-main .small,
.app-main small { color: var(--color-text-muted) !important; }
.app-main .text-success { color: var(--color-success) !important; }
.app-main .text-warning { color: #fbbf24 !important; }
/* Dashboard: Buttons in Tabellen – gut lesbar, kein heller Hintergrund */
.app-main .btn-outline-secondary {
    background: transparent !important;
    border: 1px solid var(--color-text-muted) !important;
    color: var(--color-text) !important;
}
.app-main .btn-outline-secondary:hover {
    background: var(--color-surface) !important;
    border-color: var(--color-primary) !important;
    color: var(--color-primary) !important;
}
.text-muted { color: var(--color-text-muted); }
.small, small { font-size: 0.875rem; }
code { background: var(--color-surface); padding: 0.2em 0.4em; border-radius: 4px; font-family: var(--font-mono); font-size: 0.9em; }

/* ===== Landing layout ===== */
.landing-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, #0f0f12 0%, #1a1a24 50%, #0d0d12 100%);
}
.landing-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.landing-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.landing-header .brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-text);
    letter-spacing: -0.02em;
}
.landing-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.landing-nav a {
    color: var(--color-text-muted);
    font-weight: 500;
}
.landing-nav a:hover { color: var(--color-text); }
.landing-main { flex: 1; }
.landing-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}
.landing-footer-inner { max-width: 1100px; margin: 0 auto; }

/* ===== Hero ===== */
.hero {
    padding: 4rem 1.5rem 5rem;
    text-align: center;
}
.hero-content { max-width: 680px; margin: 0 auto; }
.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    line-height: 1.7;
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}
.btn-hero-primary {
    display: inline-block;
    background: var(--color-primary);
    color: #fff !important;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    -webkit-text-fill-color: #fff;
}
.btn-hero-primary:hover { background: var(--color-primary-hover); }
.btn-hero-secondary {
    display: inline-block;
    background: transparent;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    -webkit-text-fill-color: var(--color-text);
}
.btn-hero-secondary:hover { border-color: var(--color-text-muted); background: rgba(255,255,255,0.05); }

/* ===== Features ===== */
.features {
    padding: 4rem 1.5rem;
    background: rgba(0,0,0,0.2);
}
.features-inner { max-width: 1100px; margin: 0 auto; }
.features h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 2.5rem;
    color: var(--color-text);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}
.feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color .2s, transform .2s;
}
.feature-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}
.feature-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--color-text-muted); font-size: 0.95rem; margin: 0; }

/* ===== CTA ===== */
.cta {
    padding: 4rem 1.5rem;
    text-align: center;
}
.cta-inner { max-width: 560px; margin: 0 auto; }
.cta h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
.cta p { color: var(--color-text-muted); margin-bottom: 1.5rem; }

/* ===== Auth pages in app layout ===== */
.container { max-width: 520px; margin-left: auto; margin-right: auto; padding: 0 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.me-1 { margin-right: 0.25rem; }
.me-2 { margin-right: 0.5rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.875rem; }
.btn-link { background: none; border: none; color: var(--color-primary); cursor: pointer; padding: 0; }
.form-check { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.form-check-input { width: 1.25rem; height: 1.25rem; accent-color: var(--color-primary); }
.list-unstyled { list-style: none; padding: 0; margin: 0; }

/* ===== Blazor / loading ===== */
h1:focus { outline: none; }
.content { padding-top: 1rem; }
.valid.modified:not([type=checkbox]) { outline: 1px solid var(--color-success); }
.invalid { outline: 1px solid var(--color-danger); }
.validation-message { color: var(--color-danger); }
#blazor-error-ui {
    background: rgba(248,113,113,0.2);
    color: var(--color-danger);
    bottom: 0;
    padding: 0.6rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    display: none;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { padding: 1rem; color: white; background: var(--color-danger); }
.loading-progress { display: block; width: 8rem; height: 8rem; margin: 20vh auto 1rem auto; }
.loading-progress circle { fill: none; stroke: var(--color-border); stroke-width: 0.6rem; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--color-primary); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; }
.loading-progress-text { text-align: center; font-weight: bold; margin-top: 1rem; }
