/* ============================================================
   Korea Games Economy - Design System (Redesign)
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    /* Background colors */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-card-hover: #1f2b42;
    --bg-input: #0d1321;
    --bg-sidebar: #0d1220;
    --bg-topbar: #111827;

    /* Text colors */
    --text-primary: #eaf0f6;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-link: #60a5fa;

    /* Accent colors */
    --color-gain: #34d399;
    --color-loss: #f87171;
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-warning: #fbbf24;
    --color-info: #60a5fa;

    /* Extra backgrounds */
    --bg-tertiary: #1e293b;

    /* Borders */
    --border-color: #1e293b;
    --border-radius: 12px;
    --border-radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);

    /* Spacing */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --content-max-width: 1400px;

    /* Fonts */
    --font-sans: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--color-primary-hover);
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 0.5em;
    letter-spacing: -0.01em;
}

.text-gain { color: var(--color-gain) !important; }
.text-loss { color: var(--color-loss) !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-dim { color: var(--text-muted) !important; }

.font-mono {
    font-family: var(--font-mono);
}

/* --- Layout: Sidebar + Main --- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.02em;
}

.sidebar-brand .brand-icon {
    font-size: 26px;
}

.sidebar-nav {
    padding: 16px 0;
    flex: 1;
}

.sidebar-section {
    padding: 12px 24px 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-link:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.06);
}

.sidebar-link.active {
    color: var(--color-primary);
    background: rgba(59, 130, 246, 0.1);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.sidebar-link .icon {
    width: 22px;
    text-align: center;
    font-size: 17px;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

/* Main content area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: rgba(17, 24, 39, 0.85);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-balance {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 700;
    color: var(--color-gain);
    font-family: var(--font-mono);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.topbar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

/* Page content */
.page-content {
    flex: 1;
    padding: 32px;
    max-width: var(--content-max-width);
    width: 100%;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* --- Mobile sidebar toggle --- */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    backdrop-filter: blur(4px);
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .sidebar-toggle {
        display: block;
    }
    .main-content {
        margin-left: 0;
    }
    .page-content {
        padding: 20px;
    }
}

@media (max-width: 640px) {
    .page-content {
        padding: 16px;
    }
    .topbar {
        padding: 0 16px;
    }
}

/* --- Auth pages (no sidebar) --- */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 24px;
    background-image: radial-gradient(ellipse at 30% 20%, rgba(59, 130, 246, 0.06), transparent 60%),
                       radial-gradient(ellipse at 70% 80%, rgba(139, 92, 246, 0.04), transparent 50%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 48px 36px;
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 36px;
}
