:root {
    --bg: #0f172a;
    --card: #1e293b;
    --accent: #38bdf8;
    --online: #22c55e;
    --offline: #ef4444;
}

/* --- BASES --- */
body {
    background-color: var(--bg);
    color: white;
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container { 
    max-width: 1200px; 
    margin: auto; 
}

header { 
    text-align: center; 
    margin-bottom: 30px; 
}

/* --- GRID DE ESTADÍSTICAS (SUPERIOR) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); 
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--card);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
}

.stat-card h3 { margin: 0; font-size: 0.8rem; color: #94a3b8; text-transform: uppercase; }
.stat-card .number { font-size: 1.3rem; font-weight: bold; color: var(--accent); }

/* --- ESTADOS DEL SERVIDOR --- */
.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Color Verde cuando está Online */
.status-badge.online { 
    background: rgba(34, 197, 94, 0.15) !important; 
    color: #22c55e !important; 
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Color Rojo cuando está Offline */
.status-badge.offline { 
    background: rgba(239, 68, 68, 0.15) !important; 
    color: #ef4444 !important; 
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- ESTRUCTURA PRINCIPAL (DOS COLUMNAS) --- */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 300px; /* Columna mapa | Columna lateral */
    gap: 20px;
    align-items: start;
}

/* --- COLUMNA LATERAL Y SCROLL AREAS --- */
.side-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.scroll-card {
    background: var(--card);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

.scroll-card h3 { 
    margin: 0 0 12px 0; 
    font-size: 0.9rem; 
    color: var(--accent); 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.scroll-area {
    max-height: 200px; /* Altura máxima para el scroll */
    overflow-y: auto;
    padding-right: 8px;
}

/* Estilización del Scrollbar */
.scroll-area::-webkit-scrollbar { width: 5px; }
.scroll-area::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.scroll-area::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }

/* Estilos de items dentro de scroll */
.mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
}

.mini-item:last-child { border-bottom: none; }

.player-tag { display: flex; align-items: center; gap: 8px; }
.player-tag img { width: 20px; height: 20px; border-radius: 3px; }

/* --- SECCIÓN MAPA --- */
.map-section {
    background: var(--card);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255,255,255,0.1);
}

#mapContainer { 
    position: relative; 
    width: 100%; 
    height: 650px; /* Más alto en escritorio ya que es la pieza central */
    border-radius: 8px; 
    overflow: hidden; 
}

#mapIframe { width: 100%; height: 100%; border: none; }

/* --- CONECTADOS --- */
.player-head-mini img {
    width: 25px;
    height: 25px;
    border-radius: 2px;
    margin-right: 5px;
}

/* --- BOTONES Y OTROS --- */
.btn-fullscreen {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background: var(--accent);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.75rem;
}

/* --- MODAL --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card);
    margin: 2vh auto;
    width: 90%;
    height: 90vh;
    border-radius: 12px;
    overflow: hidden;
}

/* Estilo para que el iframe ocupe todo el modal */
.modal-body {
    height: calc(100% - 60px); /* Restamos la altura del header del modal */
    width: 100%;
}

#planIframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Ajustes al header del modal para que se vea limpio */
.modal-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.close-btn {
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
}

.close-btn:hover { color: var(--offline); }

.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.record-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(74, 163, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.record-card:hover {
    transform: translateY(-5px);
    border-color: #4aa3ff;
}

.record-card img {
    border-radius: 8px;
    background: #222;
}

.record-info h4 {
    margin: 0;
    font-size: 0.9em;
    color: #888;
    text-transform: uppercase;
}

.record-player {
    margin: 2px 0;
    font-weight: bold;
    font-size: 1.1em;
}

.record-value {
    margin: 0;
    color: #4aa3ff;
    font-weight: bold;
}

/* --- RESPONSIVE --- */
@media (max-width: 1000px) {
    .main-layout {
        grid-template-columns: 1fr; /* Una columna en tablets y móviles */
    }
    
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    
    #mapContainer { height: 400px; }
}

@media (max-width: 600px) {
    .stats-grid { grid-template-columns: 1fr; }
    
    body { padding: 10px; }
}