/* ============================================================================
   Liggy — Tokens + Animations + Login + Superadmin
   ============================================================================
   Reduzido ao essencial. Toda UI (btn, card, form, modal, table, badge, etc.)
   vem de Tailwind utilities + shadcn cotton components.
   Veja: apps/dashboard/tailwind/input.css (@theme + @layer components shims).
   ============================================================================ */

/* ============================================================================
   :root TOKENS — referenced by input.css @theme inline
   ============================================================================ */

:root,
:root[data-theme="light"],
html[data-theme="light"] {
    /* Primary: Liggy Blue */
    --primary-50: hsl(228, 92%, 95%);
    --primary-100: hsl(228, 92%, 90%);
    --primary-200: hsl(228, 92%, 80%);
    --primary-300: hsl(228, 92%, 65%);
    --primary-500: hsl(228, 92%, 50%);
    --primary-600: hsl(228, 92%, 35%);
    --primary-700: hsl(228, 92%, 28%);
    --primary-800: hsl(228, 92%, 21%);
    --primary-900: hsl(228, 92%, 15%);

    --color-primary: var(--primary-800);
    --color-primary-hover: var(--primary-700);
    --color-primary-active: var(--primary-900);
    --color-primary-fg: #ffffff;

    /* Secondary: Coral */
    --secondary-50: #fff5f0;
    --secondary-500: #ff8c61;
    --secondary-600: #ff7951;
    --secondary-700: #f86540;

    /* Neutral */
    --gray-50: #fafbfc;
    --gray-100: #f5f6f8;
    --gray-200: #e9ebee;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Status */
    --success-50: #f0fdf4;
    --success-500: #22c55e;
    --success-700: #15803d;
    --danger-50: #fef2f2;
    --danger-500: #ef4444;
    --danger-700: #b91c1c;
    --warning-50: #fffbeb;
    --warning-500: #f59e0b;
    --warning-700: #b45309;

    /* Semantic surfaces */
    --bg-base: #ffffff;
    --bg-surface: var(--gray-50);
    --bg-elevated: #ffffff;
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --border-light: var(--gray-200);
    --border-medium: var(--gray-300);

    /* Chat (legacy, candidato detail) */
    --chat-user-bg: var(--primary-50);
    --chat-user-border: var(--primary-200);
    --chat-user-accent: var(--primary-600);
    --chat-bot-bg: var(--gray-100);
    --chat-bot-border: var(--gray-300);
    --chat-bot-accent: var(--gray-500);

    /* Shadows multi-layer (Stripe/shadcn) */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04), 0 1px 3px 0 rgb(0 0 0 / 0.06);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.06), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.12);

    /* Motion */
    --motion-fast: 120ms;
    --motion-base: 180ms;
    --motion-slow: 260ms;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Typography */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
}

:root[data-theme="dark"],
html[data-theme="dark"] {
    --primary-50: hsl(228, 50%, 15%);
    --primary-100: hsl(228, 50%, 20%);
    --primary-200: hsl(228, 50%, 25%);
    --primary-300: hsl(228, 92%, 65%);
    --primary-500: hsl(228, 92%, 50%);
    --primary-600: hsl(228, 92%, 60%);
    --primary-700: hsl(228, 92%, 70%);
    --primary-800: hsl(228, 92%, 80%);
    --primary-900: hsl(228, 92%, 85%);

    --color-primary: var(--primary-500);
    --color-primary-hover: var(--primary-600);
    --color-primary-active: var(--primary-700);
    --color-primary-fg: #0a0a0a;

    --secondary-50: #3d2519;
    --secondary-500: #ff8c61;
    --secondary-600: #ff9f78;
    --secondary-700: #ffb38f;

    --gray-50: #2a2f37;
    --gray-100: #3a3f47;
    --gray-200: #4a4f57;
    --gray-300: #5a5f67;
    --gray-400: #9ca3af;
    --gray-500: #b0b0b0;
    --gray-600: #c0c0c0;
    --gray-700: #d0d0d0;
    --gray-800: #e0e0e0;
    --gray-900: #f0f0f0;

    --success-50: #1e4620;
    --success-500: #4ade80;
    --success-700: #22c55e;
    --danger-50: #5c1f1f;
    --danger-500: #f87171;
    --danger-700: #ef4444;
    --warning-50: #5c4a1f;
    --warning-500: #fbbf24;
    --warning-700: #f59e0b;

    --bg-base: #1a1d23;
    --bg-surface: var(--gray-50);
    --bg-elevated: #22252b;
    --text-primary: #e8e8e8;
    --text-secondary: var(--gray-600);
    --text-tertiary: var(--gray-500);
    --border-light: var(--gray-200);
    --border-medium: var(--gray-300);

    --chat-user-bg: var(--primary-100);
    --chat-user-border: var(--primary-300);
    --chat-user-accent: var(--primary-500);
    --chat-bot-bg: var(--gray-100);
    --chat-bot-border: var(--gray-200);
    --chat-bot-accent: var(--gray-400);

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3), 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.6);
}

/* ============================================================================
   ANIMATIONS — used by HTMX loading states + login transitions
   ============================================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.fade-in { animation: fadeIn 0.3s ease-out; }
.slide-up { animation: slideUp 0.4s ease-out; }

.spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary-600);
    border-radius: 9999px;
    animation: spin 0.8s linear infinite;
}

/* ============================================================================
   LOGIN PAGE — separate visual flow (until rewritten as cotton)
   ============================================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--radius-2xl);
    padding: var(--space-12);
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-logo h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-800);
    margin-bottom: var(--space-2);
}

.login-logo p {
    color: var(--text-secondary);
}

.error-message {
    background: var(--danger-50);
    color: var(--danger-700);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    border: 1px solid var(--danger-500);
}

/* ============================================================================
   SUPERADMIN security indicator
   ============================================================================ */

.superadmin-only {
    border: 2px solid #fbbf24 !important;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
    position: relative;
}

.superadmin-only:hover {
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.6);
}

.superadmin-icon {
    color: #fbbf24;
    margin-right: 0.25rem;
}

/* ============================================================================
   LIGGY IDENTITY — Liquid Glass + Mesh Gradients + Visual Brand
   ============================================================================ */

/* Mesh gradient background for auth/hero pages */
.liggy-mesh-bg {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(67, 111, 245, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 140, 97, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(5, 29, 127, 0.12) 0%, transparent 45%),
        linear-gradient(to bottom right, #020B33, #041566, #020F47);
    position: relative;
    overflow: hidden;
}

/* WebGL canvas background — lazy-loaded via JS */
.liggy-webgl-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* Noise texture overlay */
.liggy-noise::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.03;
    pointer-events: none;
    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.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Glass card effect */
.liggy-glass-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow:
        0 8px 32px rgba(4, 21, 102, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Feature card glass variant */
.liggy-feature-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(4, 21, 102, 0.06);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.liggy-feature-glass:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 140, 97, 0.3);
    box-shadow:
        0 12px 40px rgba(4, 21, 102, 0.1),
        0 4px 12px rgba(255, 140, 97, 0.08);
    transform: translateY(-4px);
}

/* Feature card icon glow on hover */
.liggy-feature-glass:hover .liggy-icon-glow {
    filter: drop-shadow(0 0 8px currentColor);
    transform: scale(1.05);
    transition: all 0.3s ease;
}

.liggy-icon-glow {
    transition: all 0.3s ease;
}

/* Slow ambient glow shift on hero visual */
@keyframes liggy-glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* Hero visual composition */
.liggy-hero-visual {
    position: relative;
    width: 100%;
    max-width: 520px;
    aspect-ratio: 5/4;
    border-radius: 1.5rem;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(67, 111, 245, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(255, 140, 97, 0.12) 0%, transparent 40%),
        linear-gradient(135deg, #041566 0%, #051D7F 50%, #020F47 100%);
    box-shadow:
        0 20px 60px rgba(4, 21, 102, 0.25),
        0 8px 24px rgba(0, 0, 0, 0.15);
}

.liggy-hero-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 140, 97, 0.08) 0%, transparent 30%);
    animation: liggy-glow 8s ease-in-out infinite;
}

/* Glass mockup card inside hero */
.liggy-hero-mockup {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* Connection nodes SVG animation */
@keyframes liggy-pulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.liggy-node {
    animation: liggy-pulse 3s ease-in-out infinite;
}

.liggy-node:nth-child(2) { animation-delay: -1s; }
.liggy-node:nth-child(3) { animation-delay: -2s; }

/* Landing section subtle mesh background */
.liggy-section-mesh {
    background:
        radial-gradient(ellipse at 10% 90%, rgba(67, 111, 245, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 10%, rgba(255, 140, 97, 0.03) 0%, transparent 40%);
}
