/* ════════════════════════════════════════════════════════════
   AMATISTA Pawn Edition — Design System
   Paleta: Púrpuras profundos + Dorado + Dark Mode
   ════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables (Design Tokens) ────────────────────────── */
:root {
    /* ── Shared Tokens (Theme Independent) ────────────────── */
    /* Primary — Amatista */
    --primary-50: #faf5ff;
    --primary-100: #f3e8ff;
    --primary-200: #e9d5ff;
    --primary-300: #d8b4fe;
    --primary-400: #c084fc;
    --primary-500: #a855f7;
    --primary-600: #9333ea;
    --primary-700: #7c3aed;
    --primary-800: #6b21a8;
    --primary-900: #581c87;
    --primary-950: #3b0764;

    /* Gold Accents */
    --gold-300: #fcd34d;
    --gold-400: #fbbf24;
    --gold-500: #d4af37;
    --gold-600: #b8960c;

    /* Status Colors */
    --success: #22c55e;
    --success-bg: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --info: #6366f1;
    --info-bg: rgba(99, 102, 241, 0.12);

    /* Spacing & Layout */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Dark Theme (Default) ────────────────────────────────── */
[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg-primary: #0f0a1a;
    --bg-secondary: #1a1128;
    --bg-tertiary: #241a36;
    --bg-card: rgba(26, 17, 40, 0.8);
    --bg-card-hover: rgba(36, 26, 54, 0.9);
    --bg-glass: rgba(147, 51, 234, 0.08);

    --border-subtle: rgba(147, 51, 234, 0.15);
    --border-medium: rgba(147, 51, 234, 0.3);
    --border-strong: rgba(147, 51, 234, 0.5);

    --text-primary: #f8fafc;
    --text-secondary: #c4b5d4;
    --text-tertiary: #8b7a9e;
    --text-muted: #5c4f6e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(147, 51, 234, 0.3);
    
    /* Radial Gradient Colors */
    --grad-1: rgba(107, 33, 168, 0.15);
    --grad-2: rgba(212, 175, 55, 0.08);
    --grad-3: rgba(59, 7, 100, 0.1);
}

/* ── Light Theme ─────────────────────────────────────────── */
[data-theme="light"] {
    --bg-primary: #fdfcff;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f3f0f7;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(243, 240, 247, 0.95);
    --bg-glass: rgba(147, 51, 234, 0.05);

    --border-subtle: rgba(147, 51, 234, 0.1);
    --border-medium: rgba(147, 51, 234, 0.2);
    --border-strong: rgba(147, 51, 234, 0.3);

    --text-primary: #1a0b2e;
    --text-secondary: #4a3b5c;
    --text-tertiary: #7d6b91;
    --text-muted: #aca4ba;

    --shadow-sm: 0 1px 2px rgba(147, 51, 234, 0.05);
    --shadow-md: 0 4px 12px rgba(147, 51, 234, 0.08);
    --shadow-lg: 0 8px 30px rgba(147, 51, 234, 0.12);
    --shadow-glow: 0 0 15px rgba(147, 51, 234, 0.1);
    
    /* Radial Gradient Colors */
    --grad-1: rgba(147, 51, 234, 0.08);
    --grad-2: rgba(212, 175, 55, 0.05);
    --grad-3: rgba(255, 255, 255, 0.1);
}


/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 0%, var(--grad-1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, var(--grad-2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, var(--grad-3) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transition: background var(--transition-normal);
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

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

a {
    color: var(--primary-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--primary-300); }

/* ── Layout ───────────────────────────────────────────────── */
.app-container {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.main-content {
    flex: 1;
    padding: var(--space-xl);
    margin-left: 260px;
    transition: margin-left var(--transition-normal);
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: var(--space-md);
    }
}

/* ── Sidebar / Navigation ─────────────────────────────────── */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar-brand {
    padding: var(--space-lg) var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
    min-height: 80px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.sidebar-brand:hover {
    background: var(--bg-glass);
}

.sidebar-brand img {
    max-height: 46px;
    max-width: 60px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    filter: drop-shadow(0 0 8px rgba(147, 51, 234, 0.2));
}

.sidebar-brand .brand-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    box-shadow: var(--shadow-glow);
}

.sidebar-brand .brand-text {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--primary-200), var(--gold-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: var(--space-md) var(--space-md) var(--space-sm);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.2), rgba(107, 33, 168, 0.15));
    color: var(--primary-300);
    border: 1px solid var(--border-medium);
}

.nav-item .nav-icon {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: var(--space-md);
    left: var(--space-md);
    z-index: 200;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle {
        display: block;
    }
}

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.page-header h1 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.page-header .header-actions {
    display: flex;
    gap: var(--space-sm);
}

/* ── Utility Classes ──────────────────────────────────────── */
.text-gold { color: var(--gold-500); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-tertiary); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: 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); }

.grid {
    display: grid;
    gap: var(--space-lg);
}

.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-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-600);
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(147, 51, 234, 0.3); }
    50% { box-shadow: 0 0 20px rgba(147, 51, 234, 0.6); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-in {
    animation: slideInLeft 0.3s ease-out;
}

/* Staggered animation for lists */
.stagger > * {
    animation: fadeIn 0.4s ease-out both;
}
.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }
