/* ==========================================
   Requiem Admin Panel — Design System
   Premium dark theme with subtle animations
   ========================================== */

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

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

:root {
    --bg-0: #08080d;
    --bg-1: #0e0e16;
    --bg-2: #14141f;
    --bg-3: #1a1a28;
    --bg-hover: #1f1f30;
    --text-1: #e8e8ed;
    --text-2: #9898a8;
    --text-3: #5c5c6e;
    --accent: #6366f1;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --gold: #FFD700;
    --gold-soft: rgba(255, 215, 0, 0.12);
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
    --transition: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --font: 'Inter', -apple-system, sans-serif;
}

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

a { color: var(--accent); text-decoration: none; }

/* --- Layout --- */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; width: 100%; }
.main-content { padding: 40px 0; flex: 1; }

/* --- Top bar --- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(8, 8, 13, 0.8);
    backdrop-filter: blur(12px);
    position: sticky; top: 0; z-index: 100;
}
.topbar-brand {
    font-weight: 600; font-size: 1.1rem; color: var(--text-1);
    display: flex; align-items: center; gap: 8px;
}
.topbar-nav {
    display: flex; gap: 24px; align-items: center;
}
.nav-link {
    color: var(--text-2); font-weight: 500; font-size: 0.95rem;
    transition: color var(--transition);
}
.nav-link:hover { color: var(--text-1); }
.nav-link.active { color: var(--accent); }
.nav-link.hidden { display: none !important; }

.topbar-user {
    display: flex; align-items: center; gap: 12px;
}
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid var(--border);
}
.topbar-name { font-size: 0.9rem; color: var(--text-2); }
.topbar-logout {
    font-size: 0.8rem; color: var(--text-3);
    transition: color var(--transition);
    cursor: pointer; background: none; border: none;
}
.topbar-logout:hover { color: var(--danger); }

/* --- Login page --- */
.login-wrapper {
    flex: 1; display: flex; align-items: center; justify-content: center;
    background: radial-gradient(circle at 50% -20%, rgba(99,102,241,0.15) 0%, transparent 70%);
}
.login-card {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    max-width: 420px; width: 100%;
    animation: fadeUp 0.5s ease;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}
.login-card h1 {
    font-size: 1.8rem; font-weight: 700; margin-bottom: 8px;
}
.login-card p {
    color: var(--text-2); font-size: 0.95rem; margin-bottom: 32px;
}
.login-icon { font-size: 3rem; margin-bottom: 16px; }

/* --- Buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem; font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    position: relative; overflow: hidden;
}
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 0 0 0 var(--accent-glow); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.btn-discord { background: #5865F2; color: #fff; padding: 14px 28px; font-size: 1rem; width: 100%; }
.btn-discord:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(88, 101, 242, 0.35); }
.btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-3); border-color: var(--border-hover); color: var(--text-1); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.2); }
.btn-success:hover { background: var(--success); color: #fff; }

/* --- Inputs --- */
.input-group { margin-bottom: 16px; }
.input-label { display: block; font-size: 0.85rem; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.input-field {
    width: 100%; padding: 12px 16px;
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-1);
    font-family: var(--font); font-size: 0.95rem;
    transition: border-color var(--transition); outline: none;
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-3); }
select.input-field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c5c6e' viewBox='0 0 16 16'%3E%3Cpath d='M8 12L2 6h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 16px center; }

/* --- Cards & Panels --- */
.panel {
    background: var(--bg-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    animation: fadeUp 0.4s ease;
}
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.panel-title { font-size: 1.1rem; font-weight: 600; color: var(--text-1); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 20px;
    position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent); opacity: 0.5;
}
.stat-title { font-size: 0.85rem; color: var(--text-2); margin-bottom: 8px; font-weight: 500; }
.stat-value { font-size: 1.8rem; font-weight: 700; color: var(--text-1); }

/* --- Tables --- */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: 12px 16px;
    font-size: 0.8rem; font-weight: 600; color: var(--text-3); text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}
td {
    padding: 14px 16px; font-size: 0.95rem; color: var(--text-2);
    border-bottom: 1px solid var(--border);
}
tr:hover td { background: var(--bg-2); }
.td-user { display: flex; align-items: center; gap: 12px; color: var(--text-1); font-weight: 500; }
.td-avatar { width: 32px; height: 32px; border-radius: 50%; }
.badge {
    display: inline-block; padding: 4px 8px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge.add { background: var(--success-soft); color: var(--success); }
.badge.remove { background: var(--danger-soft); color: var(--danger); }
.row-add td { background: rgba(34,197,94,0.02); }
.row-remove td { background: rgba(239,68,68,0.02); }

/* --- User Search Results --- */
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: 16px; }
.user-card-small {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; background: var(--bg-2);
    border: 1px solid var(--border); border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition);
}
.user-card-small:hover { border-color: var(--accent); background: var(--bg-hover); }

/* --- Economy Management (Selected User) --- */
.eco-user-profile {
    display: flex; align-items: center; gap: 24px;
    padding: 32px; background: var(--bg-2); border-radius: var(--radius-lg);
    border: 1px solid var(--border); margin-bottom: 32px;
}
.eco-avatar { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--border); }
.eco-info { flex: 1; }
.eco-name { font-size: 1.5rem; font-weight: 600; color: var(--text-1); margin-bottom: 4px; }
.eco-bal { font-size: 2rem; font-weight: 700; color: var(--gold); }
.eco-actions { display: flex; gap: 12px; }

/* --- Leaderboard Podium --- */
.podium-container {
    display: flex; justify-content: center; align-items: flex-end; gap: 16px;
    margin: 40px 0; height: 220px;
}
.podium-card {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 180px; text-align: center; padding: 20px;
    position: relative; display: flex; flex-direction: column; align-items: center;
}
.podium-card.first { height: 100%; background: linear-gradient(to top, rgba(255,215,0,0.1), var(--bg-2)); border-color: rgba(255,215,0,0.3); }
.podium-card.second { height: 85%; }
.podium-card.third { height: 75%; }
.podium-avatar { width: 64px; height: 64px; border-radius: 50%; margin-bottom: 8px; border: 2px solid var(--border); }
.first .podium-avatar { width: 80px; height: 80px; border-color: var(--gold); }
.podium-medal { font-size: 2rem; position: absolute; top: -20px; }
.podium-name { font-weight: 600; font-size: 0.95rem; color: var(--text-1); margin-bottom: 4px; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-bal { color: var(--gold); font-weight: 700; }

/* --- Modal --- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    backdrop-filter: blur(4px); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--bg-1); border: 1px solid var(--border);
    border-radius: var(--radius-lg); width: 100%; max-width: 400px;
    transform: translateY(20px); transition: transform var(--transition);
    padding: 24px;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-title { font-size: 1.25rem; font-weight: 600; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* --- Config Chips --- */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--bg-3); border: 1px solid var(--border);
    padding: 4px 12px; border-radius: 20px; font-size: 0.85rem; color: var(--text-2);
}
.chip-remove { cursor: pointer; color: var(--text-3); transition: color var(--transition); }
.chip-remove:hover { color: var(--danger); }

/* --- Pagination --- */
.pagination { display: flex; justify-content: space-between; align-items: center; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--border); }
.page-info { color: var(--text-3); font-size: 0.85rem; }
.page-controls { display: flex; gap: 8px; }

/* --- Toast --- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 20px; border-radius: var(--radius); font-size: 0.9rem; font-weight: 500;
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3s forwards;
    box-shadow: var(--shadow);
}
.toast.success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(34,197,94,0.2); backdrop-filter: blur(10px); }
.toast.error { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,68,68,0.2); backdrop-filter: blur(10px); }

/* --- Animations --- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.6s linear infinite; }

/* --- Helpers --- */
.hidden { display: none !important; }
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
