/* shadcn/BlazorBlueprint theme variables, mapped onto the existing Atlantis
 * Zion (light) / Batman (dark) palettes from admin-theme.css. Both selectors
 * (data-theme=... and .dark) are emitted so existing data-theme switches
 * continue to work AND BlazorBlueprint's dark: utility classes activate
 * inside the dark theme.
 */

:root,
:root[data-theme="zion"] {
    /* shadcn surface tokens */
    --background: #f6f1e7;
    --foreground: #2a2418;
    --card: #fffaf0;
    --card-foreground: #2a2418;
    --popover: #fffaf0;
    --popover-foreground: #2a2418;

    /* shadcn brand tokens (note: shadcn's "accent" is the subtle hover bg,
     * the brand color lives in "primary") */
    --primary: #047857;
    --primary-foreground: #ffffff;
    --secondary: #efe7d6;
    --secondary-foreground: #2a2418;
    --muted: #efe7d6;
    --muted-foreground: #8c8369;
    --accent: #d1fae5;
    --accent-foreground: #047857;

    /* status */
    --destructive: #dc2626;
    --destructive-foreground: #ffffff;

    /* lines / focus */
    --border: #e0d5be;
    --input: #e0d5be;
    --ring: #04785759;

    /* shape */
    --radius: 0.5rem;

    /* alert variants used by BbAlert */
    --alert-success: #16a34a;
    --alert-success-foreground: #14532d;
    --alert-success-bg: #dcfce7;
    --alert-warning: #ca8a04;
    --alert-warning-foreground: #713f12;
    --alert-warning-bg: #fef9c3;
    --alert-info: #0284c7;
    --alert-info-foreground: #0c4a6e;
    --alert-info-bg: #dbeafe;
    --alert-danger: #dc2626;
    --alert-danger-foreground: #7f1d1d;
    --alert-danger-bg: #fee2e2;

    /* sidebar (BbSidebar) — match our existing surfaces */
    --sidebar: #fffaf0;
    --sidebar-foreground: #2a2418;
    --sidebar-primary: #047857;
    --sidebar-primary-foreground: #ffffff;
    --sidebar-accent: #efe7d6;
    --sidebar-accent-foreground: #2a2418;
    --sidebar-border: #e0d5be;
    --sidebar-ring: #04785759;

    /* charts — distinct categorical palette tuned for the cream surface */
    --chart-1: #047857;
    --chart-2: #0284c7;
    --chart-3: #ca8a04;
    --chart-4: #dc2626;
    --chart-5: #7c3aed;
}

.dark,
:root[data-theme="batman"] {
    --background: #0a0a0c;
    --foreground: #e6e4dd;
    --card: #111114;
    --card-foreground: #e6e4dd;
    --popover: #111114;
    --popover-foreground: #e6e4dd;

    --primary: #f4c100;
    --primary-foreground: #0a0a0c;
    --secondary: #17171c;
    --secondary-foreground: #e6e4dd;
    --muted: #17171c;
    --muted-foreground: #6b6960;
    --accent: rgba(244, 193, 0, 0.12);
    --accent-foreground: #f4c100;

    --destructive: #f87171;
    --destructive-foreground: #0a0a0c;

    --border: rgba(255, 255, 255, 0.06);
    --input: rgba(255, 255, 255, 0.14);
    --ring: rgba(244, 193, 0, 0.45);

    --radius: 0.5rem;

    --alert-success: #4ade80;
    --alert-success-foreground: #bbf7d0;
    --alert-success-bg: rgba(74, 222, 128, 0.10);
    --alert-warning: #fbbf24;
    --alert-warning-foreground: #fde68a;
    --alert-warning-bg: rgba(251, 191, 36, 0.10);
    --alert-info: #60a5fa;
    --alert-info-foreground: #bfdbfe;
    --alert-info-bg: rgba(96, 165, 250, 0.10);
    --alert-danger: #f87171;
    --alert-danger-foreground: #fecaca;
    --alert-danger-bg: rgba(248, 113, 113, 0.10);

    --sidebar: #111114;
    --sidebar-foreground: #e6e4dd;
    --sidebar-primary: #f4c100;
    --sidebar-primary-foreground: #0a0a0c;
    --sidebar-accent: #17171c;
    --sidebar-accent-foreground: #e6e4dd;
    --sidebar-border: rgba(255, 255, 255, 0.06);
    --sidebar-ring: rgba(244, 193, 0, 0.45);

    --chart-1: #f4c100;
    --chart-2: #60a5fa;
    --chart-3: #4ade80;
    --chart-4: #f87171;
    --chart-5: #c084fc;
}

/* Atlantis modal — native <dialog> styling. Browser handles centering
 * via UA `inset: 0; margin: auto` once the dialog enters the top layer.
 * Open animation runs via @keyframes (universal browser support, no
 * @starting-style / allow-discrete dependency) so the dialog never
 * pops in instantly. */
@keyframes atlantis-dialog-in {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
@keyframes atlantis-backdrop-in {
    from {
        background-color: rgba(0, 0, 0, 0);
        backdrop-filter: blur(0);
    }
    to {
        background-color: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
    }
}
.atlantis-dialog {
    color: var(--card-foreground);
    padding: 0;
    max-width: 92vw;
    max-height: 88vh;
    margin: auto;
    border: 0;
    background: transparent;
    overflow: visible;
}
.atlantis-dialog[open] {
    animation: atlantis-dialog-in var(--motion-slow) var(--ease-out) both;
}
.atlantis-dialog::backdrop {
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}
.atlantis-dialog[open]::backdrop {
    animation: atlantis-backdrop-in var(--motion-slow) var(--ease-out) both;
}
.atlantis-dialog.dialog--sm { max-width: 22rem; }
.atlantis-dialog.dialog--md { max-width: 32rem; }
.atlantis-dialog.dialog--lg { max-width: 48rem; }
.atlantis-dialog.dialog--xl { max-width: 64rem; }

.atlantis-dialog .dialog-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 88vh;
    min-height: 0;
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 0.5rem;
    box-shadow: 0 10px 38px rgba(0,0,0,.18), 0 2px 10px rgba(0,0,0,.10);
    overflow: hidden;
}

/* ATS-2638: thin stripe shown across the top of a modal that has unsaved
 * changes. Pairs with .dialog-dirty-hint below to explain why backdrop-click
 * does not dismiss. */
.atlantis-dialog .dialog-dirty-stripe {
    height: 6px;
    background: linear-gradient(90deg, var(--accent), var(--warning, #f59e0b));
    flex-shrink: 0;
}

.atlantis-dialog .dialog-dirty-hint {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.55);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    pointer-events: none;
}
.atlantis-dialog .dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.25rem 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.atlantis-dialog .dialog-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}
.atlantis-dialog .dialog-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.75rem;
    width: 1.75rem;
    border-radius: 0.375rem;
    background: transparent;
    border: 0;
    color: var(--muted-foreground);
    cursor: pointer;
    transition:
        background-color var(--motion-base) var(--ease-out),
        color var(--motion-base) var(--ease-out);
}
.atlantis-dialog .dialog-close:hover {
    background: var(--muted);
    color: var(--foreground);
}
.atlantis-dialog .dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}
