/* =========================================
   EL SHAH • Estilos principales (v5.1)
   ========================================= */

/* 🔴 Botones personalizados */
.btn-shah {
  background-color: #d40000;
  color: #fff;
  border: none;
}
.btn-shah:hover {
  background-color: #b30000;
  color: #fff;
}

/* 🔴 Links activos en sidebar */
.sb-sidenav .nav-link.active {
  background-color: #d40000 !important;
  color: #fff !important;
}

/* 🔴 Encabezados y acentos */
h1, h2, h3, .fw-bold {
  color: #d40000;
}

/* =========================================
   NAVBAR SUPERIOR
   ========================================= */
.navbar-dark {
  background-color: #d40000 !important;
}

/* Barra superior compacta */
.sb-topnav.navbar.navbar-dark {
  position: relative !important;
  padding-top: 0.25rem !important;
  padding-bottom: 0.25rem !important;
  min-height: 42px !important;
  line-height: 1.1 !important;
}

/* Quitar espacio extra del body cuando se usa sb-nav-fixed */
body.sb-nav-fixed {
  padding-top: 0 !important;
}

/* Centrado del texto en el navbar */
.sb-topnav .navbar-brand,
.sb-topnav .navbar-nav .nav-link {
  display: flex;
  align-items: center;
  height: 100%;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* =========================================
   SIDEBAR
   ========================================= */
.sb-sidenav {
  background-color: #1d1f21 !important;
}
.sb-sidenav .nav-link {
  color: #ccc;
  font-size: 0.95rem;
}
.sb-sidenav .nav-link:hover {
  color: #fff;
}
.sb-sidenav-menu-heading {
  color: #999;
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-top: 1rem;
}
.sb-sidenav-footer {
  background-color: #17191b;
  color: #aaa;
}

/* =========================================
   NAVBAR INFERIOR (BottomNav)
   ========================================= */
.navbar.fixed-bottom {
  background-color: #fff !important;
  border-top: 2px solid #d40000;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  height: 56px;
}

.navbar.fixed-bottom .nav-link {
  color: #555;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.25rem 0.5rem;
  transition: all 0.2s ease-in-out;
}

.navbar.fixed-bottom .nav-link.active {
  color: #d40000 !important;
  font-weight: 600;
}

.navbar.fixed-bottom .nav-link:hover {
  color: #b30000;
}

.navbar.fixed-bottom i {
  display: block;
}
/* =========================================
   🔻 Bottom Navigation Arapyahú
   ========================================= */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #ffffff;
  border-top: 1px solid #ddd;
  display: flex;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  z-index: 9999;
  padding: 0 4px;
}

.bottom-nav-link {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: #333;
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  position: relative;
  transition:
    color 0.2s ease-in-out,
    transform 0.2s ease-in-out;
}

/* Iconos pulidos */
.bottom-nav-link i {
  font-size: 1.3rem;
  display: block;
  transition: transform 0.2s ease-in-out;
}

/* Texto */
.bottom-nav-link span {
  font-size: 0.72rem;
}

/* Estado activo (color + animación) */
.bottom-nav-link.active {
  color: #d40000;
  font-weight: 600;
}

.bottom-nav-link.active i {
  transform: translateY(-1px) scale(1.05);
}

/* Hover suave en desktop */
@media (hover: hover) {
  .bottom-nav-link:hover {
    color: #d40000;
  }
  .bottom-nav-link:hover i {
    transform: translateY(-1px) scale(1.05);
  }
}

/* Barra roja tipo app moderna */
.bottom-nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;            /* 🔥 bajamos la barra */
  left: 50%;
  width: 26px;             /* un poquito más ancha */
  height: 3px;             /* grosor ideal en móviles */
  border-radius: 999px;
  background: transparent;
  transform: translateX(-50%) scaleX(0);
  transition: background 0.25s ease-in-out, transform 0.25s ease-in-out;
}

/* Estado activo */
.bottom-nav-link.active::after {
  background: #d40000;
  transform: translateX(-50%) scaleX(1);
}

/* =========================================
   AJUSTES DE ESPACIADO Y RESPONSIVE
   ========================================= */

/* Compactar el espacio entre header y contenido en escritorio */
@media (min-width: 992px) {
  main.container-fluid {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }

  h2, h3 {
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
  }
}

/* Ajustes para móviles */
@media (max-width: 991px) {
  .sb-topnav.navbar.navbar-dark {
    padding-top: 0.2rem !important;
    padding-bottom: 0.2rem !important;
    min-height: 40px !important;
  }

  .navbar.fixed-bottom {
    height: 54px;
  }
}

@media (min-width: 992px) {
  body.sb-nav-fixed main.container-fluid {
    margin-left: 200px; /* ancho del sidebar */
    padding-right: 12rem;
    transition: margin-left 0.3s ease, padding-right 0.3s ease;
  }

  /* Cuando el sidebar está colapsado */
  body.sb-nav-fixed.sb-sidenav-toggled main.container-fluid {
    margin-left: 0;
  }
}

.navbar-dark .navbar-brand {
  color: #fff !important;
  font-weight: 600;
}
.navbar-dark .navbar-brand:hover {
  color: #f5f5f5 !important;
}

/* =========================================
   🔻 Bottom Navigation Bar - Ajuste + Animación
   ========================================= */

#bottomNav .navbar {
  background-color: #fff !important;
  border-top: 2px solid #d40000;
  height: 56px;
  padding: 0.25rem 0;
}

#bottomNav .navbar-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
}

#bottomNav .nav-item {
  flex: 1;
  text-align: center;
}

#bottomNav .nav-link {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  color: #555 !important;
  font-size: 0.8rem !important;
  line-height: 1.1 !important;
  transition: all 0.2s ease-in-out;
  position: relative;
}

#bottomNav .nav-link i {
  font-size: 1.2rem;
}

#bottomNav .nav-link span,
#bottomNav .nav-link small {
  display: block !important;
  font-size: 0.7rem !important;
  margin-top: 2px !important;
}

/* 🔴 Estado activo */
#bottomNav .nav-link.active {
  color: #d40000 !important;
  font-weight: 600;
}

/* ✨ Efecto de resalte animado */
#bottomNav .nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 24px;
  height: 3px;
  background: #d40000;
  border-radius: 2px;
  transform: translateX(-50%) scaleX(1);
  transition: transform 0.3s ease;
}

#bottomNav .nav-link:not(.active)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 24px;
  height: 3px;
  background: transparent;
  transform: translateX(-50%) scaleX(0);
  transition: transform 0.3s ease;
}

#video {
  width: 100%;
  max-width: 380px;
  height: 280px;
  background-color: #000;
  border-radius: 8px;
  display: block;
  margin: 0 auto;
}

#qr-reader {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 6px rgba(0, 0, 0, .2);
}

/* === Custom Toast Styles === */
#toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  width: 100%;
  max-width: 420px; /* controla que no sea demasiado ancho */
  padding: 0 12px;
}
.custom-toast {
  padding-left: 20px !important;  /* separa texto del borde azul */
}
.custom-toast .toast-body {
  padding-left: 18px !important;
}
.custom-toast {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.custom-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.custom-toast {
  display: flex;
  align-items: center;
  min-width: 280px;
  max-width: 360px;
  background: #fefefe;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  overflow: hidden;
  margin-bottom: 12px;
  border-left: 16px solid transparent;
  animation: slideIn 0.3s ease;
}

.custom-toast .toast-body {
  padding: 10px 15px;
  flex-grow: 1;
  color: #333;
}

.custom-toast .toast-title {
  font-weight: 600;
  margin-bottom: 3px;
}

.custom-toast .close-btn {
  border: none;
  background: none;
  color: #888;
  font-size: 18px;
  margin-right: 10px;
  cursor: pointer;
}

@keyframes slideIn {
  from {opacity: 0; transform: translateX(30px);}
  to {opacity: 1; transform: translateX(0);}
}

/* === Colores por tipo === */
.toast-error   { border-left-color: #e63946; box-shadow: inset 14px 0 0 #e63946; }
.toast-info    { border-left-color: #1d72f3; box-shadow: inset 14px 0 0 #1d72f3; }
.toast-success { border-left-color: #2a9d8f; box-shadow: inset 14px 0 0 #2a9d8f; }
.toast-warning { border-left-color: #f4a261; box-shadow: inset 14px 0 0 #f4a261; }

/* ===== 🎨 Chips de filtro (móvil) ===== */
.filtro-scroll::-webkit-scrollbar {
  height: 6px;
}
.filtro-scroll::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 10px;
}
.filtro-btn {
  transition: all 0.2s ease-in-out;
}
.filtro-btn.active {
  background-color: #d40000 !important; /* rojo corporativo */
  color: #fff !important;
  border-color: #d40000 !important;
  box-shadow: 0 0 6px rgba(212, 0, 0, 0.4);
}

/* ✅ Header Arapyahú */
.app-header {
  background: #d40000;
  color: white;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 0 8px 0;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 999;
}

.app-header .app-logo {
  height: 38px;
  object-fit: contain;
}

.app-header .app-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.container[data-page="pedidos-nuevo"] {
  margin-bottom: 0.75rem !important;
  padding-bottom: 0.5rem;
}

/* Columna de importes */
td.importe-linea {
  padding-right: 12px;
}

/* Total alineado */
#pedido-total-display {
  border-top: 2px solid #ddd;
  padding-top: 6px;
}

/* Sutil guía visual */
.table td, .table th {
  vertical-align: middle;
}

/* =========================
   MODO IMPRESIÓN (A4)
   ========================= */
@media print {

  @page {
    margin: 10mm;
  }

  body {
    background: #ffffff !important;
    font-size: 11px;
  }

  /* 🔹 OCULTAR SOLO NAVEGACIÓN INFERIOR (navbott) */
  #navbott,
  .navbott,
  .navbott-container,
  .nav-bottom-fixed,
  .nav-bottom,
  .bottom-nav,
  .bottom-nav-fixed,
  nav.fixed-bottom,
  .fixed-bottom[data-role="navbott"],
  .no-print {
    display: none !important;
  }

  /* ⚠️ IMPORTANTE: YA NO OCULTAMOS header / .navbar
     para que el logo de la cabecera SIGA APARECIENDO */

  /* Procesar pedidos: usar solo la columna del detalle en impresión */
  [data-page="pedidos-procesar"] .container {
    max-width: 100% !important;
    margin: 0;
    padding: 0 10mm;
  }

  [data-page="pedidos-procesar"] #col-lista-pedidos {
    display: none !important;
  }

  [data-page="pedidos-procesar"] #col-detalle-comanda {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100%;
  }

  [data-page="pedidos-procesar"] #card-detalle-comanda {
    box-shadow: none;
    border: none;
    margin-top: 5mm;
  }

  [data-page="pedidos-procesar"] .comanda-contenido {
    padding: 0;
  }

  [data-page="pedidos-procesar"] #tabla-detalle-procesar th,
  [data-page="pedidos-procesar"] #tabla-detalle-procesar td {
    padding-top: 2px;
    padding-bottom: 2px;
  }

  [data-page="pedidos-procesar"] #tabla-detalle-procesar thead {
    border-bottom: 1px solid #000;
  }

  [data-page="pedidos-procesar"] #tabla-detalle-procesar tfoot {
    border-top: 1px solid #000;
  }
}
