/* Badge tipo actividad en bloques */
.dvhora .badge {
    font-size: 0.7rem;
    font-weight: normal;
    margin: 2px 0;
    display: inline-block;
    opacity: 0.9;
}
:root {
    --primary-color: #4a90e2;
    --secondary-color: #7b68ee;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #f5222d;
    --light-bg: #f8f9fa;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --hover-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    background-color: var(--light-bg);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.container {
    max-width: 1400px;
}

/* Tarjetas y secciones */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--hover-shadow);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

/* Selectores mejorados */
.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-select, .form-control {
    border-radius: 8px;
    border: 1.5px solid #e0e0e0;
    padding: 0.6rem 1rem;
    transition: all 0.3s ease;
}

.form-select:focus, .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.15);
}

/* Botones mejorados */
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.2rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.35);
}

.btn-outline-dark {
    border: 2px solid #dee2e6;
    color: #495057;
    background: white;
}

.btn-outline-info {
    border: 2px solid #17a2b8;
    color: #17a2b8;
    background: white;
}

/* Tabla del horario */
#tablaHorario {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

#tablaHorario thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

#tablaHorario thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

#tablaHorario tbody tr {
    transition: background-color 0.2s ease;
}

#tablaHorario tbody tr:hover {
    background-color: rgba(74, 144, 226, 0.05);
}

#tablaHorario tbody td {
    border: 1px solid #f0f0f0;
    vertical-align: middle;
    position: relative;
}

.horario-celda {
    min-width: 140px;
    height: 80px;
    transition: all 0.3s ease;
    background: white;
}

.horario-celda:hover:not(.bloqueado) {
    background-color: rgba(74, 144, 226, 0.08);
    cursor: pointer;
}

/* Bloques de horario */
.dvhora {
    /*background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    border: none;
    border-radius: 8px;
    padding: 8px;
    font-size: 1rem;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: move;
}

.dvhora:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.horario-celda .dvhora {
    position: absolute;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    margin: 4px;
}

/* Pausa entre tramos */
.pausa-tramo td {
    border-top: 3px solid var(--success-color) !important;
    position: relative;
}

.pausa-tramo td:first-child::before {
    content: "DESCANSO";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--success-color);
    font-weight: 600;
    background: white;
    padding: 0 8px;
}

/* Celdas de pausa (recreo/almuerzo) en timeline */
.celda-pausa {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px dashed #7dd3fc;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 0;
}

.pausa-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #0369a1;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Orden de tramos */
.orden-circulo {
    width: 2em;
    height: 2em;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.orden-par {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.orden-impar {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

/* Zona de eliminación */
#papelera {
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 12px;
    transition: all 0.3s ease;
    width: 100px !important;
    height: 100px !important;
}

#papelera:hover {
    border-color: var(--danger-color);
    background-color: #fff5f5;
}

#papelera.bg-danger-subtle {
    background-color: #ffe0e0;
    border-color: var(--danger-color);
    transform: scale(1.1);
}

/* Bloques no asignados */
#contenedorNoAsignados {
    min-height: 60px;
    padding: 1rem;
    background: #fafafa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.bloque-no-asignado {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 4px;
    cursor: grab;
    font-size: 0.8em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Instrucciones mejoradas */
#bloqueInstrucciones {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    color: white;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

#bloqueInstrucciones strong {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: block;
}

#bloqueInstrucciones ul {
    margin: 0;
    padding-left: 1.5rem;
}

#bloqueInstrucciones li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Modales mejorados */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border-radius: 12px 12px 0 0;
    border: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #f0f0f0;
    padding: 1rem 1.5rem;
}

/* Iconos y botones de bloque */
.btn-duplicar, .btn-presencial {
    background: white;
    border-radius: 6px;
    padding: 4px;
    transition: all 0.3s ease;
}

.btn-duplicar:hover, .btn-presencial:hover {
    transform: scale(1.2);
    background: #f0f0f0;
}

/* Indicador de carga */
.loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.loading-indicator.active {
    display: block;
}

/* Efecto para bloqueados */
.bloqueado {
    background: repeating-linear-gradient(
        45deg,
        #f5f5f5,
        #f5f5f5 10px,
        #fafafa 10px,
        #fafafa 20px
    );
    pointer-events: none;
}

/* Badges y alertas */
.alert-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    #tablaHorario {
        font-size: 0.8rem;
    }

    .horario-celda {
        min-width: 100px;
        height: 60px;
    }
}

/* Ajustar tabla al contenedor completo */
.container {
    max-width: 100%;
    padding: 0 15px;
}

/* === TIMELINE LAYOUT === */
.horario-timeline-container {
    display: flex;
    background: white;
    border-radius: 12px;
    overflow: auto;
    box-shadow: var(--card-shadow);
    margin: 20px 0;
    max-height: 900px;
}

/* Time Axis (Y-axis) - Solo marcas de referencia */
.hora-axis {
    flex: 0 0 70px;
    background: #f8f9fa;
    color: #6c757d;
    position: relative;
    border-right: 1px solid #dee2e6;
}

.hora-axis::before {
    content: '';
    display: block;
    height: 46px; /* Altura del dia-header para desplazar marcas hacia abajo */
}

.hora-mark {
    position: absolute;
    width: 100%;
    display: flex;
    align-items: flex-end; /* Alinear texto en la parte inferior */
    justify-content: flex-end;
    font-size: 0.7rem;
    font-weight: 400;
    padding-right: 8px;
    padding-bottom: 2px;
    color: #6c757d;
    height: auto;
    transform: translateY(46px); /* Desplazar todas las marcas hacia abajo */
}

.hora-mark::before {
    content: none; /* Eliminar la línea pequeña del tick */
}

/* Day Columns - Sin filas, solo espacio continuo */
.dia-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
    min-width: 0;
}

.dia-column:last-child {
    border-right: none;
}

.dia-header {
    background: white;
    color: #495057;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid #dee2e6;
    flex: 0 0 auto;
}

.dia-content {
    position: relative;
    flex: 1;
    background: white;
    /* Sin líneas de fondo - espacio limpio */
}

/* Bloques en timeline - posicionamiento absoluto fluido */
.dia-content .dvhora {
    position: absolute;
    left: 2px;
    right: 2px;
    width: calc(100% - 4px);
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
    padding: 6px 4px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    cursor: move;
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
}

/* La etiqueta de horario ahora está en la celda, no en el bloque */

/* Columna horario más ancha */
#tablaHorario thead th:first-child,
#tablaHorario tbody td:first-child {
    width: 150px !important;
    min-width: 150px;
}

/* Celdas de tramos horarios */
.horario-celda {
    position: relative;
    transition: background-color 0.2s ease;
}

.horario-celda:hover:not(:has(.dvhora)) {
    background-color: rgba(74, 144, 226, 0.05);
    cursor: pointer;
}

/* Etiqueta de tramo horario en la celda */
.tramo-horario-label {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
    font-weight: 500;
}

/* Ocultar etiqueta cuando hay bloque */
.horario-celda:has(.dvhora) .tramo-horario-label {
    display: none;
}

.horario-celda .dvhora {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    margin: 0;
    z-index: 2;
}

/* Icono añadir solo en hover */
.add-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #6c757d;
    font-size: 1.4rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.horario-celda:hover .add-icon {
    opacity: 0.7;
    pointer-events: auto;
}

/* Botón duplicar visible */
.btn-duplicar {
    position: absolute;
    bottom: 4px;
    right: 4px;
    cursor: pointer;
    font-size: 0.8em;
    opacity: 0.7;
    z-index: 10;
    padding: 2px 4px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
}

/* Espaciado entre botones */
.btn-group .btn {
    margin-right: 0.5rem;
}

/* Zona de eliminación ajustada */
#papelera {
    width: 80px !important;
    height: 80px !important;
}

/* Bloques sin comprimir texto */
.dvhora {
    font-size: 1rem;
    line-height: 1.2;
    padding: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Orden círculo mejorado */
.orden-circulo {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
}

.tramo-hora {
    margin-left: 45px;
    font-size: 0.85rem;
}
