/* 
 * sweetalert2-custom.css
 * Estilos globales para SweetAlert2 - Evita problemas de layout y scroll
 * Aplicable a todo el proyecto
 */

/* Prevenir que el body se desplace cuando aparece SweetAlert2 */
html,
body {
  overflow: visible !important;
  height: auto !important;
}

/* Asegurar que SweetAlert2 se posiciona como modal flotante */
.swal2-container {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  pointer-events: auto !important;
}

/* Popup del alert centrado */
.swal2-popup {
  position: absolute !important;
  z-index: 100000 !important;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3) !important;
  border-radius: 10px !important;
}

/* Backdrop (fondo oscuro) */
.swal2-backdrop {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  z-index: 99998 !important;
  background: rgba(0, 0, 0, 0.4) !important;
}

/* Prevenir que AdminLTE y otros frameworks agreguen overflow */
body.swal2-shown {
  overflow: visible !important;
  padding-right: 0 !important;
  margin: 0 !important;
}

html.swal2-shown {
  overflow: visible !important;
}

/* Contenedor HTML dentro del alert */
.swal2-html-container {
  overflow: visible !important;
}

/* Animación suave para entrada del alert */
.swal2-popup.swal2-animate-show {
  animation: swal2-slideDown 0.3s ease-out !important;
}

@keyframes swal2-slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive en móviles */
@media (max-width: 768px) {
  .swal2-popup {
    width: 90vw !important;
    max-width: 90vw !important;
  }
}

/* ========================================
   ESTILOS PARA PESTAÑA CONDICIONES - COTIZACIONES
   ======================================== */

/* Grupo de input con select + text */
.input-group select[id$="Select"] {
  border-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group input[id^="cotizacion"][id$="Entrega"],
.input-group input[id^="cotizacion"][id$="Garantia"],
.input-group input[id^="cotizacion"][id$="Pago"] {
  border-left: 1px solid #ced4da;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* Botones de inserción rápida */
.btn-insertar-obs,
.btn-insertar-terminos {
  margin: 2px;
  font-size: 0.85rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.btn-insertar-obs:hover {
  background-color: #6c757d;
  color: white;
  border-color: #6c757d;
}

.btn-insertar-terminos:hover {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

/* Icono en opción personalizar */
#cotizacionTiempoEntregaSelect option[value="custom"],
#cotizacionLugarEntregaSelect option[value="custom"],
#cotizacionGarantiaSelect option[value="custom"],
#cotizacionCondicionesPagoSelect option[value="custom"] {
  font-weight: bold;
  color: #28a745;
}

/* Mejorar visualización de textarea */
#cotizacionObservaciones,
#cotizacionTerminos {
  resize: vertical;
  min-height: 80px;
}

/* Estilo para campos focus */
.tab-pane#tab-condiciones .form-control:focus {
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Grupo de botones ajustable en móvil */
@media (max-width: 576px) {
  .btn-insertar-obs,
  .btn-insertar-terminos {
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
    display: block;
    width: 100%;
    margin: 3px 0;
  }
  
  .input-group select[id$="Select"] {
    max-width: 100% !important;
    margin-bottom: 5px;
  }
}

/* ========================================
   ESTILOS PARA TABLA ITEMS SCROLLEABLE - COTIZACIONES
   ======================================== */

/* Contenedor scrolleable de items */
#tab-items .table-responsive {
  scrollbar-width: thin;
  scrollbar-color: #007bff #f1f1f1;
}

/* Scrollbar personalizado para navegadores WebKit */
#tab-items .table-responsive::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

#tab-items .table-responsive::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

#tab-items .table-responsive::-webkit-scrollbar-thumb {
  background: #007bff;
  border-radius: 4px;
}

#tab-items .table-responsive::-webkit-scrollbar-thumb:hover {
  background: #0056b3;
}

/* Header oscuro para tablaItems */
#tablaItems thead th {
  border-bottom: 2px solid #495057;
}

/* Mejora visual de filas de items */
#tablaItems tbody tr:hover {
  background-color: #f5f5f5;
}

/* Responsivo: ajustar altura en móviles */
@media (max-width: 768px) {
  #tab-items .table-responsive {
    max-height: 300px !important;
  }
}

/* ========================================
   MODAL COTIZACIÓN - ALTURA FIJA Y FOOTER VISIBLE
   ======================================== */

/* Asegurar que el modal no crezca más allá de 90vh */
#modalCotizacion .modal-content {
  max-height: 90vh !important;
  overflow: hidden !important;
}

/* Modal body scrolleable */
#modalCotizacion .modal-body {
  overflow-y: auto !important;
  max-height: calc(90vh - 120px) !important; /* Resta header y footer */
}

/* Footer siempre visible */
#modalCotizacion .modal-footer {
  position: relative !important;
  background: white !important;
  z-index: 100 !important;
}

/* Scrollbar del modal body */
#modalCotizacion .modal-body::-webkit-scrollbar {
  width: 10px;
}

#modalCotizacion .modal-body::-webkit-scrollbar-track {
  background: #f1f1f1;
}

#modalCotizacion .modal-body::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 5px;
}

#modalCotizacion .modal-body::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsivo móviles */
@media (max-width: 768px) {
  #modalCotizacion .modal-content {
    max-height: 95vh !important;
  }
  
  #modalCotizacion .modal-body {
    max-height: calc(95vh - 100px) !important;
  }
}

