/* ════════════════════════════════════════════════════════════════════════════
   Cara — Daat'System Brand Layer
   ────────────────────────────────────────────────────────────────────────────
   Version : palette Cara officielle (#0052FF / #66FCF1 / #45A29E / #0B0C10
   / #F8F9FA / #333F50) + patte Daat'System (typo, géométrie, monogramme).

   Charge ce fichier APRÈS style.css pour gagner la cascade.
   Pour désactiver : commenter <link> dans index.html.
   ════════════════════════════════════════════════════════════════════════════ */

/* ───────────── Fondations : palette Cara + tokens (light) ───────────── */
:root {
    /* Brand Cara — palette officielle */
    --ds-blue:      #0052FF;   /* primary blue */
    --ds-cyan:      #66FCF1;   /* bright cyan */
    --ds-ink:       #0B0C10;   /* dark background */
    --ds-fog:       #F8F9FA;   /* light contrast */
    --ds-teal:      #45A29E;   /* teal */
    --ds-slate:     #333F50;   /* dark gray */
    --ds-blue-hi:   #1F66FF;
    --ds-blue-deep: #003FC9;

    /* Surfaces (override style.css) */
    --bg-main: var(--ds-fog);
    --bg-sidebar: rgba(255, 255, 255, 0.86);
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #EEF4FB;
    --bg-input: #FFFFFF;
    --bg-user-msg: linear-gradient(135deg, rgba(0, 82, 255, 0.92), rgba(31, 102, 255, 0.88));
    --bg-ai-msg: transparent;
    --bg-code: #F2F6FB;
    --bg-file-card: #F4F8FC;
    --bg-mission-log: #F0F7FA;
    --bg-dropzone: rgba(102, 252, 241, 0.16);

    /* Text */
    --text-primary: var(--ds-ink);
    --text-secondary: var(--ds-slate);
    --text-tertiary: #6D7A8D;

    /* Borders — bleutées comme l'original */
    --border: rgba(0, 82, 255, 0.18);
    --border-light: rgba(0, 82, 255, 0.08);
    --border-strong: rgba(0, 82, 255, 0.40);

    /* Accents */
    --accent: var(--ds-blue);
    --accent-hover: var(--ds-blue-deep);
    --accent-soft: rgba(102, 252, 241, 0.30);
    --soft-text: #123E78;

    /* Status */
    --success: var(--ds-teal);
    --warning: #F2A93B;
    --error:   #E0445C;
    --info:    var(--ds-blue);

    /* Elevation — flat, bordures + glow Cara */
    --shadow-xs: 0 1px 0 rgba(11, 12, 16, 0.04);
    --shadow-sm: 0 1px 2px rgba(11, 12, 16, 0.06), 0 1px 0 rgba(0, 82, 255, 0.05);
    --shadow-md: 0 6px 16px rgba(11, 12, 16, 0.08), 0 1px 0 rgba(0, 82, 255, 0.06);
    --shadow-lg: 0 18px 40px rgba(11, 12, 16, 0.12), 0 2px 0 rgba(0, 82, 255, 0.06);
    --shadow-glow: 0 0 0 3px rgba(0, 82, 255, 0.14);

    /* Géométrie resserrée — patte Daat'System */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Typo stack — patte Daat'System (alias des familles DAATSystem) */
    --font-ui: 'DAATSystem Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', system-ui, sans-serif;
    --font-mono: 'DAATSystem Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    --font-display: 'DAATSystem Display', 'DAATSystem Sans', -apple-system, system-ui, sans-serif;

    /* Daat'System brand vars */
    --ds-mark-bg: var(--ds-ink);
    --ds-mark-fg: var(--ds-fog);
}

/* Dark theme retiré — DAAT est light-only. Voir css/index.css. */

/* ───────────── Body : police + gradients Cara ───────────── */
body {
    font-family: var(--font-ui);
    font-feature-settings: 'cv11', 'ss01', 'ss03';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background:
        radial-gradient(circle at 15% 20%, rgba(0, 82, 255, 0.12), transparent 26%),
        radial-gradient(circle at 80% 12%, rgba(102, 252, 241, 0.14), transparent 24%),
        linear-gradient(180deg, #F7FAFD 0%, #EEF4F9 100%) !important;
    color: var(--text-primary);
}
/* ───────────── Sidebar : Cara prend la lumière ───────────── */
.sidebar {
    backdrop-filter: blur(18px) saturate(1.05);
    border-right: 1px solid var(--border);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand .cara-mark { flex-shrink: 0; border-radius: 7px; }
.brand .brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.025em;
    line-height: 1;
    color: var(--text-primary);
}

/* Copyright discret en bas de sidebar */
.sidebar-footer { gap: 10px; padding-bottom: 14px; }
.ds-copy {
    padding: 8px 4px 0;
    color: var(--text-tertiary);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
    opacity: 0.7;
}

/* Monogramme D'S */
.ds-mark { display: inline-block; vertical-align: middle; }
.ds-mark .ds-mark-bg { fill: var(--ds-mark-bg); }
.ds-mark .ds-mark-fg { fill: var(--ds-mark-fg); }
.ds-mark .ds-mark-accent { fill: var(--ds-cyan); }

/* ───────────── Topbar ───────────── */
.topbar {
    border-bottom: 1px solid var(--border);
    background: rgba(248, 249, 250, 0.78);
    backdrop-filter: blur(14px);
}
.topbar-title {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.015em;
}

/* ───────────── Welcome — édito posé ───────────── */
.welcome { padding-top: 8vh; }
.welcome h1 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    letter-spacing: -0.035em;
    line-height: 1.1;
    color: var(--text-primary);
    max-width: 22ch;
}
.welcome p {
    font-family: var(--font-ui);
    color: var(--text-secondary);
    max-width: 56ch;
    line-height: 1.55;
    font-size: 0.98rem;
}

.quick-actions { gap: 8px; margin-top: 28px; }
.quick-action {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.quick-action:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--soft-text);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ───────────── New chat button ───────────── */
.new-chat-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-ui);
    font-weight: 500;
    color: var(--text-primary);
    transition: border-color 0.15s ease, background 0.15s ease;
    box-shadow: var(--shadow-xs);
}
.new-chat-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--soft-text);
}

/* ───────────── Historique ───────────── */
.history-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}
.history-item {
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: background 0.12s ease, color 0.12s ease;
}
.history-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}
.history-item.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: 500;
    border: 1px solid var(--border-strong);
}

/* ───────────── Input area ───────────── */
.input-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-box:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}
#msgInput {
    font-family: var(--font-ui);
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}
#msgInput::placeholder { color: var(--text-tertiary); font-style: normal; }

.send-btn {
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-blue-hi));
    color: white;
    border-radius: var(--radius-md);
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 82, 255, 0.25);
}
.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 82, 255, 0.35);
}

.disclaimer {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin-top: 10px;
}

/* ───────────── Messages ───────────── */
.msg.user .msg-content {
    background: var(--bg-user-msg);
    color: white;
    border-radius: var(--radius-md);
    border: none;
    font-family: var(--font-ui);
    line-height: 1.5;
}
.msg.assistant .msg-content {
    font-family: var(--font-ui);
    line-height: 1.6;
    color: var(--text-primary);
}

/* ───────────── Code blocks ───────────── */
pre, code, .code, kbd { font-family: var(--font-mono); }
pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.55;
}

/* ───────────── Mission status — pill mono ───────────── */
.topbar-mission-status {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}
.mission-stop-btn {
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: var(--error);
    color: white;
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    border: none;
}

/* ───────────── Buttons account / auth ───────────── */
.account-action,
.auth-submit,
.account-submit,
.account-quick-action {
    font-family: var(--font-ui);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    letter-spacing: -0.005em;
}
.auth-submit, .account-submit {
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-blue-hi));
    color: white;
    border: 1px solid var(--ds-blue);
    box-shadow: 0 2px 8px rgba(0, 82, 255, 0.20);
}
.auth-submit:hover, .account-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 82, 255, 0.30);
}
.account-action.secondary,
.secondary-submit,
.account-quick-action {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.account-action.secondary:hover,
.secondary-submit:hover,
.account-quick-action:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--soft-text);
}

/* ───────────── Account cards ───────────── */
.account-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
}
.account-card-highlight {
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-teal));
    color: white;
    border-color: transparent;
}
.account-card-highlight .account-card-label,
.account-card-highlight p { color: rgba(255, 255, 255, 0.8); }

.account-card-label,
.account-page-eyebrow,
.auth-eyebrow {
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.account-page-eyebrow {
    background: var(--accent-soft);
    color: var(--soft-text);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

.account-hero {
    background: linear-gradient(135deg, var(--bg-surface), var(--accent-soft));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.account-hero h1 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

/* ───────────── Auth gate ───────────── */
.auth-gate {
    background: rgba(11, 12, 16, 0.42);
    backdrop-filter: blur(8px);
}
.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.auth-tabs { border: 1px solid var(--border); border-radius: var(--radius-md); }
.auth-tab {
    font-family: var(--font-ui);
    font-weight: 500;
    border-radius: var(--radius-sm);
}
.auth-tab.active {
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-blue-hi));
    color: white;
}
.auth-field input,
.auth-field textarea,
.auth-field select {
    font-family: var(--font-ui);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-field input:focus,
.auth-field textarea:focus,
.auth-field select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: var(--shadow-glow);
}

/* ───────────── Status dot ───────────── */
.status-dot.disconnected { background: var(--error); }
.status-dot.connected { background: var(--ds-teal); }

/* ───────────── Theme toggle ───────────── */
.theme-toggle {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 6px 10px;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.version-tag {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ───────────── Account section tabs ───────────── */
.account-section-tab {
    font-family: var(--font-ui);
    font-weight: 500;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.account-section-tab:hover {
    color: var(--soft-text);
    background: var(--accent-soft);
}
.account-section-tab.active {
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-blue-hi));
    color: white;
}

/* ───────────── Abonnements (cards + grid) ───────────── */
.account-plans-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}
@media (max-width: 1100px) { .account-plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .account-plans-grid { grid-template-columns: minmax(0, 1fr); } }
.account-plan-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    min-height: 360px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.account-plan-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.account-plan-featured {
    border-color: var(--ds-cyan);
    background: linear-gradient(180deg, rgba(102, 252, 241, 0.10), var(--bg-surface));
    box-shadow: var(--shadow-md);
}
.account-plan-badge {
    width: fit-content;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--soft-text);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
}
.account-plan-featured .account-plan-badge {
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-blue-hi));
    color: white;
    border-color: transparent;
}
.account-plan-card h4 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.025em;
    font-size: 1.4rem;
    margin-top: 8px;
}
.account-plan-price {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}
.account-plan-price span {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 500;
}
.account-plan-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}
.account-plan-card ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 0.86rem;
    line-height: 1.5;
}
.account-plan-card button {
    margin-top: auto;
    font-family: var(--font-ui);
    font-weight: 500;
    background: linear-gradient(135deg, var(--ds-blue), var(--ds-blue-hi));
    color: white;
    border: 1px solid var(--ds-blue);
    border-radius: var(--radius-md);
    padding: 11px 14px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 82, 255, 0.18);
}
.account-plan-card button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 82, 255, 0.28);
}
.account-plan-card button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* État : abonnement actif */
.account-plan-card.active {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}
.account-plan-card.active::after {
    content: attr(data-active-text);
    position: absolute;
    top: 12px; right: 12px;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--ds-teal);
    color: white;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
}

/* ───────────── Scrollbars ───────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: var(--ds-blue); color: white; }

/* ───────────── Drop overlay ───────────── */
.dropzone-overlay {
    background: rgba(11, 12, 16, 0.75);
    backdrop-filter: blur(6px);
}
.drop-text {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
}
.drop-hint {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
