/**
 * Enliko Trading Platform - Base Design System
 * Version 3.18.0
 * 
 * ЕДИНЫЙ файл с CSS переменными для ВСЕХ страниц
 * Подключать на КАЖДОЙ странице ПЕРВЫМ
 */

/* ===== CSS RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

/* ===== ROOT VARIABLES ===== */
:root {
    /* === Background Colors === */
    --bg-primary: #0a0a0a;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-card: #141414;
    --bg-hover: #1f1f1f;
    --bg-active: #2a2a2a;
    --bg-graphite: #2a2a2a;
    
    /* === Primary Accent (Red) === */
    --accent: #dc2626;
    --accent-primary: #dc2626;
    --accent-red: #ef4444;
    --accent-crimson: #b91c1c;
    --accent-dark: #991b1b;
    --accent-darker: #7f1d1d;
    
    /* === Secondary Accent (Gold) === */
    --accent-gold: #d4a017;
    --accent-yellow: #eab308;
    --accent-orange: #f59e0b;
    
    /* === Utility Accent === */
    --accent-arc: #00d4ff;
    --accent-cyan: #00d4ff;
    --accent-purple: #dc2626;
    --accent-blue: #dc2626;
    
    /* === Semantic Colors === */
    --green: #22c55e;
    --accent-green: #22c55e;
    --accent-success: #10b981;
    --green-dim: rgba(34, 197, 94, 0.12);
    
    --red: #ef4444;
    --accent-danger: #ef4444;
    --red-dim: rgba(239, 68, 68, 0.12);
    
    --yellow: #eab308;
    --accent-warning: #f59e0b;
    --yellow-dim: rgba(212, 160, 23, 0.12);
    
    /* === Text Colors === */
    --text-primary: #f5f5f5;
    --text-secondary: #a1a1a1;
    --text-muted: #6b6b6b;
    --text-disabled: #52525b;
    --text-gold: #d4a017;
    
    /* === Border Colors === */
    --border: rgba(255, 255, 255, 0.06);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-primary: #27272a;
    --border-secondary: #3f3f46;
    --border-hover: rgba(220, 38, 38, 0.4);
    --border-gold: rgba(212, 160, 23, 0.3);
    --border-accent: #dc2626;
    
    /* === Fonts === */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    /* === Gradients === */
    --gradient-primary: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    --gradient-stark: linear-gradient(135deg, #dc2626 0%, #7f1d1d 50%, #450a0a 100%);
    --gradient-iron: linear-gradient(135deg, #dc2626 0%, #d4a017 100%);
    --gradient-gold: linear-gradient(135deg, #d4a017 0%, #b8860b 100%);
    --gradient-graphite: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
    --gradient-arc: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    --gradient-green: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    --gradient-red: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-metal: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 50%, #0a0a0a 100%);
    --gradient-card: linear-gradient(180deg, #1a1a1a 0%, #1a1a1a 100%);
    --gradient-shine: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.05) 50%, transparent 100%);
    
    /* === Glow Effects === */
    --glow-red: 0 0 40px rgba(220, 38, 38, 0.4), 0 0 80px rgba(220, 38, 38, 0.2);
    --glow-gold: 0 0 30px rgba(212, 160, 23, 0.3);
    --glow-arc: 0 0 40px rgba(0, 212, 255, 0.4), 0 0 80px rgba(0, 212, 255, 0.2);
    --glow-green: 0 0 30px rgba(34, 197, 94, 0.3);
    --glow-graphite: 0 4px 20px rgba(0, 0, 0, 0.6);
    
    /* === Shadows === */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.4);
    
    /* === Exchange-Specific Colors === */
    --bybit-color: #f7a600;
    --hl-color: #00ff88;
    --binance-color: #f0b90b;
    
    /* === Spacing === */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    
    /* === Border Radius === */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* === Transitions === */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* === Z-Index Layers === */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;
    --z-tooltip: 700;
}

/* ===== BASE STYLES ===== */
body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-pattern {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 10% 20%, rgba(220, 38, 38, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 90% 80%, rgba(34, 197, 94, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(153, 27, 27, 0.04) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-active);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ===== SELECTION ===== */
::selection {
    background: rgba(220, 38, 38, 0.3);
    color: var(--text-primary);
}

/* ===== LINKS ===== */
a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-gold);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.btn-success {
    background: var(--gradient-green);
    color: white;
}

.btn-danger {
    background: var(--gradient-red);
    color: white;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== INPUTS ===== */
.input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

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

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--green-dim);
    color: var(--green);
}

.badge-danger {
    background: var(--red-dim);
    color: var(--red);
}

.badge-warning {
    background: var(--yellow-dim);
    color: var(--accent-gold);
}

.badge-primary {
    background: rgba(220, 38, 38, 0.12);
    color: var(--accent);
}

/* ===== PNL COLORS ===== */
.pnl-positive, .profit {
    color: var(--green) !important;
}

.pnl-negative, .loss {
    color: var(--red) !important;
}

/* ===== CONTAINERS ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--space-lg);
}

/* ===== 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: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== RESPONSIVE ===== */

/* Tablet */
@media (max-width: 1024px) {
    :root {
        --space-lg: 20px;
        --space-xl: 28px;
    }
    
    .container {
        max-width: 100%;
        padding: 0 var(--space-md);
    }
}

/* Mobile */
@media (max-width: 768px) {
    :root {
        --space-lg: 16px;
        --space-xl: 24px;
    }
    
    .container {
        padding: 0 var(--space-sm);
    }
    
    /* Card adjustments */
    .card {
        padding: var(--space-md);
        border-radius: var(--radius-md);
    }
    
    /* Button touch targets */
    .btn {
        min-height: 44px;
        padding: 12px 16px;
    }
    
    /* Form inputs */
    .input, .select, .textarea {
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
    }
    
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
}

/* Extra small */
@media (max-width: 375px) {
    :root {
        --space-lg: 12px;
        --space-xl: 20px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .card {
        padding: var(--space-sm);
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
}
