/* Estilos generales */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Layout principal */
#main-container {
    min-height: calc(100vh - 120px); /* Altura total menos navbar y footer */
}

/* Sidebar */
.sidebar {
    width: 400px;
    background: white;
    border-right: 1px solid #dee2e6;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 1000;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: relative;
}

.sidebar.collapsed {
    transform: translateX(-100%);
    width: 0;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
}

.sidebar.collapsed .sidebar-collapsed-toggle {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.sidebar-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-title {
    transition: opacity 0.3s ease;
}

.sidebar-content {
    height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Botón de toggle cuando está colapsado */
.sidebar-collapsed-toggle {
    position: absolute;
    top: 20px;
    left: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-20px);
    transition: all 0.3s ease;
    z-index: 1001;
}

.sidebar-collapsed-toggle .btn {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
}

.sidebar-collapsed-toggle .btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

/* Botón de toggle del sidebar */
#sidebar-toggle {
    transition: transform 0.3s ease;
}

.sidebar.collapsed #sidebar-toggle {
    transform: rotate(180deg);
}

/* Contenido principal */
.main-content {
    flex: 1;
    transition: margin-left 0.3s ease;
    min-width: 0; /* Importante para que flex funcione correctamente */
}

.main-content.expanded {
    margin-left: 0;
}

/* Botón de toggle móvil */
#sidebar-toggle-mobile {
    display: none;
}

/* Header */
header {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Acordeones personalizados */
.accordion-item {
    border: none;
    border-radius: 12px !important;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.accordion-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.accordion-button {
    border: none !important;
    border-radius: 12px 12px 0 0 !important;
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem 1.25rem;
    transition: all 0.3s ease;
}

.accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
    color: white !important;
    box-shadow: none;
}

.accordion-button.collapsed {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    color: #495057 !important;
}

.accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.accordion-button::after {
    background-size: 1.25rem;
    transition: all 0.3s ease;
}

.accordion-button:not(.collapsed)::after {
    filter: brightness(0) invert(1);
}

.accordion-body {
    padding: 1.5rem;
    background: white;
    border-radius: 0 0 12px 12px;
}

/* Alineación de columnas */
.row.g-4 {
    align-items: flex-start;
}

.col-lg-5, .col-lg-7 {
    display: flex;
    flex-direction: column;
}

.col-lg-5 .accordion {
    flex: 1;
}

.col-lg-7 .accordion {
    flex: 1;
}

/* Cards */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card-header {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    color: white;
    border-radius: 12px 12px 0 0 !important;
    border: none;
}

.card-header.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
}

/* Empleados mejorados */
.employee-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.employee-item:hover {
    background: rgba(0,123,255,0.05);
    transform: translateX(4px);
}

.employee-item.selected {
    background: rgba(40,167,69,0.05);
}

.employee-item.selected:hover {
    background: rgba(40,167,69,0.08);
}

.employee-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #007bff;
}

.employee-name {
    flex: 1;
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
    margin: 0;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.employee-name:hover {
    background-color: rgba(0,123,255,0.1);
    color: #007bff;
}

.employee-actions {
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.employee-item:hover .employee-actions {
    opacity: 1;
}

.edit-employee-btn, .delete-employee-btn {
    background: none;
    border: none;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.edit-employee-btn {
    color: #6c757d;
}

.edit-employee-btn:hover {
    background-color: #007bff;
    color: white;
}

.delete-employee-btn {
    color: #6c757d;
}

.delete-employee-btn:hover {
    background-color: #dc3545;
    color: white;
}

.save-name-btn, .cancel-name-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-name-btn {
    background-color: #28a745;
    color: white;
}

.save-name-btn:hover {
    background-color: #218838;
    transform: scale(1.05);
}

.cancel-name-btn {
    background-color: #6c757d;
    color: white;
}

.cancel-name-btn:hover {
    background-color: #5a6268;
    transform: scale(1.05);
}

/* Empleados */
.employee-badge {
    display: inline-block;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    margin: 2px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Plantillas de turno */
.shift-template {
    border-left: 4px solid #28a745;
    background-color: #f8f9fa;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.shift-template-header {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.shift-template-details {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Tabla de horarios */
.table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.table th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.schedule-cell {
    font-size: 0.85rem;
    line-height: 1.2;
}

.schedule-cell-shift {
    font-weight: 600;
    color: #495057;
}

.schedule-cell-time {
    color: #6c757d;
    font-size: 0.75rem;
}

/* Estados de turnos */
.shift-free {
    background-color: #d4edda !important;
    color: #155724;
    text-align: center;
    font-weight: 500;
}

.shift-d1 {
    background-color: #d1ecf1 !important;
    color: #0c5460;
}

.shift-d2 {
    background-color: #cce5ff !important;
    color: #004085;
}

.shift-sa, .shift-sb {
    background-color: #fff3cd !important;
    color: #856404;
}

.shift-su {
    background-color: #f8d7da !important;
    color: #721c24;
}

.shift-part4 {
    background-color: #e2e3e5 !important;
    color: #383d41;
}

/* Botones */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #6610f2 100%);
    border: none;
}

/* Alertas */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

/* Loading */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Inputs de empleados */
.employee-input {
    margin-bottom: 10px;
}

.employee-input .form-control {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.2s ease;
}

.employee-input .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* Media queries */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .employee-toggle-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .employee-toggle-btn .employee-name {
        font-weight: 500;
        color: #495057;
    }

    .employee-toggle-btn.active .employee-name {
        font-weight: 600;
        color: #fff;
    }

    .employee-actions {
        gap: 0.25rem;
    }

    .edit-employee-btn, .delete-employee-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 320px;
        z-index: 1050;
        transition: left 0.3s ease;
    }

    .sidebar.show {
        left: 0;
    }

    .sidebar.collapsed {
        left: -100%;
    }

    .sidebar-content {
        height: calc(100vh - 80px);
    }

    #sidebar-toggle-mobile {
        display: block;
    }

    #sidebar-toggle {
        display: none;
    }

    /* Ocultar botón colapsado en móvil */
    .sidebar-collapsed-toggle {
        display: none;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    .accordion-button {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .accordion-body {
        padding: 1rem;
    }

    .col-lg-5, .col-lg-7 {
        width: 100%;
    }

    .accordion-collapse {
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    .employee-toggle-btn {
        min-width: 140px;
        padding: 8px 10px;
        font-size: 0.85rem;
        gap: 6px;
        font-weight: 700;
    }
    
    .employee-toggle-btn .employee-name {
        font-size: 0.8rem;
        font-weight: 700;
    }
    
    .employee-toggle-btn.active .employee-name {
        text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    }
    
    .employee-actions {
        gap: 2px;
    }
    
    .edit-employee-btn, .delete-employee-btn {
        padding: 3px 5px;
        font-size: 0.75rem;
    }
    
    .sidebar {
        width: 280px;
    }
    
    .sidebar-content {
        padding: 1rem !important;
    }
    
    .accordion-button {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .accordion-body {
        padding: 0.75rem;
    }
}

/* Animaciones */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* Tooltip personalizado */
.tooltip {
    font-size: 0.8rem;
}

.tooltip-inner {
    background-color: #343a40;
    color: white;
    border-radius: 6px;
}

/* Coverage items */
.coverage-item {
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background-color: white;
    text-align: center;
}

.coverage-item:last-child {
    border-right: 1px solid #e9ecef;
}

.coverage-day {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.coverage-count {
    font-size: 1.2rem;
    font-weight: 700;
    color: #007bff;
    margin-top: 5px;
}

/* Estados de horas */
.hours-warning {
    background-color: #fff3cd;
    color: #856404;
}

.hours-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.hours-success {
    background-color: #d4edda;
    color: #155724;
}

/* === LEYENDA MEJORADA === */
.schedule-main-container {
    padding: 0;
}

.legend-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e3e6ea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.legend-card .card-header {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    padding: 12px 20px;
    border-bottom: none;
}

.legend-card .card-header h6 {
    font-weight: 600;
    font-size: 0.85rem;
    margin: 0;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    height: 100%;
    min-height: 60px;
}

.legend-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border-color: #007bff;
}

.legend-badge {
    flex-shrink: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.7rem;
    color: white;
    margin-right: 10px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
    cursor: help;
    position: relative;
}

.legend-item:hover .legend-badge {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

.legend-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.legend-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: #343a40;
    line-height: 1.1;
}

.legend-time {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 500;
}

.legend-hours {
    font-size: 0.65rem;
    color: #007bff;
    font-weight: 600;
    background-color: rgba(0,123,255,0.1);
    padding: 1px 4px;
    border-radius: 3px;
    align-self: flex-start;
}

/* Colores específicos para badges de leyenda */
.legend-item.shift-d1 .legend-badge {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
}

.legend-item.shift-d2 .legend-badge {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.legend-item.shift-saturday .legend-badge {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
}

.legend-item.shift-sunday .legend-badge {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.legend-item.shift-part4 .legend-badge {
    background: linear-gradient(135deg, #6c757d 0%, #545b62 100%);
}

.legend-item.shift-free .legend-badge {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Tabla de horarios mejorada */
.schedule-table {
    margin-top: 0;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
}

.schedule-table thead th {
    background: linear-gradient(135deg, #343a40 0%, #495057 100%);
    color: white;
    border: none;
    padding: 15px 10px;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
}

.employee-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
    width: 140px;
}

.day-header {
    text-align: center;
    min-width: 100px;
}

.day-name {
    font-weight: 700;
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.day-date {
    font-size: 0.7rem;
    opacity: 0.8;
}

.hours-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    width: 80px;
}

.employee-row {
    transition: all 0.2s ease;
}

.employee-row:hover {
    background-color: rgba(0,123,255,0.05);
}

.employee-cell {
    background-color: #f8f9fa;
    border-right: 2px solid #dee2e6;
}

.employee-info {
    display: flex;
    align-items: center;
    font-weight: 600;
    color: #495057;
}

.schedule-cell {
    padding: 8px 6px;
    text-align: center;
    vertical-align: middle;
    border-right: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.schedule-cell:hover {
    transform: scale(1.02);
}

.shift-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px;
}

.shift-badge {
    font-weight: 700;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 35px;
    text-align: center;
}

.shift-time {
    font-size: 0.65rem;
    opacity: 0.8;
    font-weight: 500;
}

.shift-hours {
    font-size: 0.65rem;
    font-weight: 600;
    color: #007bff;
}

/* Colores de celdas de turnos */
.shift-d1 {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border-left: 4px solid #17a2b8;
}

.shift-d2 {
    background: linear-gradient(135deg, #cce7ff 0%, #b3d7ff 100%);
    border-left: 4px solid #007bff;
}

.shift-saturday {
    background: linear-gradient(135deg, #fff3cd 0%, #ffec9e 100%);
    border-left: 4px solid #ffc107;
}

.shift-sunday {
    background: linear-gradient(135deg, #f8d7da 0%, #f1b0b7 100%);
    border-left: 4px solid #dc3545;
}

.shift-part4 {
    background: linear-gradient(135deg, #e2e3e5 0%, #d6d8db 100%);
    border-left: 4px solid #6c757d;
}

.shift-free {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 4px solid #28a745;
    color: #155724;
}

.hours-cell {
    background-color: #f8f9fa;
    border-left: 2px solid #dee2e6;
    text-align: center;
    padding: 15px 8px;
}

.hours-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hours-status {
    font-size: 0.7rem;
    font-weight: 500;
}

.hours-perfect {
    color: #28a745;
}

.hours-perfect .hours-status {
    color: #28a745;
}

.hours-good {
    color: #17a2b8;
}

.hours-good .hours-status {
    color: #17a2b8;
}

.hours-warning {
    color: #ffc107;
}

.hours-warning .hours-status {
    color: #e0a800;
}

.hours-danger {
    color: #dc3545;
}

.hours-danger .hours-status {
    color: #c82333;
}

/* Estadísticas mejoradas */
.stats-card {
    border: 1px solid #e3e6ea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.stats-card .card-header {
    background: linear-gradient(135deg, #495057 0%, #343a40 100%);
    color: white;
    padding: 12px 16px;
    border-bottom: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 5px 0;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #007bff;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.shift-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.distribution-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background-color: #f8f9fa;
    border-radius: 6px;
    font-size: 0.85rem;
}

.distribution-badge {
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    min-width: 40px;
    text-align: center;
}

.distribution-badge.shift-d1 {
    background-color: #17a2b8;
    color: white;
}

.distribution-badge.shift-d2 {
    background-color: #007bff;
    color: white;
}

.distribution-badge.shift-saturday {
    background-color: #ffc107;
    color: #856404;
}

.distribution-badge.shift-sunday {
    background-color: #dc3545;
    color: white;
}

.distribution-badge.shift-part4 {
    background-color: #6c757d;
    color: white;
}

.distribution-badge.shift-free {
    background-color: #28a745;
    color: white;
}

.distribution-count {
    font-weight: 600;
    color: #495057;
    text-align: right;
}

/* Responsive mejorado */
@media (max-width: 768px) {
    .legend-item {
        padding: 10px;
        min-height: 70px;
    }

    .legend-badge {
        width: 35px;
        height: 35px;
        font-size: 0.7rem;
        margin-right: 8px;
    }

    .schedule-table {
        font-size: 0.8rem;
    }

    .day-header {
        padding: 8px 4px;
    }

    .shift-badge {
        font-size: 0.7rem;
        padding: 2px 4px;
    }

    .shift-time, .shift-hours {
        font-size: 0.6rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .distribution-item {
        font-size: 0.8rem;
        padding: 4px 6px;
    }

    .employee-item {
        padding: 10px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .employee-actions {
        opacity: 1;
        align-self: flex-end;
    }

    .employee-name {
        font-size: 0.9rem;
    }
}

/* === CALENDARIO MENSUAL === */
.monthly-calendar-container {
    padding: 10px 0;
}

.calendar-header h3 {
    color: #343a40;
    font-weight: 700;
    margin-bottom: 20px;
}

.compact-legend .badge {
    margin: 2px;
    padding: 4px 8px;
    font-weight: 600;
}

/* Leyenda mejorada */
.legend-badge {
    transition: all 0.2s ease;
    cursor: help;
    position: relative;
}

.legend-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 10;
}

/* Grid del calendario */
.calendar-grid .card {
    border: 1px solid #e3e6ea;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #343a40;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.calendar-day-name {
    background-color: #343a40;
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #e9ecef;
}

.calendar-day {
    background-color: white;
    min-height: 120px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s ease;
}

.calendar-day:hover {
    background-color: #f8f9fa;
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.calendar-day.empty {
    background-color: #f8f9fa;
    opacity: 0.5;
}

.day-number {
    font-weight: 700;
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 5px;
    align-self: flex-start;
}

.day-shifts {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.employee-shift {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 2px;
    padding: 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.employee-shift:hover {
    background-color: rgba(0,123,255,0.1);
    transform: scale(1.05);
}

/* Distinción entre trabajando y libre */
.employee-shift.working {
    background-color: rgba(0,123,255,0.05);
    border-left: 3px solid #007bff;
}

.employee-shift.free {
    background-color: rgba(40,167,69,0.05);
    border-left: 3px solid #28a745;
    opacity: 0.7;
}

.employee-shift.free:hover {
    background-color: rgba(40,167,69,0.15);
    opacity: 1;
}

.employee-shift .shift-badge {
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.employee-name {
    font-size: 0.6rem;
    font-weight: 500;
    color: #6c757d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Badge específico para empleados libres */
.shift-badge.shift-free {
    background-color: #28a745;
    color: white;
    font-weight: 700;
}

.no-schedule {
    color: #adb5bd;
    font-size: 0.7rem;
    text-align: center;
    padding: 10px;
}

.free-day {
    color: #28a745;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    padding: 5px;
    background-color: rgba(40, 167, 69, 0.1);
    border-radius: 4px;
}

/* Estilos para días especiales */
.calendar-day[data-date*="-1-1"], /* 1 de enero */
.calendar-day[data-date*="-12-25"] { /* 25 de diciembre */
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
}

.calendar-day[data-date]:nth-child(7n),    /* Domingos */
.calendar-day[data-date]:nth-child(7n-1) { /* Sábados */
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Responsive para calendario mensual */
@media (max-width: 768px) {
    .calendar-day {
        min-height: 80px;
        padding: 4px;
    }
    
    .day-number {
        font-size: 0.9rem;
        margin-bottom: 3px;
    }
    
    .employee-shift .shift-badge {
        font-size: 0.5rem;
        padding: 1px 2px;
        min-width: 16px;
    }
    
    .employee-name {
        font-size: 0.5rem;
    }
    
    .calendar-day-name {
        padding: 8px 4px;
        font-size: 0.8rem;
    }
    
    .compact-legend .badge {
        font-size: 0.6rem;
        padding: 2px 4px;
    }
}

@media (max-width: 576px) {
    .calendar-day {
        min-height: 60px;
        padding: 2px;
    }
    
    .day-number {
        font-size: 0.8rem;
    }
    
    .employee-shift {
        gap: 2px;
        margin-bottom: 1px;
    }
    
    .employee-shift .shift-badge {
        font-size: 0.45rem;
        min-width: 14px;
    }
    
    .calendar-day-name {
        padding: 6px 2px;
        font-size: 0.7rem;
    }
}

/* === ESTILOS PARA EXPORTACIÓN PDF === */
@media print {
    body { 
        margin: 0; 
        padding: 15px;
        font-size: 11px;
        color: #000 !important;
        background: white !important;
    }
    
    .btn, .alert, .no-print { 
        display: none !important; 
    }
    
    .card { 
        border: 1px solid #000 !important; 
        box-shadow: none !important;
        background: white !important;
    }
    
    .calendar-day { 
        min-height: 60px !important; 
        page-break-inside: avoid;
        border: 1px solid #ccc !important;
    }
    
    .employee-shift .shift-badge {
        color: white !important;
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
    
    .schedule-table th, .schedule-table td {
        border: 1px solid #000 !important;
        padding: 8px !important;
    }
    
    .legend-badge {
        -webkit-print-color-adjust: exact;
        color-adjust: exact;
    }
}

/* Optimización para captura HTML2Canvas */
.pdf-export-mode {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: white !important;
}

.pdf-export-mode .card {
    border: 2px solid #333 !important;
    box-shadow: none !important;
}

.pdf-export-mode .calendar-day {
    border: 1px solid #666 !important;
}

.pdf-export-mode .shift-badge {
    font-size: 0.7rem !important;
    padding: 0.2rem 0.4rem !important;
}

/* Botones toggle de empleados */
.employee-toggle-btn {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #dee2e6;
    border-radius: 12px;
    padding: 10px 12px;
    color: #343a40;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 140px;
    max-width: 180px;
    text-align: left;
    position: relative;
    overflow: hidden;
    flex: 1;
    padding-right: 30px; /* Espacio para los botones de acción */
}

.employee-toggle-btn:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #adb5bd;
    color: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.employee-toggle-btn.active {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #28a745;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.employee-toggle-btn.active:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
    border-color: #1e7e34;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40,167,69,0.4);
}

.employee-toggle-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.employee-toggle-btn.active:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.employee-toggle-btn i {
    font-size: 1rem;
    transition: all 0.3s ease;
    color: inherit;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.employee-toggle-btn.active i {
    transform: scale(1.1);
    color: #ffffff;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

.employee-toggle-btn .employee-name {
    font-weight: 700;
    flex: 1;
    color: inherit;
    text-shadow: none;
    letter-spacing: 0.02em;
    font-size: 0.85rem;
}

.employee-toggle-btn.active .employee-name {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    font-weight: 700;
}

/* Layout de cuadrícula para empleados */
#employee-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 1rem;
}

.employee-item {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    position: relative;
}

.employee-item .d-flex {
    width: 100%;
    position: relative;
}

.employee-actions {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.employee-item:hover .employee-actions {
    opacity: 1;
}

.edit-employee-btn, .delete-employee-btn {
    padding: 2px 4px;
    font-size: 0.65rem;
    border-radius: 4px;
    min-width: auto;
    height: auto;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    background: white;
    color: #6c757d;
    transition: all 0.2s ease;
}

.edit-employee-btn:hover {
    background: #007bff;
    color: white;
    border-color: #007bff;
    transform: scale(1.1);
}

.delete-employee-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    transform: scale(1.1);
}

/* Responsive para la cuadrícula */
@media (max-width: 768px) {
    #employee-list {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .employee-toggle-btn {
        min-width: 120px;
        max-width: none;
        padding: 8px 10px;
        font-size: 0.85rem;
        padding-right: 30px; /* Mantener espacio para botones */
    }
    
    .employee-toggle-btn .employee-name {
        font-size: 0.8rem;
    }
    
    .employee-actions {
        opacity: 1; /* Siempre visibles en móvil */
    }
}

@media (max-width: 576px) {
    .employee-toggle-btn {
        min-width: 100px;
        padding: 6px 8px;
        font-size: 0.8rem;
        gap: 4px;
        padding-right: 25px; /* Menos espacio en móvil */
    }
    
    .employee-toggle-btn .employee-name {
        font-size: 0.75rem;
    }
    
    .employee-actions {
        gap: 1px;
        right: 2px;
    }
    
    .edit-employee-btn, .delete-employee-btn {
        padding: 1px 3px;
        font-size: 0.6rem;
        width: 18px;
        height: 18px;
    }
}

/* Loader para calendario mensual */
.calendar-loader {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.calendar-loader .spinner-border {
    border-width: 0.25em;
}

.calendar-loader h5 {
    font-weight: 600;
    color: #495057;
}

.calendar-loader p {
    font-size: 0.95rem;
}

/* Panel de resultados siempre visible */
#results-panel {
    min-height: 400px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 2rem;
    transition: box-shadow 0.2s, background 0.2s;
}

#results-panel .mb-0 {
    font-weight: 700;
    font-size: 1.25rem;
}

@media (max-width: 768px) {
    #results-panel {
        padding: 1rem !important;
        min-height: 300px;
    }
} 