/* VersalAI — Global styles */

/* ══ Light theme overrides ══ */
:root[data-theme="light"] {
    --color-dark:      #f8fafc;
    --color-surface-0: #f8fafc;
    --color-surface-1: #ffffff;
    --color-surface-2: #f1f5f9;
    --color-surface-3: #e2e8f0;
    --color-surface-4: #cbd5e1;

    --color-txt:       #0f172a;
    --color-txt-2:     #334155;
    --color-txt-3:     #64748b;
    --color-txt-muted: #94a3b8;
    --color-txt-faint: #cbd5e1;

    --color-accent:       #4f46e5;
    --color-accent-hover: #4338ca;

    --color-brd:   rgb(0 0 0 / 0.08);
    --color-brd-2: rgb(0 0 0 / 0.12);
}

/* ── Theme transition ── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.3s ease, color 0.2s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
    transition-delay: 0s !important;
}

/* ── Blazor error boundary ── */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem 1rem 1rem 1.5rem;
    color: white;
    border-radius: 0.5rem;
    margin: 1rem;
}

.blazor-error-boundary::after {
    content: "Ha ocurrido un error inesperado.";
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fef3c7;
    border-top: 2px solid #f59e0b;
    bottom: 0;
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ── Animations ── */

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out both;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }

/* Skeleton shimmer loading */
.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--color-surface-3);
    border-radius: 0.5rem;
}

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, var(--color-brd-2), transparent);
    animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* Subtle glow pulse for brand elements */
.glow-brand {
    box-shadow: 0 0 20px rgba(99,102,241,0.15), 0 0 60px rgba(99,102,241,0.05);
}

/* Toast slide animations */
.toast-enter { animation: toastIn 0.3s ease-out; }
.toast-exit  { animation: toastOut 0.2s ease-in forwards; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(24px); }
}

/* Gradient mesh background for hero sections */
.gradient-mesh {
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(99,102,241,0.08) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(129,140,248,0.05) 0%, transparent 70%),
        radial-gradient(ellipse 50% 80% at 50% 90%, rgba(79,70,229,0.04) 0%, transparent 70%);
}

:root[data-theme="light"] .gradient-mesh {
    background:
        radial-gradient(ellipse 80% 60% at 20% 40%, rgba(99,102,241,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgba(129,140,248,0.04) 0%, transparent 70%),
        radial-gradient(ellipse 50% 80% at 50% 90%, rgba(79,70,229,0.03) 0%, transparent 70%);
}

/* Noise texture overlay for depth */
.noise-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    pointer-events: none;
    z-index: 1;
}

/* Hide action buttons during export capture and printing */
.versal-exporting [data-no-print] { display: none !important; }

@media print {
    [data-no-print] { display: none !important; }
}

/* ── Shadow system ── */
.shadow-soft {
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.06);
}

.shadow-elevated {
    box-shadow: 0 4px 6px rgba(0,0,0,0.04), 0 10px 30px rgba(0,0,0,0.08);
}

:root[data-theme="light"] .shadow-soft {
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}

:root[data-theme="light"] .shadow-elevated {
    box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 12px 40px rgba(0,0,0,0.06);
}

/* Glass card hover effect */
.glass-card {
    background: var(--color-brd);
    border: 1px solid var(--color-brd);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.glass-card:hover {
    background: var(--color-brd-2);
    border-color: rgba(99,102,241,0.2);
    box-shadow: 0 8px 32px rgba(0,0,0,0.15), 0 0 0 1px rgba(99,102,241,0.1);
    transform: translateY(-2px);
}

:root[data-theme="light"] .glass-card {
    background: var(--color-surface-1);
    border-color: var(--color-brd-2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

:root[data-theme="light"] .glass-card:hover {
    background: var(--color-surface-1);
    border-color: rgba(99,102,241,0.3);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08), 0 0 0 1px rgba(99,102,241,0.15);
}

/* Grid pattern adapts to theme */
:root[data-theme="light"] .grid-pattern {
    opacity: 0.04;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* ── Focus-visible global ── */
:focus-visible {
    outline: 2px solid rgba(99,102,241,0.5);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Button press feedback ── */
button,
a[role="button"],
[class*="bg-brand-"],
a[href][class*="rounded"] {
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, opacity 0.15s ease;
}

button[class*="bg-brand"],
a[class*="bg-brand"][class*="rounded"] {
    position: relative;
}

button[class*="bg-brand"]:active,
a[class*="bg-brand"][class*="rounded"]:active {
    transform: scale(0.96) !important;
    box-shadow: none !important;
    opacity: 0.85;
}

button:not([class*="bg-brand"]):active {
    transform: scale(0.95);
    opacity: 0.7;
}

.glass-card:active {
    transform: translateY(0) scale(0.98) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2) !important;
}

/* ── Prose adaptive (dark/light) ── */
:root[data-theme="light"] .prose-adaptive {
    --tw-prose-headings: #0f172a;
    --tw-prose-body: #334155;
    --tw-prose-bold: #1e293b;
    --tw-prose-links: #4f46e5;
    --tw-prose-counters: #64748b;
    --tw-prose-bullets: #4f46e5;
    --tw-prose-code: #4338ca;
    --tw-prose-pre-bg: #f1f5f9;
    --tw-prose-pre-code: #334155;
}
