﻿/* ============================================================
   GX Economy — Design System & Styles
   Dark Professional Dashboard · Glassmorphism · Blue Accents
   ============================================================ */

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

:root {
  --bg-primary: #050816;
  --bg-secondary: #0a0f1e;
  --bg-tertiary: #111936;
  --glass-bg: rgba(12, 17, 35, 0.55);
  --glass-bg-hover: rgba(15, 22, 45, 0.7);
  --glass-border: rgba(59, 130, 246, 0.12);
  --glass-border-hover: rgba(59, 130, 246, 0.3);
  --glass-blur: 20px;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-dark: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-glow-strong: rgba(59, 130, 246, 0.45);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #93c5fd;
  --border-subtle: rgba(148, 163, 184, 0.08);
  --border-medium: rgba(148, 163, 184, 0.15);
  --sidebar-width: 260px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px var(--accent-glow);
  --shadow-glow-strong: 0 0 40px var(--accent-glow-strong);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::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: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; overflow-x: hidden; line-height: 1.6; }

body::before {
  content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: radial-gradient(ellipse 600px 600px at 20% 20%, rgba(59, 130, 246, 0.08), transparent),
              radial-gradient(ellipse 500px 500px at 80% 80%, rgba(16, 185, 129, 0.05), transparent),
              radial-gradient(ellipse 400px 400px at 60% 30%, rgba(99, 102, 241, 0.06), transparent);
  z-index: 0; pointer-events: none; animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.05); } 100% { opacity: 1; transform: scale(1); } }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

.glass { background: var(--glass-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur)); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); transition: border-color var(--transition-base), box-shadow var(--transition-base); }
.glass:hover { border-color: var(--glass-border-hover); }
.hidden { display: none !important; }

#login-screen, #access-denied { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg-primary); }
#login-screen::before, #login-screen::after { content: ''; position: absolute; border-radius: 50%; filter: blur(80px); animation: orbFloat 8s ease-in-out infinite alternate; }
#login-screen::before { width: 400px; height: 400px; background: rgba(59, 130, 246, 0.15); top: 10%; left: 15%; }
#login-screen::after { width: 350px; height: 350px; background: rgba(16, 185, 129, 0.1); bottom: 10%; right: 15%; animation-delay: -4s; }
@keyframes orbFloat { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(40px, -30px) scale(1.1); } }

.login-card, .denied-card { position: relative; z-index: 1; width: 100%; max-width: 420px; padding: 48px 40px; text-align: center; animation: fadeSlideUp 0.6s ease-out; }
.login-logo { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: var(--radius-lg); background: linear-gradient(135deg, var(--accent), var(--accent-dark)); box-shadow: var(--shadow-glow); margin-bottom: 24px; font-size: 28px; font-weight: 800; color: white; letter-spacing: -1px; }
.login-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.5px; }
.login-subtitle { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 36px; }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-group { position: relative; text-align: left; }
.input-group label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; letter-spacing: 0.3px; text-transform: uppercase; }
.input-group input { width: 100%; padding: 12px 16px 12px 44px; background: rgba(15, 23, 42, 0.7); border: 1px solid var(--border-medium); border-radius: var(--radius-md); color: var(--text-primary); font-family: inherit; font-size: 0.95rem; outline: none; transition: border-color var(--transition-base), box-shadow var(--transition-base); }
.input-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input-group input::placeholder { color: var(--text-muted); }
.input-icon { position: absolute; bottom: 12px; left: 14px; color: var(--text-muted); pointer-events: none; transition: color var(--transition-base); }
.input-group input:focus ~ .input-icon { color: var(--accent-light); }

.login-error { display: none; padding: 10px 14px; background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: var(--radius-sm); color: var(--danger); font-size: 0.85rem; text-align: left; animation: shake 0.4s ease; }
.login-error.show { display: block; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 24px; border: none; border-radius: var(--radius-md); font-family: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all var(--transition-base); outline: none; text-decoration: none; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: white; box-shadow: var(--shadow-glow); }
.btn-primary:hover { box-shadow: var(--shadow-glow-strong); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: rgba(148, 163, 184, 0.1); color: var(--text-secondary); border: 1px solid var(--border-medium); }
.btn-secondary:hover { background: rgba(148, 163, 184, 0.15); color: var(--text-primary); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); background: transparent; border: none; color: var(--text-muted); cursor: pointer; transition: all var(--transition-fast); display: inline-flex; align-items: center; justify-content: center; }
.btn-icon:hover { background: rgba(148, 163, 184, 0.1); color: var(--text-primary); }
.btn-icon.danger:hover { background: var(--danger-bg); color: var(--danger); }
.btn-full { width: 100%; }
.spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, 0.3); border-top-color: white; border-radius: 50%; animation: spin 0.6s linear infinite; }
.spinner.show { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.denied-icon { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: var(--danger-bg); border: 1px solid rgba(239, 68, 68, 0.2); font-size: 32px; margin-bottom: 24px; }
.denied-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.denied-message { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 32px; line-height: 1.6; }

#dashboard { display: flex; min-height: 100vh; position: relative; z-index: 1; }
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-width); height: 100vh; display: flex; flex-direction: column; padding: 24px 16px; z-index: 100; border-radius: 0; border-right: 1px solid var(--glass-border); border-left: none; border-top: none; border-bottom: none; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 8px 12px; margin-bottom: 32px; }
.sidebar-brand-icon { width: 40px; height: 40px; border-radius: var(--radius-md); background: linear-gradient(135deg, var(--accent), var(--accent-dark)); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; color: white; flex-shrink: 0; box-shadow: 0 0 12px var(--accent-glow); }
.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name { font-size: 1rem; font-weight: 700; line-height: 1.2; }
.sidebar-brand-tag { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-section-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.2px; padding: 16px 12px 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; cursor: pointer; transition: all var(--transition-fast); border: none; background: none; width: 100%; text-align: left; font-family: inherit; }
.nav-item:hover { background: rgba(59, 130, 246, 0.08); color: var(--text-primary); }
.nav-item.active { background: rgba(59, 130, 246, 0.12); color: var(--accent-light); }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: 0.7; }
.nav-item:hover .nav-icon, .nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--border-subtle); margin-top: 8px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; }
.sidebar-user-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8b5cf6); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: white; flex-shrink: 0; }
.sidebar-user-email { font-size: 0.78rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); z-index: 99; }
.sidebar-overlay.show { display: block; }
.sidebar-toggle { display: none; position: fixed; top: 16px; left: 16px; z-index: 101; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--glass-bg); backdrop-filter: blur(12px); border: 1px solid var(--glass-border); color: var(--text-primary); cursor: pointer; align-items: center; justify-content: center; font-size: 20px; }

.main-content { flex: 1; margin-left: var(--sidebar-width); padding: 32px; min-height: 100vh; }
.top-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.header-left h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.5px; }
.header-left p { font-size: 0.9rem; color: var(--text-secondary); margin-top: 2px; }
.header-right { display: flex; align-items: center; gap: 16px; }

.realtime-badge { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--radius-full); background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); font-size: 0.78rem; font-weight: 500; color: var(--success); }
.realtime-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); } 50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } }

.cards-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 32px; }
.stat-card { padding: 24px; position: relative; overflow: hidden; animation: fadeSlideUp 0.5s ease-out both; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; opacity: 0; transition: opacity var(--transition-base); }
.stat-card:hover::before { opacity: 1; }
.stat-card:nth-child(1)::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, var(--success), #34d399); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, var(--warning), #fbbf24); }

.stat-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-card-label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card-icon { width: 40px; height: 40px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-card:nth-child(1) .stat-card-icon { background: rgba(59, 130, 246, 0.12); color: var(--accent-light); }
.stat-card:nth-child(2) .stat-card-icon { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.stat-card:nth-child(3) .stat-card-icon { background: rgba(16, 185, 129, 0.12); color: #34d399; }
.stat-card:nth-child(4) .stat-card-icon { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.stat-card-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-bottom: 4px; letter-spacing: -0.5px; }
.stat-card-value.positive { color: var(--success); }
.stat-card-value.negative { color: var(--danger); }
.stat-card-sub { font-size: 0.78rem; color: var(--text-muted); }

.chart-section { padding: 28px; margin-bottom: 32px; animation: fadeSlideUp 0.5s ease-out both; animation-delay: 0.25s; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 1.1rem; font-weight: 600; }
.section-subtitle { font-size: 0.82rem; color: var(--text-secondary); }
.chart-legend { display: flex; align-items: center; gap: 20px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.budget { background: var(--accent); }
.legend-dot.shares { background: #8b5cf6; }
.chart-container { position: relative; height: 340px; width: 100%; }
.chart-container canvas { width: 100% !important; height: 100% !important; }

.table-section { padding: 28px; animation: fadeSlideUp 0.5s ease-out both; animation-delay: 0.3s; margin-bottom: 40px; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table thead { background: rgba(15, 23, 42, 0.6); }
.data-table th { padding: 14px 16px; text-align: left; font-weight: 600; font-size: 0.78rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.data-table td { padding: 14px 16px; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: rgba(59, 130, 246, 0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-actions { display: flex; gap: 4px; }
.table-empty { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.table-empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.5; }

.modal-overlay { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px); opacity: 0; visibility: hidden; transition: opacity var(--transition-base), visibility var(--transition-base); }
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-card { width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; padding: 32px; transform: translateY(20px) scale(0.95); transition: transform var(--transition-base); }
.modal-overlay.show .modal-card { transform: translateY(0) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.modal-title { font-size: 1.2rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border-radius: var(--radius-sm); background: transparent; border: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 18px; transition: all var(--transition-fast); }
.modal-close:hover { background: rgba(148, 163, 184, 0.1); color: var(--text-primary); }
.modal-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }
.form-group input, .form-group textarea { padding: 12px 14px; background: rgba(15, 23, 42, 0.7); border: 1px solid var(--border-medium); border-radius: var(--radius-md); color: var(--text-primary); font-family: inherit; font-size: 0.9rem; outline: none; transition: border-color var(--transition-base), box-shadow var(--transition-base); }
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-group textarea { resize: vertical; min-height: 80px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }
.confirm-text { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 24px; line-height: 1.6; }

@keyframes fadeSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: var(--radius-md); font-size: 0.88rem; font-weight: 500; color: var(--text-primary); box-shadow: var(--shadow-lg); animation: toastIn 0.3s ease-out; min-width: 280px; max-width: 400px; }
.toast.success { background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); backdrop-filter: blur(12px); }
.toast.error { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); backdrop-filter: blur(12px); }
.toast.info { background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); backdrop-filter: blur(12px); }
.toast-exit { animation: toastOut 0.3s ease-in forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

@media (max-width: 1024px) { .cards-grid { grid-template-columns: repeat(2, 1fr); } .main-content { padding: 24px; } .chart-container { height: 280px; } }
@media (max-width: 768px) { .sidebar { transform: translateX(-100%); transition: transform var(--transition-base); z-index: 200; } .sidebar.open { transform: translateX(0); } .sidebar-overlay.show { display: block; z-index: 199; } .sidebar-toggle { display: flex; } .main-content { margin-left: 0; padding: 72px 16px 24px; } .cards-grid { grid-template-columns: 1fr 1fr; gap: 12px; } .stat-card { padding: 18px; } .stat-card-value { font-size: 1.35rem; } .top-header h1 { font-size: 1.35rem; } .chart-container { height: 240px; } .chart-section, .table-section { padding: 20px; } .login-card { padding: 36px 28px; } .modal-card { padding: 24px; } }
@media (max-width: 480px) { .cards-grid { grid-template-columns: 1fr; } .chart-legend { flex-direction: column; align-items: flex-start; gap: 8px; } .stat-card-value { font-size: 1.2rem; } .top-header { flex-direction: column; align-items: flex-start; } .header-right { align-self: flex-end; } .modal-actions { flex-direction: column; } .modal-actions .btn { width: 100%; } .table-toolbar { flex-direction: column; align-items: flex-start; } }
