/* ===========================================
   Gobelino / Cleopatra theme tokens
   Ported from https://github.com/moesaid/cleopatra (MIT), "neutral"
   color theme only. Loaded only by layouts/cleopatra.blade.php, so it
   never affects any page still on the original layout — these variables
   are inert until something references them via Tailwind's arbitrary
   value syntax (e.g. bg-[var(--card)]).

   Dark mode reuses Gobelino's own toggle (<html class="dark">, see
   gobelinoToggleTheme in layouts/app.blade.php) — no separate theme
   switcher needed since :root.dark below already matches it.
   =========================================== */

:root {
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.145 0 0);
    --primary: oklch(0.205 0 0);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.97 0 0);
    --secondary-foreground: oklch(0.205 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.556 0 0);
    --accent: oklch(0.97 0 0);
    --accent-foreground: oklch(0.205 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(0.985 0 0);
    --border: oklch(0.922 0 0);
    --input: oklch(0.922 0 0);
    --ring: oklch(0.708 0 0);
    --sidebar: oklch(0.985 0 0);
    --sidebar-foreground: oklch(0.145 0 0);
    --sidebar-primary: oklch(0.205 0 0);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.97 0 0);
    --sidebar-accent-foreground: oklch(0.205 0 0);
    --sidebar-border: oklch(0.922 0 0);
    --sidebar-ring: oklch(0.708 0 0);

    --success: hsl(142.1 76.2% 36.3%);
    --success-foreground: hsl(355.7 100% 97.3%);
    --warning: hsl(47.9 95.8% 53.1%);
    --warning-foreground: hsl(26 83.3% 14.1%);
    --info: hsl(221.2 83.2% 53.3%);
    --info-foreground: hsl(210 40% 98%);

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --radius-full: 9999px;

    --size-sm: 2rem;
    --size-md: 2.5rem;
}

:root.dark {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.205 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.205 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.922 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.704 0.191 22.216);
    --destructive-foreground: oklch(0.985 0 0);
    --border: oklch(1 0 0 / 10%);
    --input: oklch(1 0 0 / 15%);
    --ring: oklch(0.556 0 0);
    --sidebar: oklch(0.205 0 0);
    --sidebar-foreground: oklch(0.985 0 0);
    --sidebar-primary: oklch(0.488 0.243 264.376);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-accent-foreground: oklch(0.985 0 0);
    --sidebar-border: oklch(1 0 0 / 10%);
    --sidebar-ring: oklch(0.556 0 0);

    --success: hsl(142.1 70.6% 45.3%);
    --success-foreground: hsl(144.9 80.4% 10%);
    --info: hsl(217.2 91.2% 59.8%);
    --info-foreground: hsl(222.2 47.4% 11.2%);
}

.cleopatra-card {
    background-color: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
}

.cleopatra-btn {
    height: var(--size-md);
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 150ms ease-in-out;
}

.cleopatra-btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

.cleopatra-btn-primary:hover {
    opacity: 0.9;
}

/* Sidebar active/hover states — same color-mix approach as upstream Cleopatra. */
.cleopatra-menu-link.active {
    background-color: color-mix(in srgb, var(--primary) 10%, transparent);
    color: var(--primary);
}

.cleopatra-menu-link:hover {
    background-color: var(--sidebar-accent);
}

/* Sitewide click-blocking overlay — see public/js/gobelino-busy.js.
   Invisible/inert until .is-active, then it's the actual click-blocker
   (pointer-events: auto) as well as the visible spinner. */
#gobelino-busy-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 1.5rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 120ms ease-in-out;
}

#gobelino-busy-overlay.is-active {
    pointer-events: auto;
    opacity: 1;
    cursor: progress;
}

.gobelino-spinner {
    width: 28px;
    height: 28px;
    border-radius: 9999px;
    background-color: var(--card);
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    animation: gobelino-spin 0.7s linear infinite;
}

@keyframes gobelino-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .gobelino-spinner {
        animation: none;
    }
}
