/* Estilos generales para el módulo de solicitudes */
#solicitudes-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Estilos para botones en estado de procesando */
.btn-procesando {
    opacity: 0.7;
    cursor: not-allowed !important;
    pointer-events: auto; /* Mantener pointer events para mostrar cursor */
    position: relative;
}

.btn-procesando:hover {
    transform: none !important;
    box-shadow: none !important;
    background-color: inherit !important;
}

/* Animación del spinner */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spin {
    animation: spin 1s linear infinite;
}

/* Estilos específicos para botones de acción cuando están procesando */
.btn-accion.btn-procesando {
    opacity: 0.5;
    transform: none !important;
}

.btn-accion.btn-procesando:hover {
    transform: none !important;
    box-shadow: none !important;
}

.header-container {
    padding: 20px;
    text-align: center;
}

/* Estilos para el título */
.header-container h1 {
    font-family: 'Roboto Serif', serif;
    font-weight: 800;
    font-size: 3em;
    color: #1b8f36;
    text-shadow: -1px 2px 4px #000000;
    letter-spacing: 1px;
    padding: 10px 20px;
    border: none;
    border-bottom: 3px solid transparent;
    transition: border-bottom-width 0.4s ease-in-out, border-bottom-color 0.4s ease-in-out;
    display: inline-block;
}

/* Animación del borde inferior al hacer hover */
h1:hover {
    border-bottom-width: 3px;
    border-bottom-color: #15732b;
}

/* Navegación */
.solicitudes-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.nav-btn {
    padding: 10px 20px;
    border: 2px solid #007cba;
    background: white;
    color: #007cba;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-btn.active,
.nav-btn:hover {
    background: #007cba;
    color: white;
}

.btn-primary {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-left: auto;
    transition: all 0.3s ease;
}

.btn-primary:hover:not(.btn-procesando) {
    background: #005a87;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover:not(.btn-procesando) {
    background: #545b62;
}

/* Filtros */
.filtros-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.filtro-grupo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filtro-grupo label {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filtros-container input,
.filtros-container select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filtros-container input:focus,
.filtros-container select:focus {
    border-color: #007cba;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 124, 186, 0.25);
}

.filtros-container input[type="week"],
.filtros-container input[type="month"] {
    min-width: 150px;
}

.filtros-container select {
    min-width: 180px;
}

#btn-filtrar {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.15s ease-in-out;
}

#btn-filtrar:hover:not(.btn-procesando) {
    background: #218838;
}

#btn-limpiar-filtros {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.15s ease-in-out;
}

#btn-limpiar-filtros:hover:not(.btn-procesando) {
    background: #545b62;
}

/* Contenedor responsive para la tabla */
.tabla-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-bottom: 20px;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Tabla de solicitudes */
#tabla-solicitudes {
    width: 100%;
    min-width: 800px; /* Ancho mínimo para mantener legibilidad */
    border-collapse: collapse;
    background: white;
}

#tabla-solicitudes th {
    background: #007cba;
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    white-space: nowrap;
}

#tabla-solicitudes td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: center;
    vertical-align: middle;
}

#tabla-solicitudes tr:hover {
    background: #f8f9fa;
}

/* Celda de acciones */
.acciones-cell {
    white-space: nowrap;
    text-align: center;
    width: 160px; /* Ancho fijo para la columna de acciones */
}

/* Estados */
.estado {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    text-transform: uppercase;
}

.estado-solicitado {
    background: #ffebee;
    color: #c62828;
}

.estado-proceso {
    background: #fff3e0;
    color: #ef6c00;
}

.estado-aprobado {
    background: #e8f5e8;
    color: #2e7d32;
}

/* Botones de acción con iconos */
.btn-accion {
    padding: 2px;
    margin: 2px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s ease;
    width: 50px;
    height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.btn-accion:hover:not(.btn-procesando) {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-editar-estado {
    background: #ffc107;
    color: #212529;
}

.btn-editar-estado:hover:not(.btn-procesando) {
    background: #e0a800;
}

.btn-editar-fecha {
    background: #17a2b8;
    color: white;
}

.btn-editar-fecha:hover:not(.btn-procesando) {
    background: #138496;
}

.btn-ver-detalle {
    background: #6f42c1;
    color: white;
}

.btn-ver-detalle:hover:not(.btn-procesando) {
    background: #5a32a3;
}

.btn-eliminar {
    background: #dc3545;
    color: white;
}

.btn-eliminar:hover:not(.btn-procesando) {
    background: #c82333;
}

/* Tooltips para botones de acción */
.btn-accion::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 55px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px;
    border-radius: 4px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
    pointer-events: none;
}

.btn-accion::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10000;
}

.btn-accion:hover:not(.btn-procesando)::after, 
.btn-accion:hover:not(.btn-procesando)::before {
    opacity: 1;
    visibility: visible;
}

/* Ajustes específicos para iconos Font Awesome */
.btn-accion i {
    font-size: 20px;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-danger:hover:not(.btn-procesando) {
    background: #c82333;
}

/* Modales */
.modal {
    display: none;
    position: fixed;
    z-index: 999999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.modal-small {
    max-width: 400px;
}

.mensaje-confirmacion {
    margin: 20px 0;
    text-align: center;
}

.mensaje-confirmacion p {
    margin-bottom: 10px;
    line-height: 1.5;
}

.mensaje-confirmacion .strong {
    color: #dc3545;
}

/* Mensajes de alerta */
.alert {
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: 500;
    position: relative;
}

.alert-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: black;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group textarea {
    height: 100px;
    resize: vertical;
}

.form-group input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
}

/* Calendario */
.calendario-navegacion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.calendario-navegacion h3 {
    margin: 0;
    color: #007cba;
    text-transform: capitalize;
    font-size: 18px;
}

.btn-nav-calendario {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-nav-calendario:hover:not(.btn-procesando) {
    background: #005a87;
    transform: scale(1.1);
}

.calendario-header {
    text-align: center;
    margin-bottom: 20px;
}

.calendario-header h3 {
    margin: 0;
    color: #007cba;
    text-transform: capitalize;
}

.calendario-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.dia-semana {
    background: #007cba;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
}

.dia-calendario,
.dia-vacio {
    background: white;
    min-height: 80px;
    padding: 5px;
    position: relative;
    cursor: pointer;
}

.dia-vacio {
    background: #f8f9fa;
    cursor: default;
}

/* Días con solicitudes - ocupan todo el contenedor */
.dia-calendario.tiene-solicitudes {
    padding: 0;
    overflow: hidden;
}

/* Estados de los días completos */
.dia-calendario.dia-solicitado {
    background-color: #ffcdd2;
}

.dia-calendario.dia-proceso {
    background-color: #ffe0b2;
}

.dia-calendario.dia-aprobado {
    background-color: #c8e6c9;
}

.numero-dia {
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    padding: 5px;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 0 0 8px 0;
    min-width: 20px;
    text-align: center;
    font-size: 12px;
}

/* Contenedor de solicitudes del día */
.solicitudes-dia {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 25px 5px 5px 5px;
    z-index: 1;
}

/* Solicitud individual en calendario - ocupa todo el espacio disponible */
.solicitud-calendario {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
    border-radius: 4px;
    margin: 1px 0;
    position: relative;
    transition: all 0.3s ease;
    min-height: 45px;
}

/* Hover effect para días con solicitudes */
.dia-calendario.tiene-solicitudes:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 10;
}

/* Tooltip animado con ::after */
.dia-calendario.tiene-solicitudes:hover::after {
    content: attr(data-descripcion);
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: #fff;
    color: #333;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    font-size: 13px;
    font-weight: normal;
    max-width: 250px;
    z-index: 999;
    white-space: normal;
    line-height: 1.4;
    border: 1px solid #e0e0e0;
    animation: fadeInTooltip 0.3s ease-in-out;
    pointer-events: none;
}

/* Animación del tooltip */
@keyframes fadeInTooltip {
    from { 
        opacity: 0; 
        transform: translateX(-50%) translateY(-100%) translateY(-5px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(-50%) translateY(-100%); 
    }
}

/* Estados de solicitudes individuales */
.solicitud-calendario.estado-solicitado {
    background: rgba(255, 205, 210, 0.9);
    color: #c62828;
}

.solicitud-calendario.estado-proceso {
    background: rgba(255, 224, 178, 0.9);
    color: #ef6c00;
}

.solicitud-calendario.estado-aprobado {
    background: rgba(200, 230, 201, 0.9);
    color: #2e7d32;
}

/* Leyenda del calendario */
.leyenda-calendario {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.color-solicitado,
.color-proceso,
.color-aprobado {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 2px solid;
}

.color-solicitado {
    background: #ffcdd2;
    border-color: #c62828;
}

.color-proceso {
    background: #ffe0b2;
    border-color: #ef6c00;
}

.color-aprobado {
    background: #c8e6c9;
    border-color: #2e7d32;
}

/* Detalle de solicitud */
.detalle-info {
    margin-top: 20px;
}

.detalle-info p {
    margin-bottom: 15px;
    line-height: 1.6;
}

.detalle-info strong {
    color: #007cba;
    display: inline-block;
    min-width: 150px;
}

/* Responsive */
@media (max-width: 768px) {
    .filtros-container {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .filtro-grupo {
        width: 100%;
    }
    
    .filtros-container input,
    .filtros-container select {
        width: 100%;
        min-width: unset;
    }
    
    .filtro-grupo:last-child {
        display: flex;
        flex-direction: row;
        gap: 10px;
    }
    
    .filtro-grupo:last-child button {
        flex: 1;
    }
    
    .solicitudes-nav {
        flex-wrap: wrap;
    }
    
    .nav-btn {
        flex: 1;
        min-width: 120px;
    }
    
    /* Tabla responsive: mantener scroll horizontal sin comprimir */
    .tabla-scroll-wrapper {
        /* El scroll horizontal se mantiene automáticamente */
        -webkit-overflow-scrolling: touch; /* Suavizar scroll en iOS */
    }
    
    #tabla-solicitudes {
        /* Mantener el ancho mínimo para legibilidad */
        min-width: 800px;
    }
    
    /* Ajustar tooltips de botones en móvil */
    .btn-accion::after {
        bottom: -35px;
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .btn-accion::before {
        bottom: -25px;
        border-width: 4px;
    }
    
    .modal-content {
        margin: 10% 5%;
        width: 90%;
    }
    
    .calendario-grid {
        font-size: 12px;
    }
    
    .dia-calendario {
        min-height: 60px;
    }
    
    .solicitud-calendario {
        font-size: 10px;
        min-height: 35px;
    }
    
    .numero-dia {
        font-size: 10px;
    }
    
    .dia-calendario.tiene-solicitudes:hover::after {
        max-width: 200px;
        font-size: 12px;
    }
    
    .leyenda-calendario {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    #solicitudes-container {
        padding: 10px;
    }
    
    .modal-content {
        margin: 5%;
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    /* Botones de acción más pequeños en móvil muy pequeño */
    .btn-accion {
        width: 28px;
        height: 28px;
        font-size: 12px;
        margin: 1px;
    }
    
    .btn-accion i {
        font-size: 10px;
    }
    
    /* Ajustar celda de acciones */
    .acciones-cell {
        width: 140px;
    }
    
    .dia-calendario.tiene-solicitudes:hover::after {
        max-width: 180px;
        font-size: 11px;
        padding: 8px 12px;
    }
}

/* Estilos adicionales para mejorar la accesibilidad */
.btn-accion:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* Animación suave para carga de tabla */
#tabla-solicitudes tbody tr {
    animation: fadeInRow 0.3s ease-in-out;
}

@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Indicador de scroll horizontal para tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .tabla-scroll-wrapper::after {
        content: "Desliza horizontalmente para ver más →";
        display: block;
        text-align: center;
        font-size: 12px;
        color: #6c757d;
        padding: 10px;
        background: #f8f9fa;
        border-top: 1px solid #e9ecef;
    }
    
    .tabla-scroll-wrapper:hover::after {
        opacity: 0.5;
    }
    
    .header-container h1{
        font-size: 2em;
    }
}