/* =============================================
   BAZA.MASTERSMETA.PRO — Основна дизайн-система
   Автор: MastersMeta Team
   Версія: 1.0
   ============================================= */

/* ─── Google Fonts ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@600;700;800;900&display=swap');

/* ─── CSS Variables (Dark Theme) ─── */
:root {
    /* Основні кольори */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --primary-light: #38bdf8;
    --primary-glow: rgba(14, 165, 233, 0.15);
    
    /* Акценти */
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.15);
    --amber: #f59e0b;
    --amber-light: #fbbf24;
    --emerald: #10b981;
    --emerald-light: #34d399;
    --rose: #f43f5e;
    
    /* Фони (Dark Mode) */
    --bg-body: #0b1120;
    --bg-surface: #111827;
    --bg-card: #1e293b;
    --bg-card-hover: #253347;
    --bg-elevated: #334155;
    --bg-glass: rgba(255, 255, 255, 0.03);
    --bg-glass-hover: rgba(255, 255, 255, 0.06);
    
    /* Тексти */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #38bdf8;
    
    /* Бордери */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(14, 165, 233, 0.3);
    
    /* Градієнти */
    --gradient-hero: linear-gradient(135deg, #0b1120 0%, #1a1040 40%, #0b1120 100%);
    --gradient-primary: linear-gradient(135deg, #0ea5e9, #8b5cf6);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #ef4444);
    --gradient-cool: linear-gradient(135deg, #06b6d4, #3b82f6);
    --gradient-card: linear-gradient(145deg, rgba(30, 41, 59, 0.8), rgba(51, 65, 85, 0.4));
    
    /* Тіні */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px rgba(14, 165, 233, 0.15);
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.25);
    
    /* Розміри */
    --container: 1280px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Анімації */
    --transition-fast: 0.15s ease;
    --transition: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ─── Light Theme ─── */
[data-theme="light"] {
    /* Фони */
    --bg-body: #f1f5f9;      
    --bg-surface: #f8fafc;   
    --bg-card: #ffffff;      
    --bg-card-hover: #ffffff;
    --bg-elevated: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-hover: rgba(255, 255, 255, 1);
    
    /* Тексти */
    --text-primary: #0f172a;   
    --text-secondary: #334155; 
    --text-muted: #64748b;     
    
    /* Бордери */
    --border: rgba(15, 23, 42, 0.06);
    --border-hover: rgba(15, 23, 42, 0.12);
    
    /* Тіні */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 30px rgba(14, 165, 233, 0.1);
    
    /* Градієнти */
    --gradient-hero: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --gradient-card: linear-gradient(145deg, #ffffff, #f1f5f9);
    
    /* Dynamic Mesh Gradient Background */
    --mesh-bg: 
        radial-gradient(at 0% 0%, rgba(14, 165, 233, 0.1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, rgba(139, 92, 246, 0.1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.1) 0, transparent 50%), 
        radial-gradient(at 0% 100%, rgba(139, 92, 246, 0.1) 0, transparent 50%), 
        radial-gradient(at 50% 100%, rgba(14, 165, 233, 0.1) 0, transparent 50%), 
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.1) 0, transparent 50%);
}

/* ─── Reset & Base ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    background-image: var(--mesh-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: clip; /* Використовуємо clip замість hidden, щоб не ламати sticky */
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background: var(--mesh-bg);
    opacity: 0.5;
    z-index: -1;
    animation: meshAnimation 60s linear infinite;
    pointer-events: none;
}

@keyframes meshAnimation {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-25%, -25%) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--primary-light); }

img { max-width: 100%; height: auto; }

/* ─── Container ─── */
.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

@media (max-width: 640px) {
    .container { padding: 0 16px; }
}

/* ─── Typography ─── */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', 'Inter', sans-serif;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 800; }
h2 { font-size: clamp(24px, 4vw, 36px); font-weight: 700; }
h3 { font-size: clamp(20px, 3vw, 28px); }
h4 { font-size: 20px; }

.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--text-accent); }

/* ─── Buttons ─── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 15px;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background var(--transition-fast);
}
.btn:hover::after { background: rgba(255,255,255,0.1); }

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(14, 165, 233, 0.4);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.btn-lg { padding: 16px 32px; font-size: 17px; border-radius: var(--radius-lg); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-icon { width: 44px; height: 44px; padding: 0; }

/* ─── Cards ─── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: visible; /* Розблоковує position: sticky */
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

/* Spotlight Effect (Aceternity UI Style - Mask Technique) */
.spotlight-card {
    --mouse-x: 50%;
    --mouse-y: 50%;
    --spotlight-color: #0ea5e9;
    --border-width: 1.5px;
    
    position: relative;
    border: 1px solid transparent !important;
    border-radius: inherit; /* Спробуємо спочатку успадкувати */
}

/* Fallback: якщо елемент не має власного радіусу, але є карткою або кнопкою */
.card.spotlight-card { border-radius: var(--radius-lg); }
.btn.spotlight-card { border-radius: var(--radius-md); }
.badge.spotlight-card { border-radius: var(--radius-sm); }
.search-box.spotlight-card { border-radius: var(--radius-xl); }
.navbar.spotlight-card { border-radius: 0; border: none !important; border-bottom: 1px solid transparent !important; }

.spotlight-card::after {
    content: "";
    position: absolute;
    inset: 0;
    padding: var(--border-width); /* Товщина нашого "бордера" */
    border-radius: inherit; /* Успадковуємо заокруглення від батька */
    background: radial-gradient(
        350px circle at var(--mouse-x) var(--mouse-y),
        var(--spotlight-color),
        transparent 80%
    );
    /* Маска, яка залишає видимим лише рамку */
    -webkit-mask: 
        linear-gradient(#fff, #fff) content-box, 
        linear-gradient(#fff, #fff);
    mask: 
        linear-gradient(#fff, #fff) content-box, 
        linear-gradient(#fff, #fff);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    
    pointer-events: none;
    opacity: var(--proximity-opacity, 0); /* Плавне згасання залежно від відстані */
    transition: opacity 0.2s ease-out; /* Швидка реакція на рух */
    z-index: 5;
    will-change: opacity, background;
}

/* При наведенні робимо підсвічування максимально яскравим */
.spotlight-card:hover::after {
    opacity: 1;
}

/* Статична тонка рамка під ефектом (щоб картка не була "безрамковою") */
.spotlight-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid var(--border);
    border-radius: inherit;
    pointer-events: none;
    z-index: 1;
}

[data-theme="light"] .spotlight-card {
    --spotlight-color: #2563eb; /* Більш глибокий синій для світла */
}

.spotlight-card.card-glass {
    background: var(--bg-glass);
}

/* Очищуємо зайві стилі */
.spotlight-card > * {
    position: relative;
    z-index: 2;
}

.card-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

/* ─── Badges ─── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-primary {
    background: var(--primary-glow);
    color: var(--primary-light);
    border: 1px solid rgba(14, 165, 233, 0.2);
}

.badge-accent {
    background: var(--accent-glow);
    color: var(--accent-light);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.15);
    color: var(--amber-light);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-emerald {
    background: rgba(16, 185, 129, 0.15);
    color: var(--emerald-light);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ─── Grid ─── */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ─── Flex utilities ─── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.gap-xl { gap: 32px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }

/* ─── Spacing ─── */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

@media (max-width: 768px) {
    .section { padding: 48px 0; }
    .section-sm { padding: 32px 0; }
}

/* ─── Section Headers ─── */
.section-header {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 48px;
}

.section-header h2 { margin-bottom: 12px; }
.section-header p { color: var(--text-secondary); font-size: 17px; }

.section-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary);
    margin-bottom: 12px;
}

.section-eyebrow::before,
.section-eyebrow::after {
    content: '';
    width: 20px;
    height: 1px;
    background: var(--primary);
    opacity: 0.5;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { 
    background: var(--bg-elevated);
    border-radius: 4px; 
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Selection ─── */
::selection {
    background: rgba(14, 165, 233, 0.3);
    color: var(--text-primary);
}

/* ─── SVG Icons Styling ─── */
svg {
    vertical-align: middle;
    flex-shrink: 0;
}

[opacity="0.2"] {
    opacity: 0.3;
}

[data-theme="light"] [opacity="0.2"] {
    opacity: 0.15;
}

.mr-2 { margin-right: 8px; }
.mb-2 { margin-bottom: 8px; }
.gap-xs { gap: 4px; }

.category-icon {
    width: 32px;
    height: 32px;
    color: var(--primary);
}

.nav-icon-btn svg {
    width: 20px;
    height: 20px;
}

.toast-icon svg {
    width: 20px;
    height: 20px;
}
