@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --bg-dark: #1a0e05;
    --bg-card: #2d1810;
    --bg-card2: #1a1205;
    --gold: #daa520;
    --gold-dark: #8b6914;
    --text-light: #f0e6d0;
    --text-muted: #c4a46a;
    --text-dim: #8a7a5a;
    --border: rgba(218,165,32,0.2);
    --border-light: rgba(218,165,32,0.3);
    --success: #4caf50;
    --danger: #f44336;
    --info: #2196f3;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Crimson Text', Georgia, serif;
    background: linear-gradient(170deg, var(--bg-dark) 0%, var(--bg-card) 30%, var(--bg-card2) 60%, var(--bg-dark) 100%);
    color: var(--text-light);
    min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; transition: 0.3s; }
a:hover { color: var(--text-light); }

/* NAVBAR */
.navbar {
    background: linear-gradient(135deg, rgba(30,18,8,0.95), rgba(42,28,14,0.95));
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}
.navbar .logo {
    font-family: 'Cinzel Decorative', serif;
    font-size: 18px;
    color: var(--gold);
    font-weight: 700;
}
.navbar .nav-links { display: flex; gap: 16px; align-items: center; font-size: 15px; }
.navbar .nav-links a { color: var(--text-muted); }
.navbar .nav-links a:hover, .navbar .nav-links a.active { color: var(--gold); }
.navbar .user-info { display: flex; align-items: center; gap: 8px; }
.navbar .user-avatar { font-size: 20px; }
.navbar .user-level {
    background: var(--gold-dark);
    color: var(--bg-dark);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    font-family: 'Cinzel Decorative', serif;
}

/* CONTAINER */
.container { max-width: 900px; margin: 0 auto; padding: 24px 16px; }
.container-sm { max-width: 500px; margin: 0 auto; padding: 24px 16px; }

/* CARDS */
.card {
    background: linear-gradient(145deg, rgba(42,28,14,0.9), rgba(30,20,10,0.95));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.card-header {
    font-family: 'Cinzel Decorative', serif;
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* FORMS */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 1px;
    font-family: 'Cinzel Decorative', serif;
    font-weight: 400;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(26,14,5,0.8);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-light);
    font-family: 'Crimson Text', serif;
    font-size: 16px;
    transition: 0.3s;
}
.form-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(218,165,32,0.2);
}
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 100px; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-family: 'Cinzel Decorative', serif;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    text-decoration: none;
    letter-spacing: 0.5px;
}
.btn-gold {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: var(--bg-dark);
    box-shadow: 0 4px 16px rgba(218,165,32,0.3);
}
.btn-gold:hover {
    box-shadow: 0 6px 24px rgba(218,165,32,0.5);
    transform: translateY(-1px);
    color: var(--bg-dark);
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
}
.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}
.btn-danger {
    background: linear-gradient(135deg, #8b1a1a, #c0392b);
    color: white;
}
.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ALERTS */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.5;
}
.alert-success { background: rgba(76,175,80,0.15); border: 1px solid rgba(76,175,80,0.3); color: #81c784; }
.alert-error { background: rgba(244,67,54,0.15); border: 1px solid rgba(244,67,54,0.3); color: #ef9a9a; }
.alert-info { background: rgba(33,150,243,0.15); border: 1px solid rgba(33,150,243,0.3); color: #90caf9; }
.alert-warning { background: rgba(255,152,0,0.15); border: 1px solid rgba(255,152,0,0.3); color: #ffcc80; }

/* TABLE */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    padding: 10px 12px;
    font-family: 'Cinzel Decorative', serif;
    font-size: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    letter-spacing: 1px;
}
td {
    padding: 12px;
    border-bottom: 1px solid rgba(218,165,32,0.08);
    font-size: 15px;
}
tr:hover td { background: rgba(218,165,32,0.05); }

/* STATS GRID */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: rgba(26,14,5,0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}
.stat-icon { font-size: 28px; margin-bottom: 6px; }
.stat-value {
    font-family: 'Cinzel Decorative', serif;
    font-size: 24px;
    color: var(--gold);
    font-weight: 900;
}
.stat-label { font-size: 12px; color: var(--text-dim); margin-top: 4px; letter-spacing: 1px; }

/* XP BAR */
.xp-bar-container { margin-bottom: 20px; }
.xp-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 4px;
}
.xp-bar {
    width: 100%;
    height: 8px;
    background: rgba(218,165,32,0.15);
    border-radius: 4px;
    overflow: hidden;
}
.xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* BADGE */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Cinzel Decorative', serif;
}
.badge-gold { background: rgba(218,165,32,0.2); color: var(--gold); }
.badge-green { background: rgba(76,175,80,0.2); color: #81c784; }
.badge-red { background: rgba(244,67,54,0.2); color: #ef9a9a; }
.badge-blue { background: rgba(33,150,243,0.2); color: #90caf9; }

/* LEADERBOARD */
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-bottom: 1px solid var(--border);
    transition: 0.3s;
}
.leaderboard-item:hover { background: rgba(218,165,32,0.05); }
.lb-rank {
    font-family: 'Cinzel Decorative', serif;
    font-size: 18px;
    color: var(--gold);
    width: 40px;
    text-align: center;
    font-weight: 900;
}
.lb-rank.top1 { color: #ffd700; font-size: 24px; }
.lb-rank.top2 { color: #c0c0c0; font-size: 22px; }
.lb-rank.top3 { color: #cd7f32; font-size: 20px; }
.lb-user { flex: 1; }
.lb-username { font-size: 17px; font-weight: 600; }
.lb-level { font-size: 13px; color: var(--text-dim); }
.lb-score { font-family: 'Cinzel Decorative', serif; color: var(--gold); font-size: 18px; }

/* GAME AREA */
.game-container { max-width: 600px; margin: 0 auto; }
.question-card {
    background: linear-gradient(145deg, rgba(42,28,14,0.9), rgba(30,20,10,0.95));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 28px 24px;
    margin: 20px 0;
    position: relative;
    box-shadow: var(--shadow);
    text-align: center;
}
.question-text {
    font-size: 20px;
    line-height: 1.5;
    font-weight: 600;
}

/* DIVIDER */
.divider {
    text-align: center;
    color: var(--gold-dark);
    font-size: 14px;
    letter-spacing: 4px;
    margin: 20px 0;
    opacity: 0.7;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.modal {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-card2));
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 30px;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 16px 64px rgba(0,0,0,0.6);
}

/* PAGINATION */
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    border: 1px solid var(--border);
}
.pagination a:hover { border-color: var(--gold); }
.pagination .active {
    background: var(--gold-dark);
    color: var(--bg-dark);
    border-color: var(--gold);
    font-weight: bold;
}

/* TABS */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab {
    padding: 10px 20px;
    color: var(--text-dim);
    font-family: 'Cinzel Decorative', serif;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: 0.3s;
    background: none;
    border-top: 0; border-left: 0; border-right: 0;
}
.tab:hover, .tab.active { color: var(--gold); border-bottom-color: var(--gold); }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.5s ease; }

/* RESPONSIVE */
@media (max-width: 600px) {
    .navbar { padding: 10px 14px; }
    .navbar .logo { font-size: 15px; }
    .container, .container-sm { padding: 16px 12px; }
    .card { padding: 20px 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ADMIN SIDEBAR */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
    width: 240px;
    background: rgba(20,12,5,0.95);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.admin-sidebar .sidebar-title {
    font-family: 'Cinzel Decorative', serif;
    color: var(--gold);
    font-size: 16px;
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 15px;
    transition: 0.2s;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: rgba(218,165,32,0.1);
    color: var(--gold);
}
.admin-content { flex: 1; padding: 24px; overflow-x: auto; }

@media (max-width: 768px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        display: flex;
        flex-wrap: wrap;
        padding: 10px;
        gap: 4px;
    }
    .admin-sidebar .sidebar-title { width: 100%; padding: 8px 12px; margin-bottom: 8px; }
    .admin-sidebar a { padding: 8px 12px; font-size: 13px; }
}
