:root {
    --bg-main: #0a0b0d;
    /* True dark background */
    --bg-sidebar: #101216;
    /* Deep dark for sidebar */
    --bg-card: #15181c;
    /* Card background slightly lighter */
    --text-main: #f0f6fc;
    /* Off-white text */
    --text-muted: #8b949e;
    /* Muted gray text */
    --accent-cyan: #14b8a6;
    /* Cyan/Teal accent */
    --accent-cyan-hover: #0d9488;
    --accent-red: #ef4444;
    --accent-green: #22c55e;

    --border-radius: 16px;
    --border-radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
}

.text-cyan {
    color: var(--accent-cyan);
}

.text-red {
    color: var(--accent-red);
}

/* --- Login Page --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
}

.logo span {
    color: var(--accent-cyan);
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #444;
    background: var(--bg-main);
    color: var(--text-main);
    border-radius: var(--border-radius-sm);
    outline: none;
    transition: 0.3s;
}

.input-group input:focus {
    border-color: var(--accent-cyan);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent-cyan);
    color: #000;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background: var(--accent-cyan-hover);
}

.error-msg {
    background: rgba(218, 54, 51, 0.2);
    color: var(--accent-red);
    padding: 10px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
}

/* --- Dashboard --- */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
}

.brand {
    margin-bottom: 40px;
}

.brand h1 {
    font-size: 1.5rem;
}

.brand span {
    color: var(--accent-cyan);
}

.nav-header {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.nav {
    list-style: none;
    margin-bottom: 40px;
}

.nav li {
    margin-bottom: 10px;
}

.nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    border-radius: var(--border-radius-sm);
    transition: 0.3s;
}

.nav a i {
    margin-right: 15px;
    width: 20px;
}

.nav li.active a,
.nav a:hover {
    background: var(--accent-cyan);
    color: rgba(0, 0, 0, 0.8);
}

/* Main Content */
.content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-profile img {
    border-radius: 50%;
}

.stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--border-radius);
    flex: 1;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-card.highlighted {
    border-top: 4px solid var(--accent-cyan);
}

.stat-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8rem;
}

/* Charts Page */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 1100px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    background: var(--bg-card);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.chart-container h3 {
    margin-bottom: 20px;
    font-weight: 500;
}

/* Flags Table */
.flags-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 25px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.flags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.server-filter {
    background: var(--bg-main);
    color: var(--text-main);
    border: 1px solid #444;
    padding: 8px 15px;
    border-radius: var(--border-radius-sm);
    outline: none;
}

.table-container {
    overflow-x: auto;
}

.flags-table {
    width: 100%;
    border-collapse: collapse;
}

.flags-table th,
.flags-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.flags-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

.flags-table tr:last-child td {
    border-bottom: none;
}

.flags-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.player {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.head-small {
    border-radius: 4px;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
}

.badge-movement {
    background: rgba(63, 202, 220, 0.2);
    color: var(--accent-cyan);
}

.badge-combat {
    background: rgba(218, 54, 51, 0.2);
    color: var(--accent-red);
}

.inspect-btn {
    background: transparent;
    color: var(--accent-cyan);
    border: 1px solid var(--accent-cyan);
    padding: 6px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.3s;
}

.inspect-btn:hover {
    background: var(--accent-cyan);
    color: #000;
}

/* Hover Details (Tooltip) */
.hover-details {
    display: none;
    position: absolute;
    background: #15181b;
    border: 1px solid #333;
    padding: 15px;
    border-radius: var(--border-radius-sm);
    z-index: 100;
    margin-top: -80px;
    margin-left: -200px;
    min-width: 250px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    color: var(--text-muted);
}

.hover-details pre {
    margin-top: 10px;
    white-space: pre-wrap;
    font-family: monospace;
    color: var(--accent-cyan);
}

tr:hover .hover-details {
    display: block;
}

/* Sidebar Inspector */
.inspector-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.inspector-sidebar.open {
    right: 0;
}

.inspector-header {
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: var(--text-main);
}

.inspector-content {
    padding: 25px;
    overflow-y: auto;
}

.inspector-content .detail-group {
    margin-bottom: 20px;
}

.inspector-content .detail-group label {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.inspector-content .detail-group .value {
    font-weight: 500;
    font-size: 1rem;
}

pre.tech-details {
    background: #111;
    padding: 15px;
    border-radius: var(--border-radius-sm);
    color: var(--accent-cyan);
    font-family: monospace;
    white-space: pre-wrap;
}