/* 🎯 SCROLL INDICATOR GLOBAL DEL PROYECTO "PEQUE" */
/* Importar estilos del scroll indicator */
@import url('/css/scroll-indicator.css');

/* ========================================
   APP BASE – Layout mobile-first (ordenes, dashboard, cierre, historial, citas, voucher, admin)
   ======================================== */

/* Alertas globales: sin style inline (CSP) */
.app-alertas {
  z-index: 9999;
}

/* Body páginas app: fluido, sin padding por defecto */
body.container-fluid.py-0 {
  padding-top: env(safe-area-inset-top, 0);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

body.admin-page,
body.citas-page,
body.cierre-page,
body.historial-page,
body.dashboard-page,
body.voucher-page {
  background:
    radial-gradient(circle at top, rgba(232, 90, 143, 0.12), transparent 32%),
    linear-gradient(180deg, #fff7fb 0%, #f7f8fc 24%, #ffffff 100%);
  color: #1f2937;
}

/* Wrapper centrado max 980px */
.app-shell {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 0.75rem 1rem;
}
@media (min-width: 768px) {
  .app-shell {
    padding: 0 1rem 1.5rem;
  }
}

/* Header sticky con safe area (menú dropdown visible) */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  overflow: visible;
  padding-top: env(safe-area-inset-top, 0);
  margin-bottom: 1rem;
}
.app-header .app-header-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
@media (min-width: 768px) {
  .app-header .app-header-title {
    font-size: 1.75rem;
  }
}

/* Touch targets en páginas app (min 44px) */
.dashboard-page .btn,
.dashboard-page .form-control,
.dashboard-page .form-select,
.dashboard-page .dropdown-toggle,
.cierre-page .btn,
.cierre-page .form-control,
.cierre-page .form-select,
.cierre-page .dropdown-toggle,
.historial-page .btn,
.historial-page .form-control,
.historial-page .form-select,
.historial-page .dropdown-toggle,
.citas-page .btn,
.citas-page .form-control,
.citas-page .form-select,
.citas-page .dropdown-toggle,
.voucher-page .btn,
.admin-page .btn,
.admin-page .form-control,
.admin-page .form-select,
.admin-page .dropdown-toggle {
  min-height: 44px;
}
.dashboard-page .form-control,
.dashboard-page .form-select,
.cierre-page .form-control,
.cierre-page .form-select,
.historial-page .form-control,
.historial-page .form-select,
.citas-page .form-control,
.citas-page .form-select,
.admin-page .form-control,
.admin-page .form-select {
  padding: 0.5rem 0.75rem;
}

/* CTA fijo abajo en móvil: padding en body para no tapar contenido */
body.cierre-page.has-mobile-cta {
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (max-width: 767.98px) {
  body.cierre-page.has-mobile-cta {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
  }
  /* Órdenes: body tiene container-fluid py-0 (mayor especificidad que body.ordenes-page) */
  body.container-fluid.py-0.ordenes-page {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0));
  }
}

/* Barra CTA fija inferior (móvil) */
.mobile-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
  background: #fff;
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}
.mobile-cta-bar .btn {
  min-height: 44px;
  font-weight: 600;
}

/* Nav compacto desktop: dropdown "Más" */
.app-header .nav-app-desktop .dropdown-menu {
  min-width: 12rem;
  padding: 0.35rem;
}
.app-header .nav-app-desktop .dropdown-item,
.app-header .nav-app-desktop .logout-action {
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.app-header .nav-app-desktop .logout-action {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: inherit;
}

/* Admin: sidebar en desktop (legado; el menú actual usa topbar + tarjetas) */
.admin-sidebar {
  min-width: 200px;
}

.admin-hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .admin-hub-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.admin-hub-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  min-height: 44px;
  padding: 1.25rem;
  border: 1px solid rgba(212, 74, 122, 0.12);
  border-radius: 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.06);
  text-decoration: none;
  color: #1f2937;
}
.admin-hub-card:hover,
.admin-hub-card:focus-visible {
  color: #1f2937;
  border-color: rgba(212, 74, 122, 0.32);
}
.admin-hub-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, #e85a8f 0%, #d44a7a 58%, #c53f6d 100%);
  color: #ffffff;
  font-size: 1.2rem;
}
.admin-hub-card__title {
  font-weight: 700;
  font-size: 1.05rem;
}
.admin-hub-card__text {
  font-size: 0.9rem;
  color: #6c757d;
}

/* ========================================
   DASHBOARD-PAGE: filtros mobile-first
   ======================================== */
.dashboard-filtros-card .dropdown-menu,
.nav-dashboard .dropdown-menu {
  z-index: 1030;
}

/* Layout: columna en móvil, grid en desktop (presets + acordeón | estado + acciones) */
.dashboard-filtros-inner {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
@media (min-width: 768px) {
  .dashboard-filtros-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(200px, 280px);
    grid-template-areas:
      "head head"
      "presets status"
      "accordion actions";
    gap: 0.65rem 1.25rem;
    align-items: start;
  }
  .dashboard-filtros-inner .df-header {
    grid-area: head;
  }
  .dashboard-filtros-inner .df-status {
    grid-area: status;
  }
  .dashboard-filtros-inner .df-presets {
    grid-area: presets;
  }
  .dashboard-filtros-inner .df-accordion {
    grid-area: accordion;
  }
  .dashboard-filtros-inner .df-actions {
    grid-area: actions;
    align-self: end;
    justify-self: stretch;
    justify-content: flex-end;
  }
}

.dashboard-filtros-card-header .dashboard-filtros-eyebrow {
  display: block;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.15rem;
}
.dashboard-filtros-card-header .dashboard-filtros-title {
  line-height: 1.25;
}

.dashboard-filtros-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
/* Una fila con scroll horizontal en móvil; wrap en desktop */
.dashboard-filtros-presets.dashboard-filtros-presets--scroll {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px;
  margin-inline: -2px;
  padding-inline: 2px;
}
.dashboard-filtros-presets.dashboard-filtros-presets--scroll .btn-preset {
  flex: 0 0 auto;
}
@media (min-width: 768px) {
  .dashboard-filtros-presets.dashboard-filtros-presets--scroll {
    flex-wrap: wrap;
    overflow-x: visible;
    margin-inline: 0;
    padding-inline: 0;
  }
}

.dashboard-page .btn-preset {
  min-height: 44px;
  transition: all 0.2s ease;
}

.dashboard-filtros-accordion .accordion-button {
  font-size: 0.875rem;
}
.dashboard-filtros-accordion .accordion-button:not(.collapsed) {
  box-shadow: none;
}

/* Acciones en fila compacta (móvil y desktop) */
.dashboard-filtros-actions .btn {
  flex: 0 1 auto;
}
@media (max-width: 767.98px) {
  .dashboard-filtros-actions {
    width: 100%;
  }
  .dashboard-filtros-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
  }
}
.dashboard-filtros-error {
  font-size: 0.875rem;
  color: var(--bs-warning-text-emphasis, #664d03);
  background-color: var(--bs-warning-bg-subtle, #fff3cd);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.dashboard-filtros-error.filtros-error-visible {
  opacity: 1;
}
.dashboard-filtros-card #wrapRangoAplicado .badge {
  font-size: 0.8rem;
  padding: 0.35em 0.65em;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.dashboard-filtros-card .btn-apply-filtros:disabled,
.dashboard-filtros-card #btnAplicarFiltros:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}
.dashboard-filtros-card #wrapRangoAplicado .badge.bg-primary {
  background-color: var(--bs-primary) !important;
}
.dashboard-filtros-card #wrapRangoAplicado .badge.bg-secondary {
  background-color: var(--bs-secondary) !important;
}

/* 🎯 ESTILOS GLOBALES EXISTENTES */
/* global.css - estilos reutilizables en toda la app */

/* General: Mejoras visuales en modales */
/* Excluir modales específicos que tienen sus propios estilos */
.modal:not(#modalGestionServicios):not(#modalNuevoServicio) .modal-header {
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.modal:not(#modalGestionServicios):not(#modalNuevoServicio) .modal-title {
  font-weight: bold;
  color: #2c3e50;
}

.modal:not(#modalGestionServicios):not(#modalNuevoServicio) .modal-body {
  padding: 1rem;
}

.modal .table-hover tbody tr:hover {
  background-color: #f0f4f8;
}

.modal .badge {
  font-size: 0.8rem;
}

/* Responsive en móviles (≤ 576px) */
@media (max-width: 576px) {
  .modal .modal-content {
    font-size: 0.9rem;
  }

  .modal .btn {
    font-size: 0.85rem;
    padding: 0.375rem 0.5rem;
  }

  .modal .table td,
  .modal .table th {
    padding: 0.4rem;
    white-space: nowrap;
  }
}

#sugerenciasClientes {
  cursor: pointer;
}

#sugerenciasClientes li:hover {
  background-color: #f0f0f0;
}

#sugerenciasClientes {
  z-index: 1050;
  border-radius: 0.25rem;
}


.voucher {
  max-width: 600px;
  margin: auto;
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.05);
  border: 1px solid #e0e0e0;
}

.voucher h2 {
  font-weight: bold;
  text-align: center;
  margin-bottom: 20px;
}

.servicio-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed #ccc;
  padding: 6px 0;
}

.total {
  font-size: 1.2em;
  font-weight: bold;
  text-align: right;
  margin-top: 15px;
}

.btn-wsp {
  background-color: #25D366;
  color: white;
  border: none;
  padding: 10px 20px;
  font-weight: bold;
  border-radius: 5px;
  cursor: pointer;
}

.btn-wsp:hover {
  background-color: #1ebe57;
}

@media print {
  body {
    background: white !important;
    margin: 0;
    padding: 0;
    font-size: 12pt;
  }

  .voucher {
    box-shadow: none !important;
    border: none !important;
    padding: 10px;
  }

  .servicio-item {
    font-size: 11pt;
    border-bottom: 1px solid #999;
  }

  .total {
    font-size: 13pt;
    font-weight: bold;
    border-top: 2px solid #000;
    padding-top: 8px;
  }

  .btn,
  .btn-wsp,
  button,
  a[href^="https://wa.me"] {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .voucher {
    padding: 15px;
  }

  .servicio-item span {
    font-size: 0.95rem;
  }

  .total {
    font-size: 1.05rem;
  }
}

.login-card {
  max-width: 400px;
  width: 100%;
}

.seccion-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 600;
  color: #6c757d; /* Bootstrap text-muted */
}

.input-destacado {
  border: 2px solid #0d6efd; /* Azul Bootstrap */
  box-shadow: 0 0 5px rgba(13, 110, 253, 0.7);
}

.servicio-agregado {
  animation: resaltarServicio 0.6s ease-out;
}

@keyframes resaltarServicio {
  from {
    background-color: #d4edda;
    opacity: 0.2;
  }
  to {
    background-color: transparent;
    opacity: 1;
  }
}

/* ✅ Mejora tabla para móviles */
#modalHistorialCliente .table-responsive {
  max-height: 60vh;
  overflow-y: auto;
  border: 1px solid #dee2e6;
}

#modalHistorialCliente .table td,
#modalHistorialCliente .table th {
  white-space: nowrap;
  font-size: 0.875rem;
}

#modalHistorialCliente .modal-body {
  padding: 1rem;
}

/* Encabezado fijo */
#modalHistorialCliente thead th {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  z-index: 1;
}

@media (max-width: 576px) {
  .card .btn {
    width: 100% !important;
  }
}

#inputWhatsappPaste {
  font-family: monospace;
}

@media (max-width: 576px) {
  #modalNuevoCliente .modal-dialog {
    max-height: 90vh;
    margin: 0.5rem auto;
  }

  #modalNuevoCliente .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }

  #modalNuevoCliente .modal-body {
    padding: 1rem;
  }

  #modalNuevoCliente input,
  #modalNuevoCliente textarea,
  #modalNuevoCliente button {
    font-size: 0.9rem;
  }

  #modalNuevoCliente .form-label {
    font-size: 0.85rem;
  }
}

.whatsapp-box {
  background-color: #e2fbe2;
  border: 1px solid #b5eab5;
  border-radius: 12px;
  padding: 0.5rem;
}

.whatsapp-textarea {
  background: transparent;
  border: none;
  resize: none;
  font-family: monospace;
  font-size: 0.9rem;
  padding: 0;
  box-shadow: none;
  outline: none;
}

#listaServicios > div {
  font-size: 0.85rem;
  word-wrap: break-word;
}

/* ========================================
   ORDENES - MOBILE-FIRST / APP SHELL
   ======================================== */

/* Alertas: reemplazo de inline style (CSP) */
.ordenes-alertas {
  z-index: 9999;
}

/* App shell: contenedor centrado max 980px */
.app-shell {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 0.75rem 1rem;
}
@media (min-width: 768px) {
  .app-shell {
    padding: 0 1rem 1.5rem;
  }
}

/* Header sticky */
.app-header.unified-header.ordenes {
  position: sticky;
  top: 0;
  z-index: 1020;
  margin-bottom: 1rem;
}
.app-header-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
@media (min-width: 768px) {
  .app-header-title {
    font-size: 1.75rem;
  }
}

/* Opción A (móvil): Offcanvas bottom sheet "Acciones" */
.offcanvas-acciones.offcanvas-bottom {
  max-height: 70vh;
  border-radius: 1rem 1rem 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.offcanvas-acciones .offcanvas-header {
  padding: 1rem 1.25rem;
}
.offcanvas-acciones .offcanvas-title {
  font-size: 1.25rem;
  font-weight: 700;
}
.offcanvas-acciones .btn-accion-sheet {
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  justify-content: flex-start;
  text-align: left;
  border-radius: 0.5rem;
}
.offcanvas-acciones .btn-accion-sheet .fs-4 {
  flex-shrink: 0;
}

/* Opción D (desktop): Dropdown "Más" compacto */
.nav-ordenes-desktop .dropdown-menu {
  min-width: 12rem;
  padding: 0.35rem;
}
.nav-ordenes-desktop .dropdown-item,
.nav-ordenes-desktop .logout-action {
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.nav-ordenes-desktop .logout-action {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: inherit;
}

/* Thumb-friendly: mínimo 44px de altura (touch target) */
.btn-thumb,
.ordenes-page .form-control.form-control-enhanced,
.ordenes-page .btn-enhanced,
.ordenes-page .dropdown .dropdown-toggle {
  min-height: 44px;
}
.ordenes-page .form-control.form-control-enhanced {
  padding: 0.6rem 0.75rem;
}
.ordenes-page .dropdown .dropdown-toggle {
  display: inline-flex;
  align-items: center;
}

/* Fecha y búsqueda cliente: ancho correcto en móvil */
.ordenes-fecha-input {
  max-width: 140px;
}
@media (max-width: 767.98px) {
  .ordenes-fecha-input {
    max-width: none;
    width: 100%;
  }
  .ordenes-page .col-md-6.position-relative {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Sugerencias clientes (reemplazo de inline; visibilidad la controla JS) */
.sugerencias-clientes-list {
  top: 100%;
  max-height: 250px;
  overflow-y: auto;
  display: none;
}

/* Servicios dropdown (JS controla display) */
.servicios-dropdown {
  display: none;
}

/* Lista servicios: card-like y acciones clickeables en móvil */
.servicios-lista {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
}
.ordenes-page .servicio-item {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.36rem;
  padding: 0.38rem 0.48rem;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0.6rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.ordenes-page .servicio-item .servicio-header {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.36rem;
}
.ordenes-page .servicio-item .servicio-nombre {
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.25;
  color: #212529;
}
.ordenes-page .servicio-item .servicio-acciones {
  flex-shrink: 0;
}
.ordenes-page .servicio-item .btn-servicio.btn-eliminar-servicio {
  min-height: 28px;
  min-width: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #dc3545;
  border: 1px solid #dc3545;
  border-radius: 0.45rem;
  background: #fff;
}
.ordenes-page .servicio-item .btn-servicio.btn-eliminar-servicio i {
  font-size: 0.8rem;
  line-height: 1;
}
.ordenes-page .servicio-item .btn-servicio.btn-eliminar-servicio:hover {
  background: #dc3545;
  color: #fff;
}
.ordenes-page .servicios-vacio {
  padding: 1.5rem;
  text-align: center;
  color: #6c757d;
  background: #f8f9fa;
  border-radius: 0.5rem;
}

/* CTA fijo abajo en móvil */
.mobile-cta-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  padding: 0.75rem 1rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0));
  background: #fff;
  border-top: 1px solid #dee2e6;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
}
.mobile-cta-bar .btn {
  min-height: 44px;
  font-weight: 600;
}
