/* Contenedor de las tablas - oculto por defecto */
.tabla-contenedor {
  display: none;
}

/* Contenedor de la tabla - visible cuando tiene clase activa */
.tabla-contenedor.activa {
  display: block;
}

.select-estado {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 2px solid #7ba5ff;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.8rem;
  background: white;
  box-sizing: border-box;
  min-height: 36px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(123, 165, 255, 0.1);
}

.select-estado:focus {
  outline: none;
  border-color: #5f76dc;
  box-shadow: 0 0 0 3px rgba(123, 165, 255, 0.2);
}

/* Estilo opcional para modo lectura */
.modo-lectura .btn-edit,
.modo-lectura .btn-reenviar {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.modo-lectura .sin-acciones {
    color: #999;
    font-size: 12px;
    font-style: italic;
}

/* =========================
   MODAL REENVIAR - MEJORADO
   ========================= */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh; /* Asegura que cubra toda la altura */
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Previene scroll del fondo */
    -webkit-overflow-scrolling: touch; /* Mejora en iOS */
}

/* Cuando el modal está activo */
.modal.activo {
    display: flex;
}

.modal-contenido {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    max-height: 90vh; /* Limita altura y permite scroll interno */
    overflow-y: auto; /* Scroll interno si el contenido es muy largo */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: modalSlideIn 0.3s ease; /* Animación suave */
}

/* Animación de entrada */
@keyframes modalSlideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Para móviles muy pequeños */
@media (max-width: 480px) {
    .modal-contenido {
        width: 95%;
        max-height: 85vh;
        margin: 10px;
    }
}

/* Scroll interno con mejor aspecto */
.modal-contenido::-webkit-scrollbar {
    width: 5px;
}

.modal-contenido::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-contenido::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.modal-contenido::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    position: sticky; /* Fija el header al hacer scroll */
    top: 0;
    background: white;
    z-index: 1;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.cerrar-modal {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    padding: 0 5px;
    transition: transform 0.3s ease;
}

.cerrar-modal:hover {
    color: #333;
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px;
}

.form-grupo {
    margin-bottom: 15px;
}

.form-grupo label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-grupo select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-grupo select:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-grupo input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-grupo input:focus {
    outline: none;
    border-color: #4CAF50;
}

.form-grupo input:disabled {
    background: #f0f0f0;
    color: #999;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky; /* Fija el footer al hacer scroll */
    bottom: 0;
    background: white;
    z-index: 1;
    border-radius: 0 0 8px 8px;
}

/* =========================
   MEJORA PARA EL BODY CUANDO EL MODAL ESTÁ ABIERTO
   ========================= */

body.modal-abierto {
    overflow: hidden; /* Previene scroll del body */
    position: fixed; /* Fija el body para evitar scroll */
    width: 100%;
}