/* ═══════════════════════════════════════════════════════════
   immich-lounge companion — indigo night theme
   Palette from architecture mockup (flat, no shadows/glows):
     base #1e1e2e · accent #7c87ff · rose #ff7c7c · mint #7cffb2
   Fonts: Syne (display) · Nunito (ui)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@500;600;700&family=Nunito:wght@300;400;500;600&display=swap');

/* ── Variables ────────────────────────────────────────── */
:root {
    --bg-base:      #0d1120;
    --bg-surface:   #151b2d;
    --bg-elevated:  #1b2338;
    --bg-hover:     #24304a;
    --border:       #2b3650;

    --text-primary:   #d0d0ee;
    --text-secondary: #8888aa;
    --text-muted:     #4a4a6a;

    --accent:        #7c87ff;
    --accent-hover:  #6a75ee;
    --accent-light:  rgba(124, 135, 255, 0.12);
    --accent-border: #7c87ff;

    --danger:        #ff7c7c;
    --danger-light:  rgba(255, 124, 124, 0.10);
    --danger-border: #ff7c7c;

    --success:        #7cffb2;
    --success-light:  rgba(124, 255, 178, 0.10);
    --success-border: #7cffb2;

    --radius:    6px;
    --radius-lg: 10px;
    --transition: 140ms ease;

    --font-display: 'Syne', system-ui, sans-serif;
    --font-ui:      'Nunito', system-ui, sans-serif;
}

/* ── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(93, 129, 255, 0.14), transparent 28%),
        linear-gradient(135deg, #0d1120 0%, #12182a 48%, #151c2e 100%);
}

/* ── Layout ───────────────────────────────────────────── */
.page {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar-shell {
    position: relative;
    border-right: 1px solid rgba(93, 129, 255, 0.14);
    background: #0d1120;
}

.main-shell {
    min-width: 0;
    padding: 2.5rem;
}

.content-shell {
    width: min(100%, 960px);
}

.content {
    padding: 0;
}

.editor-header {
    margin-bottom: 1.5rem;
}

.editor-dirty-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(255, 124, 124, 0.08);
    border: 1px solid rgba(255, 124, 124, 0.32);
    border-radius: var(--radius);
    color: #ffd6d6;
}

.editor-dirty-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.editor-dirty-banner strong {
    color: #fff0f0;
    font-size: 0.9rem;
}

.editor-dirty-banner span {
    color: #f0c4c4;
    font-size: 0.88rem;
}

.editor-dirty-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.page-intro,
.section-intro {
    color: var(--text-secondary);
}

.page-intro {
    max-width: 48rem;
}

.section-intro {
    font-size: 0.9rem;
    margin: -0.2rem 0 1rem;
}

.editor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.editor-card {
    max-width: none;
}

.editor-card-wide {
    grid-column: 1 / -1;
}

.settings-field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
}

/* ── Settings card ────────────────────────────────────── */
.settings-card {
    background: var(--bg-surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    max-width: 720px;
}

/* ── Location search ──────────────────────────────────── */
.search-row {
    display: flex;
    gap: 0.5rem;
}
.search-row input { flex: 1; }

.search-results {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-surface);
    max-height: 200px;
    overflow-y: auto;
}
.search-results li {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}
.search-results li:last-child { border-bottom: none; }
.search-results li:hover { background: var(--bg-hover, var(--border)); }

/* ── Navigation ───────────────────────────────────────── */
.nav-menu {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    min-height: 100vh;
    padding: 2rem 1.5rem;
}

.nav-brand {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 0.35rem 0 1.1rem;
    border-bottom: 1px solid rgba(93, 129, 255, 0.18);
}

.nav-logo-lockup {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.nav-logo-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: block;
}

.nav-wordmark {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
    min-width: 0;
}

.nav-title {
    font-family: var(--font-display);
    font-size: 1.18rem;
    line-height: 1.05;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.nav-subtitle {
    font-size: 0.56rem;
    line-height: 1.2;
    letter-spacing: 0.01em;
    color: #8a9bbf;
}

.nav-tagline {
    margin: 0;
    max-width: 240px;
    font-size: 0.88rem;
    line-height: 1.55;
    color: #b4b7db;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #969cd0;
    margin-bottom: 0.15rem;
}

.nav-menu a {
    display: block;
    padding: 0.75rem 0.9rem;
    color: #c8cbeb;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 700;
    border-radius: 12px;
    border: 1px solid rgba(124, 135, 255, 0.08);
    background: rgba(255, 255, 255, 0.015);
    transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.nav-menu a:hover {
    color: #f5f6ff;
    background: rgba(124, 135, 255, 0.12);
    border-color: rgba(124, 135, 255, 0.24);
}

.nav-menu a.active {
    color: var(--accent);
    background: linear-gradient(135deg, rgba(124, 135, 255, 0.18), rgba(124, 255, 178, 0.1));
    border-color: rgba(124, 135, 255, 0.36);
    font-weight: 600;
}

.nav-menu a.sub-nav {
    font-size: 0.84rem;
    font-weight: 600;
    color: #aeb3de;
    padding-left: 1rem;
}

.nav-menu a.sub-nav:hover  { color: var(--text-primary); }
.nav-menu a.sub-nav.active { color: var(--accent); }

/* ── Typography ───────────────────────────────────────── */
h1, h2 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin: 0 0 1rem;
    line-height: 1.15;
}
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; }

h3 {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: #9fa7dd;
    margin: 2rem 0 0.95rem;
}

p { margin: 0 0 0.75rem; color: var(--text-secondary); }

code {
    font-size: 0.78rem;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    border: 1px solid rgba(124, 135, 255, 0.25);
}

/* ── Forms ────────────────────────────────────────────── */
.form-group, .mb-3 {
    margin-bottom: 1.1rem;
}

label {
    display: block;
    font-size: 0.73rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin-bottom: 0.4rem;
}

label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    font-weight: 400;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

label:has(input[type="number"]) {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 0.65rem;
}

label:has(select) {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.875rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    font-weight: 400;
    margin-bottom: 0.65rem;
}

.form-control,
input[type="text"],
input[type="password"],
input[type="email"] {
    display: block;
    width: 100%;
    padding: 0.55rem 0.9rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}

input[type="number"] {
    width: 90px;
    padding: 0.45rem 0.7rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}

select {
    padding: 0.48rem 2.1rem 0.48rem 0.78rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238888aa' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    transition: border-color var(--transition);
    min-width: 140px;
}

label:has(select) select { display: inline-block; }

.form-control:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--accent);
}

.form-control::placeholder,
input::placeholder { color: var(--text-muted); }

input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Buttons ──────────────────────────────────────────── */
.btn, button {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.15rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn-primary, button.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn-primary:hover, button.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary, button.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover, button.btn-secondary:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-danger, button.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--border);
}
.btn-danger:hover, button.btn-danger:hover {
    background: var(--danger-light);
    border-color: var(--danger-border);
}

button:not([class]), button.btn {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
button:not([class]):hover, button.btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.chip button {
    all: unset;
    cursor: pointer;
    color: rgba(124, 135, 255, 0.5);
    font-size: 1rem;
    line-height: 1;
    padding: 0 0 0 0.3rem;
    transition: color var(--transition);
}
.chip button:hover { color: var(--accent); }

.btn-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 1.75rem;
    flex-wrap: wrap;
}

.editor-actions {
    align-items: center;
}

.editor-actions-status {
    margin-right: auto;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.editor-actions.is-dirty {
    position: sticky;
    bottom: 1rem;
    padding: 0.85rem 1rem;
    background: rgba(26, 26, 46, 0.94);
    border: 1px solid rgba(124, 135, 255, 0.24);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
}

.editor-actions.is-dirty .editor-actions-status {
    color: #dfe3ff;
    font-weight: 600;
}

/* ── Alerts ───────────────────────────────────────────── */
.alert {
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin: 1rem 0;
    border: 2px solid;
}
.alert-success {
    background: var(--success-light);
    border-color: var(--success-border);
    color: var(--success);
}
.alert-error, .alert-danger {
    background: var(--danger-light);
    border-color: var(--danger-border);
    color: var(--danger);
}
.error {
    color: var(--danger);
    font-size: 0.82rem;
    margin-top: 0.4rem;
}

/* ── Profile cards ────────────────────────────────────── */
.profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 0.6rem;
    transition: border-color var(--transition);
}
.profile-card:hover { border-color: var(--accent-border); }

.profile-card code {
    display: inline-block;
    margin-top: 0.15rem;
}

.profile-info { flex: 1; min-width: 0; }
.profile-info strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}
.profile-info p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0 0 0.3rem;
}

.profile-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ── Dialog ───────────────────────────────────────────── */
.dialog {
    background: var(--bg-elevated);
    border: 1px solid rgba(124, 135, 255, 0.2);
    border-radius: 20px;
    width: min(100%, 460px);
    padding: 1.4rem 1.4rem 1.25rem;
    background:
        linear-gradient(180deg, rgba(124, 135, 255, 0.08), transparent 28%),
        var(--bg-elevated);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}
.dialog h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 0;
}
.dialog label { margin-top: 0.65rem; }
.dialog .btn-row { margin-top: 1.25rem; }

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(6, 10, 20, 0.7);
    backdrop-filter: blur(12px);
}

.dialog-profile {
    position: relative;
}

.dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.dialog-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #a7b1ff;
}

.dialog-copy {
    margin: 0.55rem 0 0;
    color: #aeb6d6;
    max-width: 32rem;
}

.dialog-fields {
    display: grid;
    gap: 0.2rem;
}

.dialog-input-mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.field-hint {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dialog-actions {
    margin-top: 1.5rem;
}

.dialog-close {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(124, 135, 255, 0.18);
    background: rgba(255, 255, 255, 0.02);
    color: #c7cdf4;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
}

.dialog-close:hover {
    background: rgba(124, 135, 255, 0.12);
    border-color: rgba(124, 135, 255, 0.3);
    color: #f5f6ff;
}

.dialog-error {
    margin-top: 0.95rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 124, 124, 0.35);
    background: rgba(255, 124, 124, 0.08);
}

/* ── Source Picker ────────────────────────────────────── */
.source-picker {
    position: relative;
    margin-bottom: 1rem;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    background: var(--accent-light);
    border: 1px solid rgba(124, 135, 255, 0.35);
    border-radius: 100px;
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.search-input {
    display: block;
    width: 100%;
    padding: 0.45rem 0.8rem;
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text-primary);
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }

.dropdown {
    position: absolute;
    left: 0; right: 0;
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    margin-top: 3px;
    z-index: 100;
    overflow: hidden;
}
.dropdown-item {
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Blazor bits ──────────────────────────────────────── */
.blazor-error-boundary {
    background: var(--danger-light);
    border: 2px solid var(--danger-border);
    border-radius: var(--radius);
    padding: 0.9rem 0.9rem 0.9rem 3.5rem;
    color: var(--danger);
}
.blazor-error-boundary::after { content: "An error has occurred."; }

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--success); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 0.82rem; }

@media (max-width: 900px) {
    .page {
        grid-template-columns: 1fr;
    }

    .sidebar-shell {
        border-right: 0;
        border-bottom: 1px solid rgba(124, 135, 255, 0.16);
    }

    .nav-menu {
        min-height: auto;
        gap: 1rem;
        padding: 1rem 1rem 1.1rem;
    }

    .main-shell {
        padding: 1.5rem 1.25rem 2rem;
    }

    .nav-brand {
        gap: 0.5rem;
        padding: 0 0 0.75rem;
    }

    .nav-logo-icon {
        width: 42px;
        height: 42px;
    }

    .nav-title {
        font-size: 1.02rem;
    }

    .nav-subtitle {
        font-size: 0.52rem;
    }

    .nav-tagline {
        display: none;
    }

    .nav-section-title {
        margin-bottom: 0;
    }

    .nav-menu a {
        padding: 0.65rem 0.8rem;
        font-size: 0.88rem;
    }

    .content-shell,
    .settings-card {
        width: 100%;
        max-width: none;
    }

    .editor-grid,
    .settings-field-grid {
        grid-template-columns: 1fr;
    }

    .editor-dirty-banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .editor-dirty-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .sidebar-shell {
        background: #0d1120;
    }

    .nav-menu {
        padding: 0.9rem 0.9rem 1rem;
    }

    .nav-section {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .nav-section-title {
        grid-column: 1 / -1;
    }

    .nav-menu a.sub-nav {
        padding-left: 0.8rem;
    }

    .modal-shell {
        align-items: end;
        padding: 0.85rem;
    }

    .dialog {
        width: 100%;
        border-radius: 18px;
        padding: 1.15rem 1rem 1rem;
    }

    .dialog-header {
        gap: 0.75rem;
    }

    .dialog-actions .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
}
