/* Design tokens for the AiCommunity UI restyle. Loaded after bootstrap.min.css and before the
   existing app.css in both host pages, so these custom properties and Bootstrap remaps are
   available to every rule app.css defines afterward.

   --brand/--brand-hover/--brand-tint default to this app's existing maroon baseline (matching
   app.css's own long-standing --brand-primary default) rather than the arbitrary example color
   from the design brief, so loading this file alone doesn't silently recolor the whole app.
   MainLayout.razor overrides --brand/--brand-hover/--brand-tint (and the legacy
   --brand-primary/-dark/-darker aliases below, kept for pages not yet migrated to the new names)
   at runtime per-community, same as it already does today. */
:root {
    /* brand (overridden at runtime by MainLayout.razor from Branding Settings) */
    --brand: #8b1a1a;
    --brand-hover: #6e1414;
    --brand-tint: #f5e6e6;
    --on-brand: #ffffff;

    /* legacy aliases — existing app.css rules not yet migrated to the tokens above still work
       unchanged; remove once every page has moved to --brand/--brand-hover. */
    --brand-primary: var(--brand);
    --brand-primary-dark: var(--brand-hover);
    --brand-primary-darker: #5a1010;

    /* neutrals */
    --bg: #faf7f3;
    --surface: #ffffff;
    --surface-2: #f1ebe5;
    --line: #ece5dd;
    --line-strong: #e2d9d0;
    --ink: #1c1917;
    --ink-2: #57534e;
    --ink-3: #6b635d;

    /* status (bg / text) */
    --success: #15803d;
    --success-bg: #e8f5ec;
    --success-ink: #166534;
    --warning: #b45309;
    --warning-bg: #fef3e2;
    --warning-ink: #92400e;
    --danger: #b91c1c;
    --danger-bg: #fdecec;
    --danger-ink: #991b1b;
    --neutral-bg: #f1eeea;
    --neutral-ink: #44403c;
    --premium-bg: #fdf3dc;
    --premium-ink: #7a4e0e;

    /* type */
    --font: 'Plus Jakarta Sans', system-ui, sans-serif;
    --fs-base: 15px;
    --fs-display: calc(var(--fs-base) * 1.867);
    --fs-title: calc(var(--fs-base) * 1.6);
    --fs-h2: calc(var(--fs-base) * 1.2);
    --fs-name: calc(var(--fs-base) * 1.133);
    --fs-meta: calc(var(--fs-base) * 0.867);
    --fs-overline: calc(var(--fs-base) * 0.8);

    /* shape */
    --r-chip: 999px;
    --r-input: 14px;
    --r-btn: 14px;
    --r-card: 20px;
    --shadow-card: 0 1px 2px rgba(28, 25, 23, .06), 0 6px 16px rgba(28, 25, 23, .04);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Bootstrap remap — existing Bootstrap classes (.btn-primary, .form-control, etc.) read
       these instead of Bootstrap's own blue defaults. --bs-primary-rgb is kept in sync with
       --brand by MainLayout.razor's runtime override (fixes a prior bug where it stayed pinned
       to the default maroon's RGB regardless of a community's custom color). */
    --bs-primary: var(--brand);
    --bs-primary-rgb: 139, 26, 26;
}

/* User theme options (Settings → Appearance). "community" (the default, no attribute) uses the
   runtime --brand set above/by MainLayout.razor — it is deliberately not listed here. */
[data-theme="maroon"] { --brand: #8b1a1a; --brand-hover: #6e1414; --brand-tint: #f5e6e6; }
[data-theme="blue"] { --brand: #1e40af; --brand-hover: #1e3a8a; --brand-tint: #e6ecfa; }
[data-theme="green"] { --brand: #166534; --brand-hover: #14532d; --brand-tint: #e5f3ea; }
[data-theme="saffron"] { --brand: #b45309; --brand-hover: #92400e; --brand-tint: #fdf0e1; }
[data-theme="plum"] { --brand: #6b21a8; --brand-hover: #581c87; --brand-tint: #f1e8f8; }

/* User text size */
[data-text-size="small"] { --fs-base: 14px; }
[data-text-size="large"] { --fs-base: 17px; }
[data-text-size="xl"] { --fs-base: 19px; }

/* User font */
[data-font="inter"] { --font: 'Inter', system-ui, sans-serif; }
[data-font="noto"] { --font: 'Noto Sans', 'Noto Sans Devanagari', system-ui, sans-serif; }
[data-font="poppins"] { --font: 'Poppins', system-ui, sans-serif; }

/* Dark mode */
[data-mode="dark"] {
    --bg: #0f0d0c;
    --surface: #1c1917;
    --surface-2: #292524;
    --line: #3a3431;
    --line-strong: #44403c;
    --ink: #f5f5f4;
    --ink-2: #d6d3d1;
    --ink-3: #a8a29e;
    --brand-tint: rgba(255, 255, 255, .08);
    --neutral-bg: #292524;
    --neutral-ink: #d6d3d1;
}

body {
    font-family: var(--font);
    font-size: var(--fs-base);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

/* Bootstrap component remaps */
.btn-primary {
    background-color: var(--brand);
    border-color: var(--brand);
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: var(--brand-hover);
    border-color: var(--brand-hover);
}

.btn-outline-primary {
    color: var(--brand);
    border-color: var(--brand);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-control,
.form-select {
    border-radius: var(--r-input);
    border-color: var(--line-strong);
    background-color: var(--surface);
    color: var(--ink);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-tint);
}

.badge.bg-primary {
    background-color: var(--brand) !important;
}

.card {
    border-color: var(--line);
    background-color: var(--surface);
    color: var(--ink);
}

.nav-tabs {
    border-bottom-color: var(--line);
}

.nav-tabs .nav-link.active {
    color: var(--brand);
    border-color: var(--line) var(--line) var(--surface);
}
