/* --- CONFIGURACIÓN DE COLORES Y VARIABLES --- */
:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --card-bg-hover: rgba(56, 189, 248, 0.08);
    --text-color: #f8fafc;
    --accent-color: #38bdf8;
    --hover-color: #0ea5e9;
    --status-online: #22c55e;
    --status-offline: #ef4444;
    --status-pending: #f59e0b;
    --border-subtle: rgba(255, 255, 255, 0.08);
}

* {
    box-sizing: border-box;
}

/* Scrollbar Personalizado */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--card-bg);
    border-radius: 10px;
    border: 2px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* --- TÍTULO --- */
h1 {
    margin: 50px 0;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--text-color);
}

/* --- LAYOUT --- */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    width: 95%;
    max-width: 1300px;
    padding: 20px;
}

.services-column {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* --- SIDEBAR DE ESTADO --- */
.status-sidebar {
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-subtle);
    height: fit-content;
    position: sticky;
    top: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.status-sidebar h2 {
    font-size: 1rem;
    margin: 0 0 20px 0;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 12px;
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.status-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.95rem;
    font-weight: 400;
}

/* --- INDICADORES Y PULSO --- */
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 15px;
}

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.online { background-color: var(--status-online); animation: pulse-green 2s infinite; }
.offline { background-color: var(--status-offline); box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
.pending { background-color: var(--status-pending); box-shadow: 0 0 12px rgba(245, 158, 11, 0.4); }

/* --- EL SEPARADOR DE ADMIN (CORREGIDO) --- */
.admin-separator {
    margin: 35px 0 25px 0;
    border-top: 1px dashed rgba(56, 189, 248, 0.25);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.admin-separator::before {
    content: 'ADMIN MONITORS';
    position: absolute;
    background-color: var(--card-bg); /* Mismo color que el fondo del sidebar */
    padding: 0 15px;
    font-size: 0.65rem;
    color: var(--accent-color);
    letter-spacing: 2px;
    font-weight: 800;
    text-transform: uppercase;
    /* Esto asegura que tape la línea punteada solo lo justo */
}

/* --- SECCIONES DESPLEGABLES --- */
details {
    background-color: rgba(30, 41, 59, 0.4);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    overflow: hidden;
    transition: background 0.3s;
}

details[open] { background-color: rgba(30, 41, 59, 0.6); }

summary {
    padding: 18px 25px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--accent-color);
    list-style: none;
    user-select: none;
}

summary:hover { background-color: rgba(255, 255, 255, 0.03); }

summary::after {
    content: '▶';
    font-size: 0.7rem;
    transition: transform 0.3s;
}
details[open] summary::after { transform: rotate(90deg); }

/* --- GRID DE TARJETAS --- */
.grid-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
}

.service-card {
    background-color: var(--card-bg);
    text-decoration: none;
    color: inherit;
    width: 125px;
    height: 125px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-subtle);
}

.service-card:hover {
    transform: translateY(-5px);
    background-color: var(--card-bg-hover);
    border-color: var(--accent-color);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.icon { font-size: 32px; margin-bottom: 8px; }
.name { font-size: 0.8rem; text-align: center; font-weight: 500; padding: 0 5px; }

/* --- EXTRAS Y FOOTER --- */
.incident-msg {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-bottom: 12px;
    background: rgba(239, 68, 68, 0.1);
    padding: 12px;
    border-radius: 10px;
    border-left: 4px solid var(--status-offline);
}

#btn-status-page {
    display: block; width: 100%; padding: 14px 0; margin-top: 20px;
    background-color: var(--status-offline); border-radius: 10px;
    text-decoration: none; color: white; font-weight: bold;
    text-align: center; font-size: 0.85rem;
    transition: filter 0.2s;
}

#btn-status-page:hover { filter: brightness(1.1); }

.sidebar-footer {
    font-size: 0.7rem; color: #64748b; margin-top: 30px;
    border-top: 1px solid var(--border-subtle); padding-top: 15px;
    text-align: center;
}

.admin-trigger {
    cursor: pointer; text-decoration: none; color: var(--status-offline);
    opacity: 0.6; margin-top: 15px; display: inline-block; font-size: 0.8rem;
    transition: opacity 0.2s;
}
.admin-trigger:hover { opacity: 1; text-decoration: underline; }

.hidden { display: none !important; }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
    .main-layout { grid-template-columns: 1fr; }
    .status-sidebar { order: -1; position: static; width: 100%; }
}

#incidents-list {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Línea divisoria sutil */
}
