/* ========== BASE ========== */
:root{
--c1:#6ea8fe;--c2:#0d6efd;--c3:#084298;
--bg:#f4f8ff;--txt:#084298;--mut:#3b5b87;
}
footer{
margin-top:35px;
font-size:12px;
letter-spacing:2px;
color:var(--mut);
}

html, body {
  touch-action: manipulation; /* quita el zoom por doble toque */
  margin: 0;
  padding: 0;
  background-color: #f8f9fa;
  overflow-x: hidden;
}

input, select, textarea {
  font-size: 16px;
}

button {
  padding: 10px 15px;
  border: none;
  background: #28a745;
  color: white;
  border-radius: 6px;
  cursor: pointer;
}

.swal2-container {
  z-index: 20000 !important;
}

/* ========== MODAL PROPIO ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-content {
  background: #fff;
  width: 700px;
  max-width: 95%;
  border-radius: 10px;
  padding: 5px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal input,
.modal textarea {
  background: #fff;
  color: #000;
  opacity: 1;
  pointer-events: auto;
}

.close {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 22px;
  cursor: pointer;
}

/* ========== PESTAÑAS ========== */
.tabs {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
  border-bottom: 1px solid #ddd;
}

.tab {
  padding: 8px 12px;
  cursor: pointer;
  background: #e9ecef;
  color: #333;
  border: none;
  border-radius: 5px 5px 0 0;
}
.tab.active { background: #007bff; color: white; }

.tab.active {
  background: #007bff;
  color: white;
}

.tab-content input,
.tab-content textarea {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.tab-content h4 {
  margin-top: 10px;
}

/* ========== LAYOUT: TOPBAR / SIDEBAR ========== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: #fff;
  z-index: 1040;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  padding: 0 1rem;
}

.sidebar {
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  width: 230px;
  background-color: #343a40;
  overflow-y: auto;
  z-index: 1030;
}

.sidebar a {
  color: #adb5bd;
  text-decoration: none;
  display: block;
  padding: 10px;
  transition: 0.3s;
}

.sidebar a:hover {
  background-color: #198754;
  color: white;
}

.wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-top: 60px;
  padding: 1rem;
  transition: margin-left 0.3s ease;
}

@media (min-width: 768px) {
  .main-content {
    margin-left: 230px; /* espacio por el sidebar */
  }
}

.offcanvas-custom-width {
  width: 260px !important;
}

.chevron-icon {
  transition: transform 0.3s ease;
}

.chevron-icon.rotated {
  transform: rotate(180deg);
}

/* ========== TABLAS / DATATABLES ========== */
.dt-buttons {
  margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_filter {
  text-align: right;
}

table.dataTable th {
  font-size: 13px;
  text-align: center !important;
}

table.dataTable td {
  font-size: 13px;
  padding: 0px;
}

.text-13px {
  font-size: 13px;
}

#tableFv tfoot th,
#tableFvInf tfoot th,
#tableRete tfoot th,
#tableProd tfoot th,
#tableMov tfoot th,
#tableFc tfoot th,
#tableCxc tfoot th,
#tableCxp tfoot th,
#tableVeh tfoot th,
#tableVehInf tfoot th,
#tableTaller tfoot th {
  text-align: right !important;
}

.page-item.active .page-link {
  background-color: #212529 !important;
}

.table-wrapper {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* scroll suave en móviles */
}

/* Para que el thead se quede fijo */
.table-wrapper thead th {
  position: sticky;
  top: 0;
  background: var(--bs-body-bg);
  z-index: 2;
}

table.dataTable thead .sorting,
table.dataTable thead .sorting_asc,
table.dataTable thead .sorting_desc {
  background-image: unset !important; /* resetear primero */
  padding-right: 20px;
  position: relative;
}

table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after {
  position: absolute;
  right: 5px;
  opacity: 0.7;
}

table.dataTable thead .sorting::after       { content: "⇅"; }
table.dataTable thead .sorting_asc::after   { content: "↑"; }
table.dataTable thead .sorting_desc::after { content: "↓"; }

/* ========== SELECT2 ========== */
.select2-container--default .select2-selection--single {
  position: relative;
  height: 31px; /* iguala a la altura real de tu select-sm */
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  font-weight: bold;
  text-align: left;
  color: #000;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 29px;
  right: 3px;
}

/* Posición y color del botón de limpiar (x) */
.select2-container--default .select2-selection--single .select2-selection__clear {
  position: absolute;
  right: 22px;
  top: 0;
  height: 29px;
  line-height: 29px;
  font-size: 1rem;
  color: #6c757d;
  margin: 0;
  display: flex;
  align-items: center;
}

/* ========== BOTONES Y TOOLTIPS ========== */
.btn.no-click {
  pointer-events: none;
  cursor: default;
}

.btn-outline-dark:hover i,
.btn-outline-dark:focus i,
.btn-outline-success:hover i,
.btn-outline-success:focus i,
.btn-outline-primary:hover i,
.btn-outline-primary:focus i,
.btn-outline-warning:hover i,
.btn-outline-warning:focus i,
.btn-outline-danger:hover i,
.btn-outline-danger:focus i {
  color: #fff !important;
}

.tooltip {
  z-index: 9999 !important;
}

.tooltip.tooltip-left .tooltip-inner {
  text-align: left !important;
  white-space: normal !important;
}

.img-fixed {
  max-height: 200px;
  object-fit: cover; /* recorta para que no se deforme */
  width: 100%;
}

/* ========== TOOLTIP DE NOVEDADES ========== */
.novedad-tooltip {
  position: absolute;
  top: 35px; /* justo debajo del + */
  left: -5px;
  background: #0d6efd;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: none; /* inicialmente oculto */
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(-5px);
  z-index: 1055;
}

.novedad-tooltip.show {
  display: flex;
  animation: fadeInDown 0.6s ease forwards;
}

/* Flechita hacia arriba */
.novedad-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 20px;
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #0d6efd transparent;
}

/* Botón cerrar */
.close-tooltip {
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  margin-left: 8px;
  opacity: 0.9;
  transition: opacity 0.2s;
}

.close-tooltip:hover {
  opacity: 1;
}

/* Manito animada */
.emoji-hand {
  display: inline-block;
  animation: handWave 1.2s infinite ease-in-out;
}

@keyframes handWave {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Entrada suave */
@keyframes fadeInDown {
  0% { opacity: 0; transform: translateY(-10px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutUp {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-5px); }
}

/* ========== CARRUSEL / CARDS ========== */
@media (max-width: 768px) {
  #cardsScroll {
    overflow-y: auto;
    height: calc(55vh - 60px); /* descarta header */
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
  }
  .carousel {
    width: 80%;
    max-height: 200px;
    overflow: hidden;
    margin: auto;
  }

  .carousel img {
    width: 50%;
    height: auto;
  }
  .footer {
    display: none !important;
  }
}

#contenedorUsuario {
  min-height: 50px;
  padding: 5px;
  position: relative;
}

#contenedorUsuario:not(:has(> .card-draggable))::before {
  content: "Mis cards";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #dcdcdc;
  font-size: 22px;
  font-weight: 700;
  pointer-events: none;
  text-align: center;
}

.progress-bar {
  transition: width .6s ease, background-color .4s ease;
}

#modalCards .modal-dialog {
  width: 95% !important;
  max-width: 95% !important;
  margin: auto;
}

#modalCards .modal-content {
  width: 100% !important;
  max-width: 100% !important;
}

.modal-dialog-bottom-center {
  display: flex !important;
  align-items: flex-end !important;
  min-height: calc(100% - var(--bs-modal-margin) * 2) !important;
}

/* ========== MODO OSCURO ========== */
[data-bs-theme="light"] .nocturno {
  background: #dde1e6;
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .nocturno {
  background: var(--bs-tertiary-bg);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .topbar {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

[data-bs-theme="dark"] .select2-container--default .select2-selection--single {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
  border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .select2-container--default .select2-selection__rendered {
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .select2-dropdown {
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

[data-bs-theme="dark"] .select2-results__option {
  color: var(--bs-body-color);
}

/* ========== POS ========== */
.category-card {
  cursor: pointer;
  transition: all 0.3s;
}

.category-card:hover {
  transform: translateY(-3px);
}

.category-card.active {
  border-color: #0d6efd;
  background-color: #e7f1ff;
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.product-table th {
  background: #212529;
  color: white;
}

.cart-card {
  position: sticky;
  top: 20px;
  height: 70vh;
  overflow-y: auto;
}

.cart-item {
  border-bottom: 1px solid #eee;
  padding: 12px 0;
}

.total-bar {
  font-size: 1.4rem;
  font-weight: bold;
}

#productsTable thead th {
  background: black !important;
  color: white !important;
}

.bill-card {
  flex: 1 0 30%;
  padding: 2px;
  background: #f8f9fa;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.1s;
}

.bill-card:hover {
  transform: scale(1.05);
  background: #e0f7fa;
}

.bill-card img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

#specsContainer {
  max-height: 200px;
  overflow-y: auto;
}

.preview-img {
  overflow: hidden;
  cursor: zoom-in;
  position: relative;
}

.preview-img-inner {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
  transform-origin: center center;
}

.preview-img:hover .preview-img-inner {
  transform: scale(1.8);
}

@media print {
  button.no-print {
    display: none !important;
  }
}

#opticaModal .modal-content {
  max-height: 90vh;
  overflow-y: auto;
}

/* ========== IMÁGENES CON BOTÓN ELIMINAR ========== */
.img-slot {
  position: relative;
  display: inline-block;
}

.delete-img {
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(220,53,69,.9);
  color: #fff;
  font-size: 16px;
  font-weight: bold;
  line-height: 22px;
  text-align: center;
  padding: 0;
  cursor: pointer;
  z-index: 10;
}

.delete-img:hover {
  background: #dc3545;
}

#previewContainer {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

#previewContainer .img-slot {
  width: 100%;
  max-width: 100px;
  margin: auto;
}

#previewContainer .img-slot img {
  display: block;
  width: 100%;
  height: 90px;
  max-width: 100% !important;
  object-fit: contain;
}

@media (max-width: 576px) {
  #previewContainer .img-slot img {
    height: 75px;
  }
}

/* ========== LOGIN / REGISTRO / FORGOT ========== */
/* Reemplaza a sb-admin-2.min.css y al <style> interno de login.php.
   Todo va dentro de .login-wrapper (o :has) para no afectar al resto de la aplicación. */

/* Página: sin scroll, sin zoom por doble toque */
html {
  overflow-x: hidden;
}
body {
  overflow-x: clip; /* recorta sin crear un contenedor de scroll */
}

/* Gradientes de tema (los usa theme.js sobre #bodyTheme) */
.bg-primary-gradient {
  background: linear-gradient(135deg, #0d6efd, #6610f2);
}
.bg-success-gradient {
  background: linear-gradient(135deg, #198754, #20c997);
}
.bg-warning-gradient {
  background: linear-gradient(135deg, #ffc107, #ff922b);
}
.bg-danger-gradient {
  background: linear-gradient(135deg, #dc3545, #fd7e14);
}
.bg-dark-gradient {
  background: linear-gradient(135deg, #212529, #343a40);
}
.bg-secondary-gradient {
  background: linear-gradient(135deg, #6c757d, #adb5bd);
}

/* Base del contenedor (antes venía de Bootstrap/SB Admin) */
/* Sin esto los campos con width:100% se desbordan por su padding y borde */
.login-wrapper,
.login-wrapper *,
.login-wrapper *::before,
.login-wrapper *::after {
  box-sizing: border-box;
}
.login-wrapper {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
}
:where(.login-wrapper) h1,
:where(.login-wrapper) h2,
:where(.login-wrapper) h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-weight: 400;
  line-height: 1.2;
}
:where(.login-wrapper) p {
  margin-top: 0;
  margin-bottom: 1rem;
}
:where(.login-wrapper) img {
  vertical-align: middle;
}
:where(.login-wrapper) button,
:where(.login-wrapper) input {
  margin: 0;
  font-family: inherit;
  line-height: inherit;
}
:where(.login-wrapper) a {
  color: #4e73df;
  text-decoration: none;
}
:where(.login-wrapper) a:hover {
  color: #224abe;
  text-decoration: underline;
}

/* Panel izquierdo: solo visible en pantallas >= 998px */
.login-left {
  display: none;
  flex: 0 0 60%;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
@media (min-width: 998px) {
  .login-left {
    display: flex;
  }
}
.login-left-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-illustration {
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 80%;
    object-fit: contain;
    display: block;
}
.login-tagline {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  max-width: 260px;
  line-height: 1.6;
}

/* Panel derecho: scroll solo aquí si el formulario no cabe (teclado, pantallas pequeñas) */
.login-right {
  flex: 1;
  display: flex;
  padding: 2rem;
  overflow-y: auto;
}
/* margin:auto centra sin recortar el formulario cuando es más alto que la pantalla */
.login-wrapper .form-container {
  width: 100%;
  max-width: 400px;
  margin: auto;
  background: #2c2f33;
  padding: 30px;
  border-radius: 10px;
}

/* Campos */
.login-wrapper .form-group {
  margin-bottom: 1rem;
}
/* Fila de dos campos (registro): reemplaza row / col-lg-6 / navbar-expand de Bootstrap */
.login-wrapper .form-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}
.login-wrapper .form-control {
  display: block;
  width: 100%;
  height: 50px;
  padding: 0 1rem;
  font-size: 0.8rem;
  color: #6e707e;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #d1d3e2;
  border-radius: 10rem;
  appearance: none;
  transition:
    border-color 0.15s ease-in-out,
    box-shadow 0.15s ease-in-out;
}
.login-wrapper .form-control::placeholder {
  color: #858796;
  opacity: 1;
}
.login-wrapper .form-control:focus {
  border-color: #bac8f3;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}
.login-wrapper .form-control:disabled {
  background-color: #eaecf4;
}

/* Botones */
.login-wrapper .btn {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  vertical-align: middle;
  color: #858796;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 0.35rem;
  cursor: pointer;
  user-select: none;
  transition:
    color 0.15s,
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}
.login-wrapper .btn:hover {
  text-decoration: none;
}
.login-wrapper .btn:focus {
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}
.login-wrapper .btn:disabled {
  opacity: 0.65;
  cursor: default;
}
.login-wrapper .btn-light {
  color: #3a3b45;
  background-color: #f8f9fc;
  border-color: #f8f9fc;
}
.login-wrapper .btn-light:hover {
  color: #3a3b45;
  background-color: #dde2f1;
  border-color: #d4daed;
}
.login-wrapper .btn-light:focus {
  background-color: #dde2f1;
  border-color: #d4daed;
  box-shadow: 0 0 0 0.2rem rgba(220, 221, 225, 0.5);
}
.login-wrapper .btn-light:disabled {
  background-color: #f8f9fc;
  border-color: #f8f9fc;
}
.login-wrapper .btn-user {
  font-size: 0.8rem;
  border-radius: 10rem;
  padding: 0.75rem 1rem;
}
.login-wrapper .btn-block {
  display: block;
  width: 100%;
}

/* Spinner de "Validando seguridad..." */
.login-wrapper .spinner-border {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  vertical-align: text-bottom;
  border: 0.2em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: 0.75s linear infinite login-spin;
}
@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Utilidades usadas por las vistas de acceso */
.login-wrapper .h4 {
  font-size: 1.5rem;
}
.login-wrapper .small {
  font-size: 80%;
}
.login-wrapper .text-center {
  text-align: center;
}
.login-wrapper .text-white {
  color: #fff;
}
.login-wrapper .text-danger {
  color: #e74a3b;
}
.login-wrapper .justify-content-center {
  justify-content: center;
}
.login-wrapper .rounded-circle {
  border-radius: 50%;
}
.login-wrapper .mt-3 {
  margin-top: 1rem;
}
.login-wrapper .mb-3 {
  margin-bottom: 1rem;
}
.login-wrapper .mr-2 {
  margin-right: 0.5rem;
}
.afil-left-inner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ===== DESBLOQUEO DE SCROLL ===== */
html {
  height: auto !important;
  overflow-x: visible !important;
  overflow-y: auto !important;
  overscroll-behavior: auto !important;
  touch-action: pan-x pan-y !important;
}
body {
  height: auto !important;
  min-height: 100dvh;
  overflow-x: clip !important;
  overflow-y: visible !important;
  overscroll-behavior: auto !important;
  touch-action: pan-x pan-y !important;
  position: static !important;
}