/* ===== Base (Unificada) ===== */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background: #111;
    color: #eee;
    line-height: 1.4;
}

/* ===== Navegación Adaptativa ===== */
nav {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

nav a,
nav a:visited {
    color: #6cf;
    text-decoration: none;
    padding: 8px 12px;
    background: #222;
    border-radius: 4px;
    font-size: 14px;
    min-width: 60px;
    text-align: center;
    border: 1px solid #333;
}

nav a:hover {
    background: #333;
    text-decoration: underline;
    border-color: #444;
}

hr {
    width: 100%;
    border: 0;
    border-top: 1px solid #333;
    margin-bottom: 20px;
}

/* ===== Títulos ===== */
h1 {
    margin-top: 0;
    color: #fff;
}

h2 {
    color: #6cf;
    font-size: 1.2em;
    margin-top: 0;
    border-bottom: 1px solid #222;
    padding-bottom: 8px;
}

h3 {
    font-size: 1em;
    color: #9f9;
    margin-bottom: 10px;
}

/* ===== Dashboard Grid ===== */
.dashboard-grid {
    display: grid;
    /* En PC: columnas automáticas de al menos 300px. En móvil: 1 columna */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.card {
    background: #000;
    border: 1px solid #333;
    padding: 20px;
    box-sizing: border-box;
    border-radius: 2px;
    /* AÑADE ESTO */
    min-width: 0; 
    overflow: hidden; 
}

.stat-row {
    margin-bottom: 10px;
    font-family: monospace;
}

.stat-label {
    color: #888;
    font-weight: bold;
    margin-right: 5px;
}

/* ===== Áreas de Texto (Config y Logs) ===== */
textarea, .CodeMirror {
    width: 100%;
    height: 80vh;
    background: #000 !important;
    color: #0f0 !important;
    font-family: monospace;
    padding: 10px;
    border: 1px solid #333;
    box-sizing: border-box;
}

pre#log {
    width: 100%;
    min-height: 70vh;
    background: #000;
    color: #0f0;
    font-family: monospace;
    padding: 10px;
    border: 1px solid #333;
    box-sizing: border-box;
    overflow: visible;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== Lista de Logs (logs-list.html) ===== */
.log {
    padding: 12px;
    border-bottom: 1px solid #222;
    display: flex;
    gap: 15px;
    align-items: center;
    font-family: monospace;
}

.log:hover {
    background: #1a1a1a;
}

.log a {
    color: #6cf;
    text-decoration: none;
}

.log .file {
    min-width: 180px;
}

.log .episodes {
    color: #9f9;
}

/* ===== Botones ===== */
button {
    padding: 10px 20px;
    margin-right: 10px;
    font-size: 16px;
    cursor: pointer;
    background: #333;
    color: #eee;
    border: 1px solid #444;
    border-radius: 4px;
}

button:hover {
    background: #444;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Estado y Utilidades ===== */
#status {
    margin-top: 10px;
    color: #0f0;
    font-family: monospace;
}

#recent-episodes {
    width: 100%;
    overflow: hidden;
}

.recent-item {
    font-size: 0.85em;
    padding: 4px 0;
    border-bottom: 1px solid #1a1a1a;
    color: #ccc;
    white-space: nowrap; /* Esto está bien */
    overflow: hidden;    /* Esto es clave */
    text-overflow: ellipsis; /* Esto pondrá los "..." al final */
    display: block;      /* Asegura que se comporte como bloque para respetar el ancho */
}

.source-tag {
    color: #9f9;
    font-weight: bold;
}

/* ===== Adaptación para Móvil ===== */
@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow-x: hidden;
    }

    /* Forzamos que la navegación sea SIEMPRE una fila horizontal */
    nav {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Prohibido saltar de línea */
        gap: 4px;
        width: 100%;
    }

    nav a {
        flex: 1 1 0px !important; /* Se reparten el 100% entre los 5 */
        min-width: 0; 
        font-size: 0.75em; /* Un pelín más pequeño para asegurar que quepa el texto */
        padding: 10px 1px;
        text-align: center;
    }

    /* Las tarjetas se apilan una debajo de otra */
    .dashboard-grid {
        display: block !important;
        margin-top: 15px;
    }

    .card {
        display: block;
        width: 100%;
        margin-bottom: 15px;
        padding: 15px 10px;
        box-sizing: border-box;
        min-width: 0;
        overflow: hidden;
    }
}
