/* ═══════════════════════════════════════════════════════════════════════════
   DeusaldLocalizer — Global stylesheet
   Bootstrap 5 dark mode + shared design tokens and layout primitives.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens ───────────────────────────────────────────────────────── */

:root,
[data-bs-theme="dark"] {
    color-scheme: dark;

    --dl-bg:           #08090c;
    --dl-bg-raised:    #2c2c2e;
    --dl-bg-hover:     #3a3a3c;
    --dl-line:         rgba(255, 255, 255, 0.08);

    --dl-accent:       #7c6af7;
    --dl-accent-hover: #9b8cff;
    --dl-accent-dim:   rgba(124, 106, 247, 0.18);

    --dl-text-1:       #f2f2f7;
    --dl-text-2:       #8e8e93;
    --dl-text-3:       #636366;

    --dl-success:      #30d158;
    --dl-warning:      #ffd60a;
    --dl-danger:       #ff453a;

    /* Bootstrap token overrides */
    --bs-body-bg:          var(--dl-bg);
    --bs-body-color:       var(--dl-text-1);
    --bs-border-color:     var(--dl-line);
    --bs-secondary-bg:     var(--dl-bg-raised);
    --bs-tertiary-bg:      var(--dl-bg-hover);
    --bs-primary-rgb:      124, 106, 247;
    --bs-link-color:       var(--dl-accent);
    --bs-link-hover-color: var(--dl-accent-hover);
}

/* ── Base reset ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--dl-bg);
    color: var(--dl-text-1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 13px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbars ──────────────────────────────────────────────────────────── */

::-webkit-scrollbar             { width: 5px; height: 5px; }
::-webkit-scrollbar-track       { background: transparent; }
::-webkit-scrollbar-thumb       { background: var(--dl-bg-hover); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--dl-text-3); }

/* ── Typography helpers ──────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 { color: var(--dl-text-1); font-weight: 600; letter-spacing: -0.015em; margin: 0; }
p { margin: 0; }
.text-muted { color: var(--dl-text-2) !important; }

/* ── App shell ───────────────────────────────────────────────────────────── */

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--dl-bg-raised);
    border-right: 1px solid var(--dl-line);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-content {
    flex: 1;
    overflow-y: auto;
    background: var(--dl-bg);
    min-width: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sidebar-brand {
    padding: 1.125rem 1rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--dl-line);
    margin-bottom: 0.5rem;
}

.sidebar-brand-icon {
    width: 24px;
    height: 24px;
    background: var(--dl-accent);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--dl-text-1);
    letter-spacing: -0.01em;
}

.sidebar-section {
    padding: 1.25rem 0.875rem 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--dl-text-3);
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--dl-text-2);
    background: none;
    border: none;
    border-radius: 6px;
    margin: 0 0.25rem;
    width: calc(100% - 0.5rem);
    text-align: left;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

.sidebar-item:hover { background: var(--dl-bg-hover); color: var(--dl-text-1); }

.sidebar-item.active {
    background: var(--dl-accent-dim);
    color: var(--dl-accent);
    font-weight: 500;
}

.sidebar-item .nav-icon {
    font-size: 13px;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
    margin-top: auto;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--dl-line);
}

.sidebar-footer-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--dl-text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer-meta {
    font-size: 0.625rem;
    color: var(--dl-text-3);
    margin-top: 2px;
}

/* ── Shared atoms ────────────────────────────────────────────────────────── */

.btn-primary-dl {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: var(--dl-accent); color: #fff;
    border: none; border-radius: 7px;
    font-size: 0.8125rem; font-weight: 500; cursor: pointer;
    transition: opacity 0.15s;
}
.btn-primary-dl:hover:not(:disabled) { opacity: 0.88; }
.btn-primary-dl:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost-dl {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: transparent; color: var(--dl-text-2);
    border: 1px solid var(--dl-line); border-radius: 7px;
    font-size: 0.8125rem; font-weight: 400; cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.btn-ghost-dl:hover:not(:disabled) { background: var(--dl-bg-hover); color: var(--dl-text-1); }
.btn-ghost-dl:disabled { opacity: 0.4; cursor: not-allowed; }

.dl-sep { height: 1px; background: var(--dl-line); margin: 0; border: none; }

.dl-spinner {
    display: inline-block; width: 14px; height: 14px;
    border: 1.5px solid var(--dl-line);
    border-top-color: var(--dl-accent);
    border-radius: 50%;
    animation: dl-spin 0.65s linear infinite;
    flex-shrink: 0;
}
@keyframes dl-spin { to { transform: rotate(360deg); } }

.dl-alert {
    padding: 0.625rem 0.875rem; border-radius: 8px;
    font-size: 0.8125rem; border: 1px solid transparent;
    display: flex; align-items: flex-start; gap: 0.5rem;
}
.dl-alert-error   { background: rgba(255,69,58,.1);  border-color: rgba(255,69,58,.25);  color: #ff6b6b; }
.dl-alert-success { background: rgba(48,209,88,.1);  border-color: rgba(48,209,88,.25);  color: var(--dl-success); }
.dl-alert-warning { background: rgba(255,214,10,.1); border-color: rgba(255,214,10,.25); color: var(--dl-warning); }

.form-control, .form-select {
    background: var(--dl-bg-raised); border: 1px solid var(--dl-line);
    color: var(--dl-text-1); border-radius: 7px; font-size: 0.8125rem;
}
.form-control:focus, .form-select:focus {
    background: var(--dl-bg-raised); border-color: var(--dl-accent);
    color: var(--dl-text-1); box-shadow: 0 0 0 3px var(--dl-accent-dim);
}
.form-control::placeholder { color: var(--dl-text-3); }

/* ── Blazor unhandled-error banner (WASM host only) ─────────────────────
   This element ships in index.html and is hidden by default; Blazor sets an
   inline display:block on it only when a genuine unhandled error occurs. The
   MAUI app.css this file was seeded from had no such element, so without this
   rule the banner shows permanently. */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 0.7rem 1.25rem;
    background: #2a1416;
    color: #ffb4b4;
    border-top: 1px solid var(--dl-danger, #ff6b6b);
    box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.4);
    font-size: 13px;
}
#blazor-error-ui .reload { color: var(--dl-accent, #8ea2ff); text-decoration: underline; cursor: pointer; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.9rem; top: 0.55rem; }

/* ── App boot / loading screen ──────────────────────────────────────────
   Shown while the WASM runtime downloads. Matches the desktop MAUI splash:
   the three glowing orb logo on the flat #0e0f13 background, with a themed
   progress ring driven by Blazor's --blazor-load-percentage. */
.app-boot {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    background: #0e0f13;
}
.app-boot-logo {
    position: relative;
    width: 9rem;
    height: 9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.app-boot-orbs {
    width: 5.75rem;
    height: 5.75rem;
}
.loading-progress {
    position: absolute;
    inset: 0;
    width: 9rem;
    height: 9rem;
}
.loading-progress circle {
    fill: none;
    stroke: rgba(255, 255, 255, 0.08);
    stroke-width: 0.2rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}
.loading-progress circle:last-child {
    stroke: var(--dl-accent, #7c6af7);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%));
    transition: stroke-dasharray 0.1s ease-in-out;
}
.loading-progress-text {
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #8ea2ff;
}
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading…"); }
.form-label { font-size: 0.75rem; font-weight: 500; color: var(--dl-text-2); margin-bottom: 0.25rem; }