/* ============================================================
   CodeVault Design System — Single Source of Truth
   ============================================================
   Import this file in every layout to guarantee consistent
   tokens, buttons, inputs, cards, and background treatment.

   CSS file structure:
   - design-system.css  (THIS FILE) — global tokens, base reset,
       shared components (.btn-primary, .glass-card, .input-field)
   - common.css         — layout-level glass effects, mesh animation
   - loader.css         — full-screen loading spinner
   - notifications.css  — toast notification slide/scan animations
   - dashboard.css      — dashboard page-specific overrides
   - auth.css           — auth page-specific overrides
   - share.css          — shared snippet page overrides
   - snippet-editor.css — snippet editor overrides
   - categories.css     — category page animations

   Page-specific CSS files are linked via @push('styles') in
   each Blade view or via the layout's <link> tags.
   ============================================================ */

/* ---------- Google Fonts (loaded once per page) ---------- */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ===================== BASE RESET ========================= */

:root {
    /* ---- Typography ---- */
    --font-primary: 'Plus Jakarta Sans', ui-sans-serif, system-ui, sans-serif;
    --font-mono: 'Fira Code', ui-monospace, monospace;

    /* ---- Core Palette ---- */
    --color-bg-base: #050505;
    --color-bg-elevated: rgba(20, 20, 20, 0.6);
    --color-bg-input: #050505;
    --color-bg-overlay: rgba(0, 0, 0, 0.8);

    /* ---- Border ---- */
    --color-border-subtle: rgba(255, 255, 255, 0.08);
    --color-border-focus: #3b82f6;

    /* ---- Text ---- */
    --color-text-primary: #ffffff;
    --color-text-secondary: #a1a1aa;   /* gray-400 */
    --color-text-muted: #71717a;       /* gray-500 */
    --color-text-faint: #52525b;       /* gray-600 */

    /* ---- Accent (Blue) ---- */
    --color-accent: #3b82f6;           /* blue-500 */
    --color-accent-hover: #60a5fa;     /* blue-400 */
    --color-accent-subtle: rgba(59, 130, 246, 0.1);
    --color-accent-border: rgba(59, 130, 246, 0.3);

    /* ---- Danger ---- */
    --color-danger: #ef4444;
    --color-danger-subtle: rgba(239, 68, 68, 0.1);

    /* ---- Radius Scale ---- */
    --radius-sm: 0.5rem;    /* 8px  */
    --radius-md: 0.75rem;   /* 12px */
    --radius-lg: 1rem;      /* 16px */
    --radius-xl: 1.5rem;    /* 24px */
    --radius-2xl: 2rem;     /* 32px */

    /* ---- Transitions ---- */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==================== GLOBAL DEFAULTS ==================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--color-bg-base);
    color: var(--color-text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[x-cloak] {
    display: none !important;
}

/* =================== SHARED COMPONENTS =================== */

/* ---------- Primary Button ---------- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: #ffffff;
    color: #000000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 700;
    transition: all var(--transition-base);
    cursor: pointer;
}

.btn-primary:hover {
    background: #000000;
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn-primary:active {
    transform: translateY(0);
}

/* ---------- Glass Card ---------- */
.glass-card {
    background: var(--color-bg-elevated);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--color-border-subtle);
    position: relative;
    overflow: hidden;
}

/* ---------- Input Field ---------- */
.input-field {
    background: var(--color-bg-input);
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
}

.input-field:focus {
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 1px var(--color-border-focus);
    outline: none;
}

.input-field::placeholder {
    color: var(--color-text-faint);
}

/* ---------- Code Font Utility ---------- */
.code-font {
    font-family: var(--font-mono);
}

/* ---------- Background Mesh ---------- */
.bg-mesh {
    background-color: var(--color-bg-base);
    position: relative;
    min-height: 100vh;
}

.bg-mesh::before {
    content: "";
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

.bg-mesh::after {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 30px 30px;
    mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 95%);
    -webkit-mask-image: radial-gradient(circle at 50% 50%, black 30%, transparent 95%);
    z-index: -1;
    pointer-events: none;
}

/* ---------- Prism Code Styling ---------- */
pre[class*="language-"] {
    background: rgba(0, 0, 0, 0.3) !important;
    border-radius: var(--radius-lg) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
}

code[class*="language-"] {
    white-space: pre-wrap !important;
    word-break: break-word !important;
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    line-height: 1.6 !important;
}

/* ---------- Select Styling ---------- */
select option {
    background-color: #1a1a1a;
    color: #ffffff;
}

/* ---------- Mini Scrollbar ---------- */
.custom-mini-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-mini-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

/* ---------- Selection Color ---------- */
::selection {
    background: rgba(59, 130, 246, 0.3);
    color: white;
}

/* ---------- Creative Black & White Button ---------- */
.creative-btn {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
    position: relative;
    overflow: hidden;
}

.creative-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #fff 0%, #e0e0e0 50%, #fff 100%);
    transition: all 0.4s ease;
    z-index: 1;
}

.creative-btn:hover::before {
    left: 0;
}

.creative-btn:hover {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.15), inset 0 0 20px rgba(255, 255, 255, 0.05);
}

.creative-btn::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%);
    z-index: 0;
    animation: btnShine 3s infinite;
    border-radius: inherit;
}

@keyframes btnShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
