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

/* ============ RESET & BASE ============ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #15151f;
    --bg-hover: #1a1a28;
    --border: #1e1e2e;
    --border-accent: #2a1a1a;
    --text-primary: #c8c8d0;
    --text-secondary: #888;
    --text-muted: #555;
    --red: #c41e3a;
    --red-dark: #8b0000;
    --red-glow: rgba(196, 30, 58, 0.3);
    --green: #2ecc71;
    --blue: #3498db;
    --purple: #9b59b6;
    --orange: #e67e22;
    --gold: #f1c40f;
    --diamond: #00d4ff;
    --hp-bar: #c0392b;
    --energy-bar: #2980b9;
    --xp-bar: #8e44ad;
}

body {
    font-family: 'Raleway', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    font-size: 14px;
}

a { color: var(--red); text-decoration: none; transition: color 0.2s; }
a:hover { color: #e8354f; }

/* ============ LAYOUT ============ */
.game-layout {
    display: grid;
    grid-template-columns: 260px 1fr 280px;
    grid-template-rows: 60px 1fr;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
}

.game-header {
    grid-column: 1 / -1;
    background: linear-gradient(180deg, #12121a, #0e0e14);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.game-logo {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--red);
    text-shadow: 0 0 15px var(--red-glow);
}
.game-logo span { color: var(--red-dark); }

.header-right { display: flex; align-items: center; gap: 16px; }
.header-currencies { display: flex; gap: 16px; align-items: center; }
.currency { display: flex; align-items: center; gap: 5px; font-weight: 600; font-size: 0.9rem; }
.currency-gold { color: var(--gold); }
.currency-diamond { color: var(--diamond); }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-username { font-family: 'Cinzel', serif; color: var(--text-primary); font-size: 0.9rem; }

.game-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    overflow-y: auto;
}

.game-main {
    padding: 24px;
    overflow-y: auto;
    background-image: radial-gradient(ellipse at 50% 0%, rgba(120, 0, 0, 0.04) 0%, transparent 70%);
}

.game-right {
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
}

/* ============ SIDEBAR NAV ============ */
.nav-section { margin-bottom: 4px; }
.nav-title {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    padding: 0 20px;
    margin-bottom: 0;
}
.nav-title.nav-accordion {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin: 0;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}
.nav-title.nav-accordion:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-title.nav-accordion.open {
    color: var(--red);
}
.nav-arrow {
    font-size: 0.8rem;
    transition: transform 0.2s;
    display: inline-block;
}
.nav-accordion.open .nav-arrow {
    transform: rotate(90deg);
}
.nav-group {
    display: none;
    overflow: hidden;
}
.nav-group .nav-item {
    padding: 8px 20px 8px 28px;
    font-size: 0.85rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--red);
}
.nav-item.active {
    background: rgba(196, 30, 58, 0.08);
    color: var(--red);
    border-left-color: var(--red);
}
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 1rem; }
.nav-item .nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

/* ============ CHARACTER PANEL (RIGHT) ============ */
.char-panel { margin-bottom: 20px; }
.char-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.char-avatar {
    width: 56px; height: 56px;
    background: var(--bg-card);
    border: 2px solid var(--border-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}
.char-info h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--text-primary);
}
.char-race {
    font-size: 0.75rem;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-bar {
    margin-bottom: 10px;
}
.stat-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 3px;
}
.stat-bar-track {
    height: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.stat-bar-fill.hp { background: linear-gradient(90deg, var(--hp-bar), #e74c3c); }
.stat-bar-fill.energy { background: linear-gradient(90deg, var(--energy-bar), #3498db); }
.stat-bar-fill.xp { background: linear-gradient(90deg, var(--xp-bar), #a855f7); }

.char-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 16px;
}
.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    text-align: center;
}
.stat-value {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-weight: 700;
}
.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ============ BUTTONS ============ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: white;
}
.btn-primary {
    background: linear-gradient(135deg, var(--red), var(--red-dark));
}
.btn-primary:hover {
    box-shadow: 0 4px 20px var(--red-glow);
    transform: translateY(-1px);
    color: white;
}
.btn-secondary {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: white; }
.btn-success { background: linear-gradient(135deg, #27ae60, #1e8449); }
.btn-success:hover { box-shadow: 0 4px 20px rgba(39,174,96,0.3); color: white; }
.btn-diamond { background: linear-gradient(135deg, #0099cc, #006699); }
.btn-diamond:hover { box-shadow: 0 4px 20px rgba(0,212,255,0.3); color: white; }
.btn-full { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

/* ============ FORMS ============ */
label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}
input[type="text"], input[type="password"], input[type="email"],
input[type="number"], select, textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 14px;
    transition: border-color 0.3s;
    font-family: 'Raleway', sans-serif;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 10px rgba(196,30,58,0.1);
}
textarea { resize: vertical; min-height: 80px; }

/* ============ ALERTS ============ */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.alert-error { background: rgba(200,0,0,0.1); border: 1px solid #a00; color: #f66; }
.alert-success { background: rgba(0,180,0,0.1); border: 1px solid #0a4; color: #0d6; }
.alert-info { background: rgba(0,100,200,0.1); border: 1px solid #06a; color: #4af; }
.alert-warning { background: rgba(200,160,0,0.1); border: 1px solid #a80; color: #fa4; }

/* ============ TABLES ============ */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
}
tr:hover { background: rgba(255,255,255,0.02); }

/* ============ ITEM CARDS ============ */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    transition: all 0.3s;
    position: relative;
}
.item-card:hover {
    border-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.item-card.common { border-left: 3px solid #888; }
.item-card.uncommon { border-left: 3px solid var(--green); }
.item-card.rare { border-left: 3px solid var(--blue); }
.item-card.epic { border-left: 3px solid var(--purple); }
.item-card.legendary { border-left: 3px solid var(--gold); }

.item-name {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.item-name.common { color: #aaa; }
.item-name.uncommon { color: var(--green); }
.item-name.rare { color: var(--blue); }
.item-name.epic { color: var(--purple); }
.item-name.legendary { color: var(--gold); }

.item-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.item-stats { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.6; }
.item-stats .positive { color: var(--green); }
.item-stats .premium-stat { color: var(--diamond); }
.item-price {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.premium-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: linear-gradient(135deg, var(--diamond), #0088aa);
    color: #000;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.equipped-badge {
    position: absolute;
    top: 8px; right: 8px;
    background: var(--green);
    color: #000;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* ============ HUNT ZONES ============ */
.zone-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.zone-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
}
.zone-card:hover { border-color: var(--red); }
.zone-card.locked { opacity: 0.4; pointer-events: none; }
.zone-name {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--red);
    margin-bottom: 4px;
}
.zone-desc { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 12px; }
.zone-monster { color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 8px; }
.zone-rewards { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 12px; }
.zone-level-req { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* ============ PVP ============ */
.pvp-opponent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 10px;
    transition: all 0.2s;
}
.pvp-opponent:hover { border-color: #333; }
.pvp-opponent-info { display: flex; align-items: center; gap: 12px; }
.pvp-opponent-race { font-size: 1.4rem; }
.pvp-opponent-name { font-family: 'Cinzel', serif; font-size: 0.9rem; }
.pvp-opponent-level { font-size: 0.8rem; color: var(--text-muted); }

/* ============ BATTLE LOG ============ */
.battle-log {
    background: #08080e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    line-height: 1.8;
}
.battle-log .round { color: var(--red); font-weight: 700; }
.battle-log .damage { color: #e74c3c; }
.battle-log .heal { color: var(--green); }
.battle-log .miss { color: var(--text-muted); }
.battle-log .victory { color: var(--gold); font-weight: 700; }
.battle-log .defeat { color: #e74c3c; font-weight: 700; }

/* ============ LEVEL UP ANIMATION ============ */
.level-up-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s;
}
.level-up-box {
    text-align: center;
    animation: scaleIn 0.5s;
}
.level-up-box h2 {
    font-family: 'Cinzel', serif;
    font-size: 3rem;
    color: var(--gold);
    text-shadow: 0 0 40px rgba(241,196,15,0.5);
    margin-bottom: 10px;
}
.level-up-box p { color: var(--text-secondary); font-size: 1.1rem; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes hpPulse { 0%,100%{opacity:1;background:#e74c3c} 50%{opacity:0.4;background:#c0392b} }

/* ============ REST ============ */
.rest-section { text-align: center; padding: 40px; }
.rest-icon { font-size: 4rem; margin-bottom: 16px; animation: pulse 2s infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}
.rest-timer {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--blue);
    margin: 16px 0;
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 20px;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.pagination a:hover { border-color: var(--red); color: var(--red); }
.pagination .current { background: var(--red); border-color: var(--red); color: white; }

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h2 {
    font-family: 'Cinzel', serif;
    color: var(--red);
    margin-bottom: 20px;
}

/* ============ MOBILE RESPONSIVE ============ */
.mobile-nav-toggle { display: none; }

@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 60px auto;
    }
    .game-sidebar, .game-right { display: none; }
    .game-sidebar.show, .game-right.show { display: block; position: fixed; top: 60px; bottom: 0; width: 280px; z-index: 200; }
    .game-sidebar.show { left: 0; }
    .game-right.show { right: 0; }
    .mobile-nav-toggle {
        display: block;
        background: none;
        border: none;
        color: var(--text-primary);
        font-size: 1.4rem;
        cursor: pointer;
    }
    .game-main { padding: 16px; }
    .item-grid { grid-template-columns: 1fr; }
    .zone-grid { grid-template-columns: 1fr; }
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a4a; }

/* ============ ADMIN ============ */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.admin-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}
.admin-stat-value {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    color: var(--red);
}
.admin-stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-top: 4px;
}
