/* ============================================================
   RADIOGENIX - ESTILOS GLOBALES (COLORES 90 MEDIA)
   OPTIMIZADO PARA MÓVILES PEQUEÑOS
   ============================================================ */

/* ============================================================
   1. VARIABLES CSS - COLORES 90 MEDIA
   ============================================================ */
:root {
    --sidebar-width: 260px;
    --sidebar-width-mobile: 280px;
    --header-height: 60px;
    
    /* Colores 90 Media */
    --primary: #007887;
    --primary-dark: #005f6b;
    --primary-light: #0095a8;
    --primary-bg: rgba(0, 120, 135, 0.15);
    --primary-gradient: linear-gradient(180deg, #005f6b, #007887);
    
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --bg: #f0f2f5;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.06);
    --radius: 12px;
    --transition: 0.3s ease;
    
    /* Tamaños para móviles */
    --font-base: 16px;
    --font-small: 14px;
    --font-xs: 12px;
}

/* ============================================================
   2. RESET Y BASE
   ============================================================ */
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    display: flex;
    min-height: 100vh;
    font-size: var(--font-base);
}

/* ============================================================
   3. BOTÓN HAMBURGUESA
   ============================================================ */
.menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 2000;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: var(--transition);
    line-height: 1;
}
.menu-toggle:hover { background: var(--primary-dark); }
.menu-toggle:active { transform: scale(0.95); }

/* ============================================================
   4. SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary-gradient);
    color: white;
    height: 100vh;
    padding: 25px 20px;
    position: fixed;
    top: 0;
    left: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1500;
    transition: transform var(--transition);
}
.sidebar h2 { text-align: center; font-size: 1.8em; margin-bottom: 5px; }
.sidebar h2 span { color: #64b5f6; }
.sidebar .subtitle { text-align: center; font-size: 12px; color: #64b5f6; margin-bottom: 30px; }
.sidebar .menu-label { font-size: 11px; text-transform: uppercase; color: rgba(255,255,255,0.4); letter-spacing: 1px; margin: 15px 0 8px 15px; }
.sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 10px;
    margin: 3px 0;
    transition: var(--transition);
}
.sidebar a:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar a.active { 
    background: rgba(255,255,255,0.15); 
    color: white; 
    border-left: 3px solid #64b5f6;
}
.sidebar a .icon { font-size: 18px; width: 28px; text-align: center; flex-shrink: 0; }
.sidebar a .badge {
    margin-left: auto;
    background: var(--success);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
}
.sidebar a .badge.off { background: var(--danger); }
.sidebar .logout {
    margin-top: auto;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 15px;
    color: #e74c3c !important;
}
.sidebar .logout:hover { background: rgba(231, 76, 60, 0.15); }
.sidebar .version { text-align: center; font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 10px; }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1400;
}

/* ============================================================
   5. MAIN CONTENT
   ============================================================ */
.main {
    margin-left: var(--sidebar-width);
    padding: 30px;
    width: 100%;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ============================================================
   6. HEADER
   ============================================================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 10px;
}
.header h1 { color: #1a1a2e; font-size: 28px; }
.header h1 span { color: var(--primary); }
.header .user {
    background: white;
    padding: 8px 20px;
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    color: #555;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.header .user .badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    padding: 2px 12px;
    border-radius: 12px;
}
.header .user .status {
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.header .user .status.on { background: #d4edda; color: #155724; }
.header .user .status.off { background: #f8d7da; color: #721c24; }

/* ============================================================
   7. CARDS
   ============================================================ */
.card {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}
.card h2 {
    color: var(--primary);
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f2f5;
}
.card h2 .icon { margin-right: 8px; }
.card h3 { margin-bottom: 15px; color: #1a1a2e; }

/* ============================================================
   8. ESTADÍSTICAS
   ============================================================ */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}
.stat-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: transform 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card .num { font-size: 2.2em; font-weight: bold; color: var(--primary); }
.stat-card .label { color: #888; margin-top: 5px; font-size: 14px; }
.stat-card .icon-big { font-size: 28px; position: absolute; top: 10px; right: 15px; opacity: 0.2; }

/* ============================================================
   9. GRIDS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ============================================================
   10. TABLAS
   ============================================================ */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table {
    width: 100%;
    font-size: 14px;
    border-collapse: collapse;
    min-width: 500px;
}
.table th {
    text-align: left;
    padding: 10px 12px;
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.table td {
    padding: 12px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    white-space: nowrap;
}
.table tr:hover td { background: #f8f9fa; }
.table .empty {
    text-align: center;
    color: #aaa;
    padding: 40px;
    white-space: normal;
}
.title-truncate {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* ============================================================
   11. FORMULARIOS
   ============================================================ */
.form-group { margin: 12px 0; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    color: #333;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    transition: var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 120, 135, 0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input[type="datetime-local"] { width: 100%; }
.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    transform: scale(1.2);
}
.help-text { font-size: 12px; color: #888; margin-top: 4px; }

/* ============================================================
   12. BOTONES
   ============================================================ */
.btn {
    padding: 10px 25px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #218838; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: var(--warning); color: #333; }
.btn-warning:hover { background: #e0a800; }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-sm { padding: 5px 15px; font-size: 13px; }
.btn-lg { padding: 14px 50px; font-size: 18px; }
.btn-block { width: 100%; display: block; }
.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* ============================================================
   13. MENSAJES
   ============================================================ */
.mensaje {
    padding: 12px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}
.mensaje.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.mensaje.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.mensaje.info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}
.success {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* ============================================================
   14. BADGES
   ============================================================ */
.badge {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge.activa { background: #d4edda; color: #155724; }
.badge.caducada { background: #f8d7da; color: #721c24; }
.badge.urgente { background: #f8d7da; color: #721c24; }
.badge.alta { background: #fff3cd; color: #856404; }
.badge.normal { background: #d4edda; color: #155724; }
.badge.informacion { background: #cce5ff; color: #004085; }
.badge.cultura { background: #d1ecf1; color: #0c5460; }
.badge.deportes { background: #d4edda; color: #155724; }
.badge.tiempo { background: #fff3cd; color: #856404; }

.badge-prioridad {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-prioridad.urgente { background: #f8d7da; color: #721c24; }
.badge-prioridad.alta { background: #fff3cd; color: #856404; }
.badge-prioridad.normal { background: #d4edda; color: #155724; }

.badge-categoria {
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-categoria.informacion { background: #cce5ff; color: #004085; }
.badge-categoria.cultura { background: #d1ecf1; color: #0c5460; }
.badge-categoria.deportes { background: #d4edda; color: #155724; }
.badge-categoria.tiempo { background: #fff3cd; color: #856404; }

.badge-estado.activa { color: var(--success); }
.badge-estado.inactiva { color: var(--danger); }

.badge-tipo {
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
}
.badge-tipo.noticias { background: #cce5ff; color: #004085; }
.badge-tipo.cuña { background: #f8d7da; color: #721c24; }
.badge-tipo.promocion { background: #fff3cd; color: #856404; }
.badge-tipo.agenda { background: #d1ecf1; color: #0c5460; }
.badge-tipo.tiempo { background: #d4edda; color: #155724; }
.badge-tipo.boletin { background: #e8f5e9; color: #2e7d32; }
.badge-tipo.default { background: #e9ecef; color: #6c757d; }

.ia-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    border: 1px solid var(--success);
}
.badge-noticias {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 8px;
}

/* ============================================================
   15. AUDIO
   ============================================================ */
audio { width: 100%; margin: 15px 0; }
.audio-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}
.audio-link:hover { text-decoration: underline; }

/* ============================================================
   16. MODAL
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal.active { display: flex; }
.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--radius);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}
.modal-content h3 { color: var(--primary); margin-bottom: 15px; }
.modal-content .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}
.modal-content .close:hover { color: #333; }
.modal-content .texto {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    white-space: pre-wrap;
    font-family: 'Georgia', serif;
    font-size: 16px;
    line-height: 1.6;
}

/* ============================================================
   17. TEXTOS Y UTILIDADES
   ============================================================ */
.text-muted { color: #aaa; }
.empty-text {
    color: #aaa;
    text-align: center;
    padding: 15px;
}
.quick-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.meta-info {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ============================================================
   18. SETTINGS.PHP - COMPLEMENTARIOS
   ============================================================ */
.result-box {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid var(--primary);
    white-space: pre-wrap;
    margin: 15px 0;
    font-size: 16px;
    line-height: 1.6;
    max-height: 400px;
    overflow: auto;
    font-family: 'Georgia', serif;
}

.api-status {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.tips {
    background: #e3f2fd;
    border: 1px solid #64b5f6;
    color: #0d47a1;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
}

.style-info {
    font-size: 13px;
    color: #666;
    margin: 10px 0;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}
.style-info strong { color: var(--primary); }

.tab-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tab-buttons button {
    flex: 1;
    min-width: 80px;
    padding: 12px 15px;
    background: #e9ecef;
    color: #333;
    border: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    border-radius: 8px;
    transition: var(--transition);
}
.tab-buttons button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.tab-buttons button:hover:not(.active) { background: #dee2e6; }

.selector-noticias {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin: 10px 0;
    flex-wrap: wrap;
}
.selector-noticias select { width: auto; margin: 0; }

.temperatura-info {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 5px;
}

.speed-control {
    display: flex;
    gap: 20px;
    margin: 10px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    align-items: center;
    flex-wrap: wrap;
    border: 1px solid #e0e0e0;
}
.speed-control input[type="range"] {
    flex: 1;
    min-width: 150px;
    height: 6px;
    border-radius: 3px;
    background: var(--primary);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
    margin: 0;
}
.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}
.speed-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: none;
}
.speed-label { font-weight: bold; color: var(--primary); min-width: 40px; text-align: center; }
.speed-hint { font-size: 12px; color: #888; }

.voice-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 10px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

/* ============================================================
   19. NOTICIAS
   ============================================================ */
.noticias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 15px;
}
.noticia-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--success);
    transition: var(--transition);
}
.noticia-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.noticia-card.caducada { border-left-color: var(--danger); opacity: 0.6; }
.noticia-card.prioridad-2 { border-left-color: var(--danger); }
.noticia-card.prioridad-1 { border-left-color: var(--warning); }
.noticia-card.prioridad-0 { border-left-color: var(--success); }
.noticia-card .titulo { font-weight: 600; font-size: 16px; color: #1a1a2e; }
.noticia-card .contenido { font-size: 14px; color: #555; margin-top: 5px; }
.noticia-card .meta {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 5px;
}
.noticia-card .acciones {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.empty {
    text-align: center;
    padding: 40px;
    color: #888;
}
.empty .icon { font-size: 48px; margin-bottom: 10px; }

.alert-edicion {
    background: #fff3cd;
    border: 1px solid #ffc107;
    color: #856404;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}
.alert-edicion a { color: var(--primary); font-weight: 600; }

/* ============================================================
   20. SCHEDULER
   ============================================================ */
.dias-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.dias-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: var(--transition);
}
.dias-grid label:hover { background: #e9ecef; }
.dias-grid input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }

.horario-item {
    background: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 8px 0;
    border: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}
.horario-item > * { flex: 1; min-width: 80px; }
.horario-item .btn-remove {
    background: var(--danger);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 5px;
    cursor: pointer;
    flex: 0;
}
.horario-item .btn-remove:hover { background: #c82333; }

.preset-btn {
    padding: 4px 12px;
    background: #e9ecef;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin: 2px;
}
.preset-btn:hover { background: #dee2e6; }

.locutor-selector {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    margin: 10px 0;
}
.locutor-selector select { flex: 1; min-width: 150px; margin: 0; }

.cron-info {
    margin-top: 25px;
    padding: 20px;
    background: #fff3cd;
    border-radius: var(--radius);
    border: 1px solid #ffc107;
}
.cron-info h3 { color: #856404; }
.cron-info p { font-size: 14px; color: #856404; }
.cron-info code {
    background: #333;
    color: #fff;
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 13px;
    display: inline-block;
    word-break: break-all;
}

.audio-preview {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}
.audio-preview audio { width: 100%; max-width: 400px; margin-top: 10px; }

.preset-container {
    margin-bottom: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================================================
   21. HISTORY
   ============================================================ */
.filtros {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    align-items: center;
}
.filtros select, .filtros input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.filtros select:focus, .filtros input:focus {
    border-color: var(--primary);
    outline: none;
}

.paginacion {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.paginacion a, .paginacion span {
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    border: 1px solid #ddd;
    background: white;
    color: var(--primary);
}
.paginacion a:hover { background: var(--primary); color: white; border-color: var(--primary); }
.paginacion .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.paginacion .disabled {
    color: #ccc;
    cursor: not-allowed;
}

.total-info {
    margin-top: 15px;
    font-size: 13px;
    color: #888;
    text-align: center;
}

/* ============================================================
   22. LOGIN
   ============================================================ */
.login-container {
    background: white;
    border-radius: 16px;
    padding: 45px 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    margin: auto;
}
.logo {
    text-align: center;
    margin-bottom: 30px;
}
.logo h1 {
    font-size: 32px;
    color: #1a1a2e;
}
.logo h1 span { color: var(--primary); }
.logo .sub {
    color: #888;
    font-size: 14px;
    margin-top: 4px;
}
.credenciales {
    background: #e3f2fd;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 15px;
    font-size: 13px;
    color: #0d47a1;
    border: 1px solid #64b5f6;
}
.credenciales code {
    background: #1a1a2e;
    color: #64b5f6;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.footer {
    text-align: center;
    margin-top: 25px;
    font-size: 13px;
    color: #aaa;
    border-top: 1px solid #eee;
    padding-top: 20px;
}
.footer a {
    color: var(--primary);
    text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* ============================================================
   23. RESPONSIVE - TABLETS (max-width: 1024px)
   ============================================================ */
@media (max-width: 1024px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .noticias-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ============================================================
   24. RESPONSIVE - MÓVILES (max-width: 768px)
   ============================================================ */
@media (max-width: 768px) {
    .menu-toggle { display: block; }
    
    .sidebar {
        width: var(--sidebar-width-mobile);
        transform: translateX(-100%);
        padding: 20px 15px;
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .sidebar h2 { font-size: 1.4em; }
    .sidebar .subtitle { font-size: 11px; margin-bottom: 20px; }
    .sidebar .menu-label { font-size: 10px; margin: 10px 0 5px 10px; }
    .sidebar a { padding: 10px 12px; gap: 10px; }
    .sidebar a .icon { font-size: 16px; width: 24px; }
    .sidebar .version { display: none; }
    
    .main {
        margin-left: 0 !important;
        padding: 15px;
        padding-top: 70px;
    }
    
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .header h1 { font-size: 22px; text-align: center; }
    .header .user {
        justify-content: center;
        font-size: 13px;
        padding: 6px 14px;
        flex-wrap: wrap;
    }
    .header .user .btn-sm {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin-bottom: 20px;
    }
    .stat-card { padding: 12px 15px; }
    .stat-card .num { font-size: 1.6em; }
    .stat-card .label { font-size: 12px; }
    .stat-card .icon-big { font-size: 20px; top: 5px; right: 8px; }
    
    .card { padding: 15px; }
    .card h2 { font-size: 16px; }
    .card h3 { font-size: 15px; }
    
    .grid-2 { grid-template-columns: 1fr; gap: 12px; }
    .grid-3 { grid-template-columns: 1fr; gap: 12px; }
    
    .table-wrap { overflow-x: auto; }
    .table { min-width: 500px; font-size: 13px; }
    .table th, .table td { padding: 8px 6px; font-size: 12px; }
    
    .btn { padding: 8px 18px; font-size: 14px; }
    .btn-lg { padding: 12px 30px; font-size: 16px; width: 100%; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; text-align: center; }
    .quick-actions { flex-direction: column; }
    .quick-actions .btn { width: 100%; text-align: center; }
    
    .form-group input, .form-group select, .form-group textarea {
        font-size: 14px;
        padding: 8px 10px;
    }
    .form-group label { font-size: 13px; }
    
    .voice-selector { grid-template-columns: 1fr; padding: 12px; }
    .tab-buttons button {
        min-width: 60px;
        padding: 8px 10px;
        font-size: 11px;
        flex: 1 0 auto;
    }
    .selector-noticias {
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
    }
    .selector-noticias select { width: 100%; }
    .speed-control { flex-direction: column; align-items: stretch; padding: 12px; }
    .speed-control input[type="range"] { min-width: 100%; }
    .result-box { font-size: 14px; max-height: 250px; padding: 12px; }
    
    .noticias-grid { grid-template-columns: 1fr; gap: 12px; }
    .noticia-card { padding: 12px; }
    .noticia-card .titulo { font-size: 15px; }
    .noticia-card .contenido { font-size: 13px; }
    .noticia-card .meta { font-size: 11px; flex-direction: column; align-items: flex-start; gap: 3px; }
    .noticia-card .acciones .btn { font-size: 12px; padding: 4px 10px; }
    
    .horario-item { flex-direction: column; padding: 12px; gap: 8px; }
    .horario-item > * { width: 100%; }
    .horario-item .btn-remove { align-self: flex-end; }
    .preset-container { justify-content: center; }
    .preset-btn { padding: 6px 12px; font-size: 11px; }
    .dias-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }
    .dias-grid label { padding: 6px 10px; font-size: 13px; }
    .locutor-selector { flex-direction: column; align-items: stretch; padding: 12px; }
    .locutor-selector select { min-width: 100%; }
    
    .login-container { padding: 30px 25px; margin: 20px; }
    .logo h1 { font-size: 28px; }
    
    .modal-content { padding: 20px; max-width: 95%; }
    .modal-content .texto { font-size: 14px; }
    
    .cron-info code { font-size: 12px; padding: 6px 10px; word-break: break-all; }
    .api-status { font-size: 12px; padding: 8px 12px; }
    .tips { font-size: 12px; padding: 10px 12px; }
    .style-info { font-size: 12px; padding: 8px 12px; }
    .temperatura-info { font-size: 11px; padding: 6px 10px; }
    .audio-preview audio { max-width: 100%; }
}

/* ============================================================
   25. RESPONSIVE - MÓVILES PEQUEÑOS (max-width: 480px) ⭐ MEJORADO
   ============================================================ */
@media (max-width: 480px) {
    /* ---- Botón hamburguesa más pequeño ---- */
    .menu-toggle {
        top: 8px;
        left: 8px;
        padding: 6px 10px;
        font-size: 16px;
        border-radius: 6px;
    }
    
    /* ---- Sidebar más compacto ---- */
    .sidebar {
        width: 100%;
        max-width: 280px;
        padding: 12px 10px;
    }
    .sidebar h2 { font-size: 1.1em; }
    .sidebar .subtitle { font-size: 10px; margin-bottom: 15px; }
    .sidebar .menu-label { font-size: 8px; margin: 6px 0 3px 8px; }
    .sidebar a {
        padding: 6px 10px;
        gap: 6px;
        font-size: 13px;
        border-radius: 6px;
    }
    .sidebar a .icon { font-size: 14px; width: 20px; }
    .sidebar a .badge { font-size: 8px; padding: 1px 6px; }
    .sidebar .version { display: none; }
    
    /* ---- Main con menos padding ---- */
    .main {
        padding: 8px;
        padding-top: 55px;
    }
    
    /* ---- Header compacto ---- */
    .header {
        gap: 6px;
        margin-bottom: 12px;
    }
    .header h1 {
        font-size: 16px;
        text-align: center;
    }
    .header .user {
        font-size: 10px;
        padding: 4px 10px;
        gap: 4px;
        border-radius: 14px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .header .user .badge {
        font-size: 8px;
        padding: 1px 6px;
    }
    .header .user .btn-sm {
        font-size: 9px;
        padding: 2px 8px;
    }
    
    /* ---- Stats en 1 columna ---- */
    .stats {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-bottom: 12px;
    }
    .stat-card {
        padding: 6px 8px;
        border-radius: 8px;
    }
    .stat-card .num {
        font-size: 1em;
    }
    .stat-card .label {
        font-size: 9px;
        margin-top: 2px;
    }
    .stat-card .icon-big {
        font-size: 14px;
        top: 4px;
        right: 6px;
    }
    
    /* ---- Cards más compactas ---- */
    .card {
        padding: 10px;
        border-radius: 8px;
        margin-bottom: 10px;
    }
    .card h2 {
        font-size: 14px;
        margin-bottom: 10px;
        padding-bottom: 6px;
    }
    .card h3 {
        font-size: 13px;
        margin-bottom: 8px;
    }
    .card .subtitle {
        font-size: 11px;
    }
    
    /* ---- Grids a 1 columna ---- */
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    /* ---- Formularios más pequeños ---- */
    .form-group {
        margin: 6px 0;
    }
    .form-group label {
        font-size: 11px;
        margin-bottom: 2px;
    }
    .form-group input, 
    .form-group select, 
    .form-group textarea {
        font-size: 13px;
        padding: 6px 8px;
        border-radius: 6px;
        border-width: 1.5px;
    }
    .form-group .help {
        font-size: 10px;
    }
    .form-group .status {
        font-size: 10px;
    }
    .form-group input[type="checkbox"] {
        transform: scale(1);
        margin-right: 6px;
    }
    
    /* ---- Botones más pequeños ---- */
    .btn {
        padding: 6px 14px;
        font-size: 12px;
        border-radius: 6px;
    }
    .btn-sm {
        padding: 3px 8px;
        font-size: 10px;
    }
    .btn-lg {
        padding: 8px 20px;
        font-size: 14px;
    }
    .btn-group {
        gap: 6px;
        margin-top: 8px;
    }
    .btn-group .btn {
        width: 100%;
        text-align: center;
    }
    .quick-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    /* ---- Tablas muy compactas ---- */
    .table-wrap { 
        margin: 0 -6px;
        padding: 0 6px;
    }
    .table {
        min-width: 320px;
        font-size: 11px;
    }
    .table th {
        padding: 4px 6px;
        font-size: 9px;
    }
    .table td {
        padding: 4px 6px;
        font-size: 10px;
    }
    .table .btn-sm {
        font-size: 8px;
        padding: 1px 5px;
    }
    /* Ocultar columnas menos importantes */
    .table th:nth-child(3),
    .table td:nth-child(3),
    .table th:nth-child(5),
    .table td:nth-child(5),
    .table th:nth-child(6),
    .table td:nth-child(6) {
        display: none;
    }
    
    /* ---- Tabs más compactos ---- */
    .tabs {
        padding: 4px;
        gap: 2px;
        border-radius: 8px;
        margin-bottom: 12px;
    }
    .tabs a {
        padding: 4px 6px;
        font-size: 8px;
        min-width: 35px;
        border-radius: 5px;
        gap: 3px;
    }
    .tabs a .icon {
        font-size: 10px;
    }
    
    /* ---- Settings específicos ---- */
    .quality-badge {
        font-size: 9px;
        padding: 1px 8px;
    }
    .cbr-badge {
        font-size: 8px;
        padding: 1px 6px;
    }
    
    .provider-selector {
        flex-direction: column;
        gap: 6px;
    }
    .provider-option {
        min-width: unset;
        padding: 8px;
        border-radius: 6px;
    }
    .provider-option .provider-name {
        font-size: 13px;
    }
    .provider-option .provider-desc {
        font-size: 10px;
    }
    .provider-option .badge-status {
        font-size: 9px;
        padding: 1px 6px;
    }
    
    .ftp-checkboxes {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 6px;
    }
    .ftp-checkboxes label {
        font-size: 11px;
        padding: 2px 4px;
    }
    
    /* ---- Locutores table ---- */
    .locutores-table {
        font-size: 11px;
    }
    .locutores-table th {
        padding: 4px 6px;
        font-size: 9px;
    }
    .locutores-table td {
        padding: 4px 6px;
        font-size: 10px;
    }
    .locutor-badge {
        font-size: 8px;
        padding: 1px 5px;
    }
    .locutor-status {
        font-size: 10px;
    }
    .locutor-star {
        font-size: 7px;
        padding: 1px 4px;
    }
    
    .form-locutor {
        padding: 10px;
    }
    .form-locutor h3 {
        font-size: 13px;
    }
    
    .voz-input-group {
        gap: 4px;
    }
    .voz-input-group input {
        font-size: 12px;
        padding: 4px 6px;
    }
    .btn-demo {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    /* ---- Scheduler ---- */
    .scheduler-status {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 8px 12px;
    }
    .scheduler-status .item {
        font-size: 11px;
    }
    
    .dias-grid {
        grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
        gap: 4px;
    }
    .dias-grid label {
        font-size: 10px;
        padding: 4px 6px;
        gap: 4px;
    }
    .dias-grid input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }
    
    .horario-item {
        padding: 6px 8px;
        gap: 4px;
    }
    .horario-item label {
        font-size: 10px;
    }
    .horario-item input, 
    .horario-item select {
        font-size: 11px;
        padding: 4px 6px;
    }
    .horario-item .btn-remove {
        font-size: 10px;
        padding: 3px 10px;
    }
    
    .preset-btn {
        font-size: 9px;
        padding: 3px 8px;
    }
    .locutor-selector {
        padding: 8px;
        gap: 6px;
    }
    .locutor-selector label {
        font-size: 11px;
    }
    .locutor-selector select {
        font-size: 12px;
        padding: 4px 6px;
        min-width: 100%;
    }
    
    /* ---- Cron ---- */
    .cron-status-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        margin: 10px 0;
    }
    .cron-status-card {
        padding: 8px;
    }
    .cron-status-card .icon {
        font-size: 18px;
    }
    .cron-status-card .label {
        font-size: 10px;
    }
    .cron-status-card .sub {
        font-size: 9px;
    }
    
    /* ---- Status grid ---- */
    .status-grid {
        grid-template-columns: 1fr;
        gap: 4px;
        font-size: 10px;
    }
    
    /* ---- Selector noticias ---- */
    .selector-noticias {
        padding: 8px;
        gap: 6px;
        flex-direction: column;
        align-items: stretch;
    }
    .selector-noticias label {
        font-size: 11px;
    }
    .selector-noticias select {
        width: 100%;
        font-size: 12px;
        padding: 4px 8px;
    }
    
    /* ---- Speed control ---- */
    .speed-control {
        padding: 8px;
        gap: 6px;
        flex-direction: column;
        align-items: stretch;
    }
    .speed-control label {
        font-size: 11px;
    }
    .speed-control input[type="range"] {
        min-width: 100%;
        height: 4px;
    }
    .speed-control input[type="range"]::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }
    .speed-label {
        font-size: 12px;
        min-width: 30px;
    }
    .speed-hint {
        font-size: 9px;
    }
    
    /* ---- Voice selector ---- */
    .voice-selector {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px;
    }
    .voice-selector label {
        font-size: 11px;
    }
    .voice-selector select {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    /* ---- Tab buttons ---- */
    .tab-buttons {
        gap: 4px;
    }
    .tab-buttons button {
        min-width: 40px;
        padding: 4px 6px;
        font-size: 9px;
        border-radius: 5px;
    }
    
    /* ---- Noticias ---- */
    .noticias-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .noticia-card {
        padding: 8px;
        border-left-width: 3px;
    }
    .noticia-card .titulo {
        font-size: 13px;
    }
    .noticia-card .contenido {
        font-size: 11px;
        max-height: 50px;
        overflow: hidden;
    }
    .noticia-card .meta {
        font-size: 9px;
        flex-direction: column;
        gap: 2px;
    }
    .noticia-card .acciones .btn {
        font-size: 9px;
        padding: 2px 8px;
    }
    
    /* ---- Modal ---- */
    .modal-content {
        padding: 12px;
        max-width: 98%;
        border-radius: 8px;
    }
    .modal-content h3 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    .modal-content .texto {
        font-size: 12px;
        padding: 8px;
    }
    .modal-content .close {
        font-size: 18px;
        top: 8px;
        right: 10px;
    }
    
    /* ---- Login ---- */
    .login-container {
        padding: 16px 14px;
        margin: 8px;
        border-radius: 10px;
    }
    .logo h1 {
        font-size: 20px;
    }
    .logo .sub {
        font-size: 11px;
    }
    .form-group input {
        font-size: 13px;
        padding: 8px 10px;
    }
    .btn-block {
        font-size: 14px;
        padding: 10px;
    }
    .credenciales {
        font-size: 10px;
        padding: 8px 10px;
    }
    .credenciales code {
        font-size: 10px;
    }
    .footer {
        font-size: 10px;
        padding-top: 12px;
        margin-top: 15px;
    }
    
    /* ---- Result box ---- */
    .result-box {
        font-size: 12px;
        padding: 8px;
        max-height: 150px;
    }
    
    /* ---- Info boxes ---- */
    .info-box {
        font-size: 10px;
        padding: 6px 8px;
    }
    .info-box code {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    /* ---- Badges ---- */
    .badge, 
    .badge-prioridad, 
    .badge-categoria, 
    .badge-tipo {
        font-size: 8px;
        padding: 1px 6px;
    }
    .ia-badge {
        font-size: 8px;
        padding: 1px 6px;
    }
    
    /* ---- Audio ---- */
    audio {
        margin: 8px 0;
    }
    .audio-preview {
        padding: 8px;
    }
    .audio-preview p {
        font-size: 11px;
    }
    .audio-preview audio {
        max-width: 100%;
    }
    
    /* ---- Paginación ---- */
    .paginacion a, 
    .paginacion span {
        padding: 3px 8px;
        font-size: 10px;
        border-radius: 4px;
    }
    .total-info {
        font-size: 10px;
        margin-top: 8px;
    }
    
    /* ---- Filtros ---- */
    .filtros {
        gap: 6px;
    }
    .filtros select, 
    .filtros input {
        font-size: 11px;
        padding: 4px 8px;
        border-radius: 4px;
    }
    
    /* ---- Cron info ---- */
    .cron-info {
        padding: 10px;
        margin-top: 12px;
    }
    .cron-info h3 {
        font-size: 13px;
    }
    .cron-info p {
        font-size: 11px;
    }
    .cron-info code {
        font-size: 9px;
        padding: 4px 8px;
    }
    
    /* ---- Mensajes ---- */
    .mensaje {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 6px;
        margin-bottom: 12px;
    }
    .error, .success {
        padding: 10px 12px;
        font-size: 12px;
        border-radius: 6px;
        margin-bottom: 12px;
    }
    
    /* ---- API status ---- */
    .api-status {
        font-size: 10px;
        padding: 6px 10px;
    }
    .tips {
        font-size: 10px;
        padding: 6px 10px;
    }
    .style-info {
        font-size: 10px;
        padding: 6px 10px;
    }
    .temperatura-info {
        font-size: 9px;
        padding: 4px 8px;
    }
    
    /* ---- Meta info ---- */
    .meta-info {
        font-size: 10px;
        padding: 6px 8px;
        gap: 4px;
    }
    
    /* ---- Empty states ---- */
    .empty {
        padding: 20px;
        font-size: 12px;
    }
    .empty .icon {
        font-size: 30px;
        margin-bottom: 6px;
    }
    .empty-text {
        font-size: 12px;
        padding: 10px;
    }
    
    /* ---- Textos ---- */
    .text-muted {
        font-size: 10px;
    }
    .help-text {
        font-size: 10px;
    }
    .subtitle {
        font-size: 11px;
    }
}

/* ============================================================
   26. RESPONSIVE - PANTALLAS MUY GRANDES (min-width: 1400px)
   ============================================================ */
@media (min-width: 1400px) {
    .stats { grid-template-columns: repeat(4, 1fr); }
    .noticias-grid { grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); }
    .main { padding: 40px 50px; max-width: 1600px; margin-left: var(--sidebar-width); }
    .card { padding: 35px; }
    .header h1 { font-size: 34px; }
}