/* MAGNUM OPUS // Web3 & DeFi Nexus Engine - Core Styling System */

:root {
    /* Color Palette */
    --bg-primary: #030611;
    --bg-secondary: #080c1e;
    --bg-card: rgba(10, 15, 36, 0.75);
    --bg-card-hover: rgba(15, 23, 42, 0.85);
    --bg-glass: rgba(13, 20, 48, 0.6);
    --bg-input: rgba(6, 11, 28, 0.9);
    --bg-dropdown: #0c1228;

    /* Borders & Outlines */
    --border-color: rgba(56, 189, 248, 0.15);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(168, 85, 247, 0.25);
    --border-active: rgba(56, 189, 248, 0.5);

    /* Accent Colors */
    --accent-cyan: #38bdf8;
    --accent-purple: #a855f7;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --accent-indigo: #6366f1;
    --accent-blue: #2563eb;

    /* Text Hierarchy */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --text-glow: rgba(248, 250, 252, 0.95);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    --font-size-2xs: 0.6875rem;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    /* Spacing */
    --spacing-2xs: 0.125rem;
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    --spacing-3xl: 6rem;

    /* Border Radius */
    --radius-xs: 0.2rem;
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.25rem;
    --radius-full: 9999px;

    /* Elevation & Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.37);
    --shadow-md: 0 4px 14px 0 rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.55);
    --shadow-xl: 0 20px 35px -5px rgba(0, 0, 0, 0.65);
    --shadow-2xl: 0 25px 60px -12px rgba(0, 0, 0, 0.8);

    /* Glow Effects */
    --glow-cyan: 0 0 25px rgba(56, 189, 248, 0.45);
    --glow-cyan-sm: 0 0 12px rgba(56, 189, 248, 0.3);
    --glow-purple: 0 0 25px rgba(168, 85, 247, 0.45);
    --glow-purple-sm: 0 0 12px rgba(168, 85, 247, 0.3);
    --glow-emerald: 0 0 25px rgba(16, 185, 129, 0.45);
    --glow-rose: 0 0 25px rgba(244, 63, 94, 0.45);
    --glow-amber: 0 0 25px rgba(245, 158, 11, 0.45);

    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.45s cubic-bezier(0.4, 0, 0.2, 1);

    /* Z-Indices */
    --z-background: -1;
    --z-base: 1;
    --z-card: 10;
    --z-dropdown: 100;
    --z-header: 500;
    --z-modal: 1000;
    --z-toast: 2000;
    --z-tooltip: 3000;

    /* Animation */
    --animation-duration: 0.3s;
    --animation-ease: cubic-bezier(0.4, 0, 0.2, 1);

    /* New Variables for Magnum Opus */
    --bg-gradient-start: #0f172a;
    --bg-gradient-end: #1e293b;
    --accent-gradient-start: #38bdf8;
    --accent-gradient-end: #a855f7;
    --text-gradient-start: #f8fafc;
    --text-gradient-end: #94a3b8;
}

/* Base Styles & Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at 10% 15%, rgba(168, 85, 247, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 90% 85%, rgba(56, 189, 248, 0.14) 0%, transparent 45%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 60%);
    background-attachment: fixed;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(56, 189, 248, 0.25);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(56, 189, 248, 0.5);
}

/* Typography Helpers */
.font-sans { font-family: var(--font-sans); }
.font-mono { font-family: var(--font-mono); }

.text-2xs { font-size: var(--font-size-2xs); }
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-xl); }
.text-4xl { font-size: var(--font-size-4xl); }
.text-5xl { font-size: var(--font-size-5xl); }

.font-light { font-weight: 300; }
.font-medium { font-weight: 500; }
.font-bold { font-weight: 700; }

/* Button Styles */
.button {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-main);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.button:hover {
    background-color: var(--bg-card-hover);
}

.button:active {
    background-color: var(--bg-card);
    transform: translateY(2px);
}

/* Button Variants */
.button-primary {
    background: linear-gradient(135deg, var(--accent-gradient-start), var(--accent-gradient-end));
    color: #fff;
    box-shadow: var(--glow-cyan);
}

.button-primary:hover {
    box-shadow: var(--glow-cyan-sm);
    background: linear-gradient(135deg, var(--accent-gradient-end), var(--accent-gradient-start));
}

.button-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.button-secondary:hover {
    background-color: var(--bg-card-hover);
    color: var(--text-main);
}

/* Card Styles */
.card {
    background-color: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    font-weight: var(--font-weight-medium);
}

.card-body {
    padding: var(--spacing-md);
}

/* Responsive Design */
@media (max-width: 768px) {
    .card {
        margin: var(--spacing-md) auto;
        max-width: 400px;
    }
}

@media (max-width: 480px) {
    .card {
        margin: var(--spacing-sm) auto;
        max-width: 300px;
    }
}

/* Utility Layout Classes */
.flex {
    display: flex;
}
.flex-col {
    flex-direction: column;
}
.flex-row {
    flex-direction: row;
}
.justify-center {
    justify-content: center;
}
.items-center {
    align-items: center;
}
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.grid {
    display: grid;
    gap: var(--spacing-md);
}
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Text Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-primary { color: var(--accent-cyan); }
.text-secondary { color: var(--accent-purple); }
.text-muted { color: var(--text-muted); }

/* Background Utilities */
.bg-primary { background-color: var(--bg-primary) !important; }
.bg-secondary { background-color: var(--bg-secondary) !important; }
.bg-card { background-color: var(--bg-card) !important; }
.bg-glass {
    background: var(--bg-glass);
    backdrop-filter: blur(8px);
}

/* Animation Keyframes */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

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

.animate-pulse {
    animation: pulse var(--animation-duration) infinite var(--animation-ease);
}

.animate-spin {
    animation: spin var(--animation-duration) linear infinite;
}

/* Dark Mode Preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #01010a;
        --bg-secondary: #05071a;
        --bg-card: rgba(20, 25, 45, 0.85);
        --bg-card-hover: rgba(30, 35, 55, 0.9);
        --text-main: #e5e7eb;
        --text-muted: #9ca3af;
    }
}

/* Modal & Toast Utilities */
.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    z-index: var(--z-modal);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

@keyframes slide-up {
    0% { transform: translateY(100%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

.toast {
    position: fixed;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    background: var(--bg-card);
    color: var(--text-main);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: var(--z-toast);
    animation: slide-up 0.3s var(--animation-ease);
}

/* Focus States */
.button:focus-visible,
.input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--border-active);
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0s !important;
        animation-duration: 0s !important;
        animation-iteration-count: 1 !important;
    }
}
