/* --- CONTENEDOR MAESTRO DEL PANEL --- */
.admin-panel-container, .admin-worker-layout {
    display: flex !important;
    flex-direction: row !important;
    background: #ffffff;
    /* Eliminamos el border-radius y margin para que pegue a los bordes */
    border-radius: 0; 
    border: none;
    margin: 0; 
    /* Quitamos el límite de 1100px */
    width: 100% !important;
    max-width: 100% !important; 
    height: 100%;
    overflow: hidden;
    align-items: stretch;
}

/* --- SIDEBAR IZQUIERDO --- */
.panel-sidebar {
    width: 260px;
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    flex-shrink: 0;
}

.panel-sidebar h2 {
    font-size: 0.75rem;
    color: #999;
    text-transform: uppercase;
    padding: 25px 20px 10px;
    letter-spacing: 1.2px;
    margin: 0;
}

.panel-sidebar ul {
    list-style: none !important;
    padding: 0;
    margin: 0;
}

/* --- ENLACES DE PESTAÑAS --- */
.tab-link {
    padding: 15px 25px;
    cursor: pointer;
    font-size: 0.95rem;
    color: #555;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.tab-link:hover {
    background: #eef2f7;
    color: var(--accent);
}

.tab-link.active {
    background: #ffffff !important;
    color: var(--accent) !important;
    font-weight: bold;
    border-left: 5px solid var(--accent);
    margin-right: -1px; /* Para solapar el borde del sidebar */
}

/* --- CONTENIDO DERECHO --- */
.panel-content {
    flex: 1;
    padding: 40px;
    background: #ffffff;
    position: relative;
}

.section-header h3 {
    margin-bottom: 25px;
    font-size: 1.4rem;
    color: var(--primary);
}

/* --- FORMULARIO EN GRID --- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field.full {
    grid-column: span 2;
}

.field label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #666;
}

.field input, .field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    font-size: 0.95rem;
}

/* --- PREVISUALIZACIONES --- */
.upload-flex {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.upload-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.preview-square { width: 140px; height: 140px; background: #eee; border-radius: 8px; border: 2px dashed #ccc; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preview-banner { width: 280px; height: 100px; background: #eee; border-radius: 8px; border: 2px dashed #ccc; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* --- BOTONERA FINAL --- */
.panel-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    text-align: right;
}

.btn-save {
    background: var(--success);
    color: white;
    padding: 12px 35px;
    font-size: 1rem;
    border-radius: 6px;
    font-weight: bold;
}

/*
* calendario
*/

.day-row { 
    display: grid; 
    grid-template-columns: 100px 1fr 85px 160px; /* Nombre | Barra | Total | Botones */
    align-items: center; 
    gap: 15px; 
    padding: 15px 0; 
    border-bottom: 1px solid #f1f5f9; 
}

.day-off { 
    opacity: 0.5; 
    background: #f8fafc; 
}

.day-name { 
    font-weight: bold; 
    text-transform: capitalize; 
    color: #1e293b; 
    font-size: 0.9rem;
}

.timeline-wrapper { 
    position: relative; 
    width: 100%; 
    padding: 10px 0; 
}

.timeline { 
    position: relative; 
    height: 28px; 
    background: #e2e8f0; /* Color de fondo gris */
    border-radius: 6px; 
    border: 1px solid #cbd5e1; 
    overflow: visible; /* Importante para que las etiquetas de hora se vean */
}

/* El bloque azul de la jornada completa */
.time-block { 
    position: absolute; 
    height: 100%; 
    background: #dbeafe; 
    border-left: 3px solid #2563eb; 
    z-index: 10; 
}

/* El bloque amarillo de los descansos */
.break-block { 
    position: absolute; 
    height: 100%; 
    background: #fef3c7; 
    border-left: 2px solid #d97706; 
    z-index: 20; /* Por encima del azul */
    box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.2);
}

/* Las etiquetas de hora (08:00, 17:00) */
.time-tag { 
    position: absolute; 
    top: -20px; 
    font-size: 10px; 
    font-weight: bold; 
    color: #2563eb; 
    transform: translateX(-50%); 
    white-space: nowrap; 
    z-index: 30;
}

.horas-totales { 
    text-align: center; 
    font-weight: bold; 
    color: #2563eb; 
    font-size: 0.85rem; 
    background: #eff6ff; 
    padding: 6px 4px; 
    border-radius: 6px; 
    border: 1px dashed #bfdbfe; 
}

.status-badge { 
    font-size: 10px; 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-weight: bold;
}

/* Contenedor de botones a la derecha */
.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Estilo base de los botones circulares */
.actions .btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e2e8f0;
    background: white;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

/* Efectos al pasar el ratón */
.actions .btn:hover {
    background: #f1f5f9;
    color: #2563eb;
    border-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

/* Color especial para el botón de Editar */
.actions .btn[title="Editar"] {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.actions .btn[title="Editar"]:hover {
    background: #2563eb;
    color: white;
}

/* Estilo para cuando el botón de Pegar está disponible */
.actions .btn[title="Pegar"] {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

/* El fondo oscuro que cubre toda la pantalla */
.modal-overlay {
    display: none; /* Se activa con .style.display = 'flex' desde JS */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* Oscurece el fondo */
    backdrop-filter: blur(4px);    /* Opcional: desenfoca lo de atrás */
    z-index: 9999;                 /* Siempre por encima de todo */
    align-items: center;           /* Centra verticalmente */
    justify-content: center;       /* Centra horizontalmente */
}

/* La caja blanca del popup */
.modal-box {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: aparecerModal 0.3s ease-out;
}

@keyframes aparecerModal {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* 1. Estructura de la Cuadrícula de 12 meses */
.year-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; /* Reducimos el espacio entre meses */
    padding: 10px 0;
    max-width: 900px; /* Reducimos el ancho máximo de 1200 a 900 */
    margin: 0 auto;
}

/* Ajuste para tablets y móviles (2 columnas o 1 sola) */
@media (max-width: 1024px) {
    .year-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .year-grid {
        grid-template-columns: 1fr;
    }
}

.month-container {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px; /* Bordes más finos */
    padding: 10px;    /* Menos relleno interno */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.month-title {
    text-align: center;
    font-weight: bold;
    text-transform: capitalize;
    margin-bottom: 8px;
    color: #1e293b;
    font-size: 0.9rem; /* Fuente de mes más pequeña */
}

.month-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px; /* Días casi pegados para ahorrar espacio */
}

.day-label {
    font-size: 0.65rem; /* Etiquetas L, M, X más pequeñas */
    text-align: center;
    font-weight: 800;
    color: #94a3b8;
    padding-bottom: 4px;
}

/* 3. Celdas de días reducidas */
.calendar-day-cell {
    aspect-ratio: 1/1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem; /* Números más pequeños */
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-weight: 500;
}

.calendar-day-cell:hover {
    background: #f1f5f9;
    transform: scale(1.1);
    z-index: 10;
}

.calendar-day-cell.weekend {
    color: #ef4444;
    background: #fff1f2;
}

.calendar-day-cell.other-month {
    visibility: hidden;
}

/* 3. Cabecera y Navegación de Años (Botones Grandes) */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.year-nav button {
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    color: #334155;
}

.year-nav button:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}
/* --- 1. Contenedor de Pinceles --- */
.pincel-container {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
    align-items: center;
}

/* --- 2. Estilo Base del Botón (Leyenda Permanente) --- */
.btn-pincel {
    flex: 1;
    min-width: 130px;
    padding: 12px 10px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px solid transparent; /* Espacio para el borde activo */
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* --- 3. Estado Activo (Resaltado) --- */
.btn-pincel.active {
    border-color: #334155 !important; /* Borde oscuro para resaltar selección */
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    filter: brightness(0.95);
}

.btn-pincel:hover {
    filter: brightness(0.9);
}

/* --- 4. Definición de Colores (Celdas y Botones) --- */

/* Vacaciones / Empresa (Verde) */
.vacaciones, .empresa, .calendar-day-cell.vacaciones, .calendar-day-cell.empresa, .btn-pincel.vacaciones { 
    background-color: #dcfce7 !important; color: #166534 !important; border-color: #86efac; 
}

/* Baja / Nacional (Rojo) */
.baja, .nacional, .calendar-day-cell.baja, .calendar-day-cell.nacional, .btn-pincel.baja { 
    background-color: #fecaca !important; color: #991b1b !important; border-color: #fca5a5; 
}

/* Asuntos Propios (Morado) */
.asuntos_prop, .calendar-day-cell.asuntos_prop, .btn-pincel.asuntos_prop { 
    background-color: #f3e8ff !important; color: #6b21a8 !important; border-color: #d8b4fe; 
}

/* Intensiva / Autonómico (Naranja) */
.intensiva, .autonomico, .calendar-day-cell.intensiva, .calendar-day-cell.autonomico, .btn-pincel.intensiva { 
    background-color: #ffedd5 !important; color: #9a3412 !important; border-color: #fdba74; 
}

/* Recuperable / Cierre / Local (Azul/Amarillo) */
.recuperable, .vacaciones_cierre, .calendar-day-cell.recuperable, .calendar-day-cell.vacaciones_cierre, .btn-pincel.recuperable { 
    background-color: #e0f2fe !important; color: #075985 !important; border-color: #7dd3fc; 
}

.local, .calendar-day-cell.local { 
    background-color: #fef9c3 !important; color: #854d0e !important; border-color: #fde047; 
}

/* --- 5. Modales y Utilidades --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
}
.modal-content {
    background: white; padding: 25px; border-radius: 12px;
    width: 90%; max-width: 400px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.hidden { display: none !important; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-weight: bold; margin-bottom: 5px; font-size: 0.9rem; }
.form-group input, .form-group select { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* El fondo oscuro */
#modal-container {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex; align-items: center; justify-content: center;
    z-index: 9999; /* Por encima de todo */
}

.overlay-monitor {
    position: absolute;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Contenedor principal del modal más estilizado y compacto */
.modal-detalles-monitor {
    position: relative;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    width: 95%;
    max-width: 600px;
    
    /* --- AJUSTE PARA SCROLL INTELIGENTE --- */
    max-height: 90vh;        /* No supera el 90% de la altura de la pantalla */
    overflow-y: auto;       /* Si el contenido supera el max-height, aparece el scroll */
    display: flex;          /* Ayuda a que los elementos internos fluyan mejor */
    flex-direction: column; /* Mantiene el orden de arriba a abajo */
}

/* Filas de tramos en una sola línea */
.tramo-fila-doble {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    padding: 5px 10px;
    background: #f1f5f9;
    border-radius: 6px;
}

.tramo-label-container {
    flex: 0 0 100px; /* Ancho fijo para las etiquetas/selects */
}

.tramo-inputs-horas {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-grow: 1;
}

.tramo-inputs-horas input[type="time"] {
    padding: 3px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Los Extras (Km y Dietas) en una sola línea */
.linea-extras {
    display: flex;
    gap: 20px;
    margin: 15px 0;
    padding: 10px;
    background: #eff6ff;
    border-radius: 8px;
}

.linea-extras .input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.linea-extras input {
    width: 80px;
    padding: 4px;
}

/* Notas más bajas */
#edit-notas {
    width: 100%;
    resize: none;
    height: 50px; /* Altura reducida */
    margin-top: 5px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 5px;
}

.badge-jornada {
    background: #2563eb;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
}