/* =========================================
   UMBRAIX AI — CHAT SETTINGS CSS v2026
   "EDITORIAL CLARITY" — Matches style.css
   Solid surfaces. No glass. No blur.
   Light-first :root default.
   ========================================= */

/* Import Fonts */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cascadia+Code:wght@400;500;600&display=swap');


/* =========================================
   :ROOT — LIGHT THEME (Default)
   Exact mirror of style.css :root
   ========================================= */
:root {
    /* 1. BRAND */
    --brand-primary: oklch(48% 0.18 268);
    --brand-hover:   oklch(42% 0.20 268);
    --brand-active:  oklch(38% 0.22 268);
    --brand-surface: oklch(96% 0.03 268);

    /* 2. SEMANTIC STATUS */
    --color-success: oklch(52% 0.16 148);
    --color-warning: oklch(62% 0.18 85);
    --color-error:   oklch(54% 0.20 25);
    --color-info:    oklch(54% 0.14 240);

    /* 3. BACKGROUNDS — SOLID */
    --primary-bg:  oklch(99.5% 0.002 270);

    /* Solid Surface Layers */
    --surface-0:     #ffffff;
    --surface-1:     #f8f9fb;
    --surface-2:     #f1f3f6;
    --surface-3:     #e8ebf0;
    --surface-hover: #eef0f4;

    /* Input Surfaces */
    --input-bg:       #f4f5f8;
    --input-bg-focus: #ffffff;

    /* Panels */
    --bg-panel:     #ffffff;
    --bg-panel-alt: #f8f9fb;

    /* 4. TYPOGRAPHY */
    --text-main:      oklch(12% 0.02 270);
    --text-secondary: oklch(28% 0.02 270);
    --text-muted:     oklch(46% 0.02 270);
    --text-dim:       oklch(60% 0.015 270);
    --text-disabled:  oklch(72% 0.01 270);

    /* Font Families */
    --font-display: 'Space Grotesk', -apple-system, sans-serif;
    --font-body:    'Manrope', -apple-system, sans-serif;
    --font-code:    'Cascadia Code', 'Fira Code', monospace;

    /* Font Scale */
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;

    /* Line Heights */
    --leading-tight:   1.25;
    --leading-normal:  1.5;
    --leading-relaxed: 1.625;

    /* 5. BORDERS */
    --border-subtle: #e5e8ed;
    --border-medium: #d8dce4;
    --border-strong: #c6ccd6;
    --border-focus:  var(--brand-primary);

    /* 6. SHADOWS — Solid depth, no glow */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.09);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.10);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.12);
    --shadow-brand: 0 4px 16px rgba(90, 60, 200, 0.14);

    /* 7. SPACING & RADII */
    --radius-xs:   0.375rem;
    --radius-sm:   0.75rem;
    --radius-md:   1rem;
    --radius-lg:   1.5rem;
    --radius-xl:   2rem;
    --radius-pill: 9999px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 1rem;
    --space-4: 1.5rem;
    --space-5: 2rem;
    --space-6: 3rem;

    /* Containers */
    --container-sm: 640px;
    --container-md: 860px;

    /* 8. MOTION */
    --ease-out:    cubic-bezier(0.215, 0.61, 0.355, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 120ms;
    --transition-base: 220ms;
    --transition-slow: 340ms;

    /* NO GLASS — kept for compatibility, apply nothing */
    --glass-blur: 0px;
}


/* =========================================
   [data-theme="dark"] — VELOX MIDNIGHT
   ========================================= */
[data-theme="dark"] {
    --brand-primary: oklch(68% 0.20 265);
    --brand-hover:   oklch(74% 0.21 265);
    --brand-active:  oklch(62% 0.22 265);
    --brand-surface: oklch(20% 0.06 265);

    --color-success: oklch(68% 0.20 148);
    --color-warning: oklch(78% 0.18 88);
    --color-error:   oklch(64% 0.22 25);
    --color-info:    oklch(68% 0.18 242);

    --primary-bg: oklch(13% 0.014 272);

    --surface-0:     oklch(13% 0.014 272);
    --surface-1:     oklch(17% 0.016 272);
    --surface-2:     oklch(21% 0.018 272);
    --surface-3:     oklch(25% 0.020 272);
    --surface-hover: oklch(19% 0.017 272);

    --input-bg:       oklch(16% 0.014 272);
    --input-bg-focus: oklch(20% 0.018 272);

    --bg-panel:     oklch(17% 0.016 272);
    --bg-panel-alt: oklch(20% 0.018 272);

    --text-main:      oklch(96% 0.01 265);
    --text-secondary: oklch(88% 0.02 265);
    --text-muted:     oklch(70% 0.025 265);
    --text-dim:       oklch(54% 0.02 265);
    --text-disabled:  oklch(40% 0.015 265);

    --border-subtle: oklch(24% 0.018 272);
    --border-medium: oklch(28% 0.020 272);
    --border-strong: oklch(34% 0.022 272);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.40);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.50);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.60);
    --shadow-brand: 0 4px 16px rgba(100, 60, 230, 0.22);
}


/* =========================================
   [data-theme="void"] — ABSOLUTE VOID
   ========================================= */
[data-theme="void"] {
    --brand-primary: oklch(72% 0.22 265);
    --brand-hover:   oklch(78% 0.23 265);
    --brand-active:  oklch(66% 0.24 265);
    --brand-surface: oklch(15% 0.08 265);

    --color-success: oklch(70% 0.22 148);
    --color-warning: oklch(80% 0.20 88);
    --color-error:   oklch(66% 0.24 25);
    --color-info:    oklch(70% 0.20 242);

    --primary-bg: #000000;

    --surface-0:     #000000;
    --surface-1:     #0d0d0d;
    --surface-2:     #161616;
    --surface-3:     #202020;
    --surface-hover: #141414;

    --input-bg:       #0a0a0a;
    --input-bg-focus: #111111;

    --bg-panel:     #0d0d0d;
    --bg-panel-alt: #111111;

    --text-main:      #f5f5f5;
    --text-secondary: #d0d0d0;
    --text-muted:     #888888;
    --text-dim:       #555555;
    --text-disabled:  #383838;

    --border-subtle: #1e1e1e;
    --border-medium: #282828;
    --border-strong: #333333;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.70);
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.80);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.85);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.90);
    --shadow-xl: 0 16px 40px rgba(0, 0, 0, 0.95);
    --shadow-brand: 0 4px 20px rgba(140, 80, 255, 0.30);
}


/* =========================================
   RESET
   ========================================= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-main);
    line-height: var(--leading-tight);
}

body, p, input {
    font-family: var(--font-body);
    color: var(--text-muted);
    font-weight: 500;
}

code, pre { font-family: var(--font-code); }
button, a  {
    font-family: var(--font-display);
    font-weight: 600;
    text-decoration: none;
}


/* =========================================
   BODY
   ========================================= */
body {
    background-color: var(--primary-bg);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;

    /* Disable accidental tap selections */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    transform: translateZ(0); /* GPU layer */
}

input, textarea {
    -webkit-user-select: auto;
    user-select: auto;
}


/* =========================================
   PAGE FADE-IN ANIMATION
   ========================================= */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}


/* =========================================
   FLOATING HEADER — Transparent, No BG
   Back btn (standalone pill left) · Title text (right)
   ========================================= */
.settings-floating-header {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: var(--container-md);
    z-index: 200;

    /* Transparent — no background, no border, no shadow */
    background: transparent;
    border: none;

    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    height: 3rem;
    pointer-events: none; /* Let children handle events */
}

/* Back Button — Standalone solid circle (matches style.css .icon-btn.standalone) */
.settings-back-btn {
    pointer-events: auto;
    width: 2.85rem;
    height: 2.85rem;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--surface-0);
    color: var(--text-main);
    font-size: var(--text-base);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base) ease;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.settings-back-btn:hover {
    background: var(--surface-2);
    color: var(--brand-primary);
    border-color: var(--border-medium);
    transform: translateX(-2px);
    box-shadow: var(--shadow-md);
}

/* Settings Title — Solid pill on the right */
.settings-header-title {
    pointer-events: none;
    background: var(--surface-0);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    padding: 0 1.25rem;
    height: 2.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.settings-header-title span {
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-main);
}


/* =========================================
   LAYOUT & CONTAINER
   ========================================= */
.settings-container {
    max-width: var(--container-md);
    margin: 0 auto;
    /* Top padding clears the floating header */
    padding: 6.5rem 1.5rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 2.75rem;
    animation: fadeInUp 0.45s var(--ease-out) both;
}

/* Section Wrapper */
.settings-section {
    display: flex;
    flex-direction: column;
}

/* Section Header Label */
.section-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.section-header i {
    font-size: 1.1rem;
    color: var(--brand-primary);
    flex-shrink: 0;
}

.section-header h2 {
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    color: var(--text-dim);
    margin: 0;
    text-align: left;
}

/* Section Description */
.section-desc {
    text-align: left;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.55;
}


/* =========================================
   SETTINGS PANEL — Solid Surface Card
   Replaces old .glass-panel
   ========================================= */
.settings-panel,
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    /* NO backdrop-filter */
}


/* =========================================
   PROFILE SECTION
   ========================================= */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border-subtle);
}

.avatar-circle {
    width: 4.25rem;
    height: 4.25rem;
    background: linear-gradient(135deg, var(--brand-primary), oklch(35% 0.22 280));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    position: relative;
    flex-shrink: 0;
    box-shadow: var(--shadow-brand);
}

.status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 13px;
    height: 13px;
    background: var(--color-success);
    border: 3px solid var(--bg-panel);
    border-radius: 50%;
}

.profile-info {
    flex: 1;
    text-align: left;
    min-width: 0;
}

.user-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text-main);
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 0.82rem;
    color: var(--text-dim);
    display: block;
    font-family: var(--font-body);
}

.edit-profile-btn {
    padding: 0.55rem 1.1rem;
    background: var(--surface-1);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    color: var(--text-main);
    cursor: pointer;
    transition: all var(--transition-fast) ease;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.edit-profile-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-medium);
}

.edit-profile-btn i { font-size: 0.85rem; }


/* =========================================
   INPUT GRIDS
   ========================================= */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.api-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Input Group */
.input-group label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-display);
    color: var(--text-dim);
    margin-bottom: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    text-align: left;
}

.input-group input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.72rem 1rem;
    color: var(--text-main);
    font-family: var(--font-code);
    font-size: 0.92rem;
    outline: none;
    transition: border-color var(--transition-fast) ease,
                background var(--transition-fast) ease,
                box-shadow var(--transition-fast) ease;
}

.input-group input::placeholder {
    color: var(--text-dim);
    font-family: var(--font-body);
}

.input-group input:focus {
    border-color: var(--brand-primary);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 3px oklch(from var(--brand-primary) l c h / 0.10);
}

.input-group input[readonly] {
    opacity: 0.7;
    cursor: default;
}
.input-group input[readonly]:focus {
    border-color: var(--border-subtle);
    box-shadow: none;
    background: var(--input-bg);
}


/* =========================================
   ACTION ROW & BUTTONS
   ========================================= */
.action-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
}

.save-msg {
    font-size: 0.83rem;
    color: var(--color-success);
    font-family: var(--font-display);
    font-weight: 600;
    opacity: 0;
    transition: opacity var(--transition-base) ease;
}
.save-msg.visible { opacity: 1; }

.primary-action-btn {
    background: var(--brand-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast) ease;
    box-shadow: var(--shadow-brand);
}

.primary-action-btn:hover {
    background: var(--brand-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-brand), var(--shadow-md);
}


/* =========================================
   THEME PICKER — Light + Dark Only
   ========================================= */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.theme-option {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-base) ease;
    position: relative;
    overflow: hidden;
    background: var(--surface-1);
}

.theme-option:hover {
    transform: translateY(-2px);
    background: var(--surface-2);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

.theme-option.active {
    border-color: var(--brand-primary);
    background: var(--brand-surface);
    box-shadow: 0 0 0 3px oklch(from var(--brand-primary) l c h / 0.10),
                var(--shadow-sm);
}

/* Theme Preview Thumbnail */
.theme-preview {
    height: 90px;
    border-radius: var(--radius-sm);
    margin-bottom: 0.85rem;
    position: relative;
    display: flex;
    overflow: hidden;
    padding: 8px;
    gap: 6px;
    border: 1px solid transparent;
}

.mini-sidebar {
    width: 26%;
    height: 100%;
    border-radius: 5px;
    opacity: 0.85;
}

.mini-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
    justify-content: center;
}

.mini-bubble {
    height: 7px;
    width: 72%;
    border-radius: 4px;
}

.mini-bubble.user {
    align-self: flex-end;
    width: 58%;
}

/* ── Light Preview */
.theme-preview.light {
    background: #f3f4f6;
    border-color: #e5e7eb;
}
.theme-preview.light .mini-sidebar { background: #e5e7eb; }
.theme-preview.light .mini-bubble.user { background: oklch(48% 0.18 268); }
.theme-preview.light .mini-bubble.ai  { background: #d1d5db; }

/* ── Dark Preview */
.theme-preview.dark {
    background: #111827;
    border-color: #1f2937;
}
.theme-preview.dark .mini-sidebar { background: #1f2937; }
.theme-preview.dark .mini-bubble.user { background: oklch(68% 0.20 265); }
.theme-preview.dark .mini-bubble.ai  { background: #374151; }

/* Theme Info Row */
.theme-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0.1rem;
}

.theme-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-main);
}

/* Checkmark — shown when active */
.theme-option i {
    font-size: 1rem;
    color: var(--brand-primary);
    opacity: 0;
    transition: opacity var(--transition-fast) ease;
}

.theme-option.active i {
    opacity: 1;
}

.theme-option:hover i {
    opacity: 0.5;
}


/* =========================================
   LEGAL LINKS
   ========================================= */
.settings-link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1rem;
    text-decoration: none;
    color: var(--text-main);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast) ease;
    border: 1px solid transparent;
}

.settings-link-row:hover {
    background: var(--surface-2);
    border-color: var(--border-subtle);
}


/* =========================================
   FOOTER
   ========================================= */
.settings-footer {
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 2rem;
    margin-top: 0.5rem;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-bottom: 0.5rem;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
}

.version-badge {
    font-size: 0.7rem;
    font-family: var(--font-display);
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-pill);
    color: var(--text-dim);
}

.copyright {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.65;
    font-family: var(--font-body);
}


/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 600px) {
    .settings-container {
        padding: 5.75rem 1rem 3.5rem;
        gap: 2.25rem;
    }

    .settings-floating-header {
        width: 95%;
        top: 1rem;
    }

    .settings-panel,
    .glass-panel {
        padding: 1.35rem;
        border-radius: var(--radius-lg);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .profile-info {
        text-align: center;
    }

    .user-name {
        text-align: center;
    }

    .theme-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.85rem;
    }

    .action-row {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .primary-action-btn {
        justify-content: center;
    }

    .settings-header-title span {
        font-size: 0.82rem;
    }
}

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