/* =============================================================================
   Estilos para el Cintillo y Modal de Entornos Demo (Modos de Prueba)
   ============================================================================= */

:root {
  --demo-banner-height: 48px;
}

body.has-demo-banner {
  padding-top: var(--demo-banner-height) !important;
}

/* Cintillo Superior Persistente */
.demo-banner-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--demo-banner-height);
  z-index: 99999;
  background: linear-gradient(90deg, #0f172a 0%, #1e1b4b 35%, #0f172a 100%);
  border-bottom: 1px solid rgba(129, 140, 248, 0.25);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.45);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  font-family: inherit;
  backdrop-filter: blur(8px);
}

.demo-banner-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.25));
  border: 1px solid rgba(168, 85, 247, 0.4);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e0e7ff;
  box-shadow: 0 0 12px rgba(129, 140, 248, 0.2);
}

.demo-banner-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: #cbd5e1;
}

.demo-banner-highlight {
  font-weight: 700;
  color: #ffffff;
}

.demo-banner-sub {
  color: #94a3b8;
  font-size: 0.72rem;
}

.demo-banner-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Botones del Cintillo */
.btn-demo-switch-rubro {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
  padding: 0.32rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.73rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-demo-switch-rubro:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-demo-reset-negocio {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #ffffff;
  padding: 0.32rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.73rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
  transition: all 0.2s ease;
}

.btn-demo-reset-negocio:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

/* Modal Selector de Modos */
.demo-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.demo-modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.demo-modal-card {
  background: #ffffff;
  border-radius: 1.5rem;
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(226, 232, 240, 0.8);
  overflow: hidden;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.demo-modal-backdrop.is-open .demo-modal-card {
  transform: scale(1);
}

/* Estilos oscuros para el modal si el tema es dark */
html.dark .demo-modal-card {
  background: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.demo-grid-rubros {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
  padding: 1.25rem;
  overflow-y: auto;
}

.demo-card-item {
  border-radius: 1rem;
  padding: 1rem;
  border: 1.5px solid #e2e8f0;
  background-color: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

html.dark .demo-card-item {
  border-color: #334155;
  background-color: #1e293b;
}

.demo-card-item:hover {
  border-color: #6366f1;
  background-color: #eef2ff;
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.15);
}

html.dark .demo-card-item:hover {
  border-color: #818cf8;
  background-color: #273549;
}

.demo-card-item.is-active {
  border-color: #10b981;
  background-color: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

html.dark .demo-card-item.is-active {
  border-color: #10b981;
  background-color: #064e3b;
}

@media (max-width: 640px) {
  :root {
    --demo-banner-height: 72px;
  }
  .demo-banner-container {
    flex-direction: column;
    justify-content: center;
    padding: 0.4rem 0.75rem;
    gap: 0.35rem;
  }
  .demo-banner-left {
    width: 100%;
    justify-content: center;
  }
  .demo-banner-right {
    width: 100%;
    justify-content: center;
  }
}

/* =============================================================================
   Colores de texto explícitos para el modal (Tailwind dark: no se compila
   en JS dinámico, así que se definen aquí con CSS puro)
   ============================================================================= */

/* Encabezado del modal */
.demo-modal-card h3 {
  color: #0f172a;
  font-size: 0.9375rem;
  font-weight: 900;
}

html.dark .demo-modal-card h3 {
  color: #f8fafc;
}

.demo-modal-card > div:first-child {
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

html.dark .demo-modal-card > div:first-child {
  background-color: rgba(30, 41, 59, 0.6);
  border-bottom-color: #334155;
}

/* Subtítulo del encabezado */
.demo-modal-card h3 + p,
.demo-modal-card .demo-modal-subtitle {
  color: #64748b;
  font-size: 0.75rem;
}

html.dark .demo-modal-card h3 + p,
html.dark .demo-modal-card .demo-modal-subtitle {
  color: #94a3b8;
}

/* Tarjetas de sectores - títulos */
.demo-card-item h4 {
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 900;
  line-height: 1.35;
}

html.dark .demo-card-item h4 {
  color: #f8fafc;
}

/* Tarjetas de sectores - descripción */
.demo-card-item p {
  color: #64748b;
  font-size: 0.6875rem;
  margin-top: 0.25rem;
}

html.dark .demo-card-item p {
  color: #94a3b8;
}

/* Badge de cantidad de productos */
.demo-card-item span[class*="uppercase"] {
  background-color: #e0e7ff;
  color: #3730a3;
  font-size: 0.625rem;
  font-weight: 800;
}

html.dark .demo-card-item span[class*="uppercase"] {
  background-color: rgba(79, 70, 229, 0.35);
  color: #c7d2fe;
}

/* Caja de "gancho de venta" (tips) */
.demo-card-item div[class*="amber"] {
  background-color: #fffbeb;
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #92400e;
}

html.dark .demo-card-item div[class*="amber"] {
  background-color: rgba(120, 53, 15, 0.25);
  border-color: rgba(180, 83, 9, 0.35);
  color: #fcd34d;
}

/* Línea inferior de la tarjeta */
.demo-card-item div[class*="border-t"] {
  border-top-color: #e2e8f0;
}

html.dark .demo-card-item div[class*="border-t"] {
  border-top-color: rgba(51, 65, 85, 0.6);
}

/* Texto "Activo actualmente / Listo para probar" */
.demo-card-item span[class*="text-slate-4"],
.demo-card-item span[class*="text-[10px]"] {
  color: #94a3b8;
}

/* Pie del modal */
.demo-modal-card > div:last-child {
  background-color: #f8fafc;
  border-top: 1px solid #e2e8f0;
}

html.dark .demo-modal-card > div:last-child {
  background-color: rgba(15, 23, 42, 0.4);
  border-top-color: #334155;
}

/* Texto de tip en el pie del modal */
.demo-modal-card > div:last-child span {
  color: #64748b;
  font-size: 0.75rem;
}

html.dark .demo-modal-card > div:last-child span {
  color: #94a3b8;
}

/* Botón cerrar (X) del modal */
#btn-cerrar-modal-modos {
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 0.5rem;
  padding: 0.375rem;
  transition: all 0.15s ease;
}

#btn-cerrar-modal-modos:hover {
  color: #475569;
  background-color: #e2e8f0;
}

html.dark #btn-cerrar-modal-modos {
  color: #64748b;
}

html.dark #btn-cerrar-modal-modos:hover {
  color: #e2e8f0;
  background-color: #334155;
}

/* Botón "Cerrar" en el pie */
#btn-modal-cancelar {
  background-color: #e2e8f0;
  color: #334155;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

#btn-modal-cancelar:hover {
  background-color: #cbd5e1;
}

html.dark #btn-modal-cancelar {
  background-color: #334155;
  color: #e2e8f0;
}

html.dark #btn-modal-cancelar:hover {
  background-color: #475569;
}

/* =============================================================================
   Botón "🚀 Modos Demo" en la barra de navegación del admin
   (text-white, from-emerald-600, to-teal-600 no están en el CSS compilado)
   ============================================================================= */
#btn-admin-modos-demo {
  background: linear-gradient(to right, #059669, #0d9488);
  color: #ffffff !important;
  border: none;
  cursor: pointer;
}

#btn-admin-modos-demo:hover {
  background: linear-gradient(to right, #10b981, #14b8a6);
  color: #ffffff !important;
}

/* =============================================================================
   Botón Flotante (FAB) - Selector de Modos Demo
   Posicionado en la esquina inferior derecha, fuera de la navegación
   ============================================================================= */

.fab-demo-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, #059669 0%, #0d9488 100%);
  color: #ffffff;
  border: none;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.45), 0 2px 8px rgba(0,0,0,0.2);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  /* Animación de entrada desde abajo */
  animation: fab-slide-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes fab-slide-in {
  from {
    opacity: 0;
    transform: translateY(1.5rem) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.fab-demo-btn:hover {
  background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  box-shadow: 0 6px 28px rgba(5, 150, 105, 0.55), 0 4px 12px rgba(0,0,0,0.25);
  transform: translateY(-2px) scale(1.04);
}

.fab-demo-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.4);
}

.fab-demo-icon {
  font-size: 1rem;
  line-height: 1;
}

.fab-demo-label {
  letter-spacing: 0.01em;
}

/* Modo oscuro: brillo aumentado */
html.dark .fab-demo-btn {
  background: linear-gradient(135deg, #10b981 0%, #14b8a6 100%);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.5), 0 2px 8px rgba(0,0,0,0.4);
}

html.dark .fab-demo-btn:hover {
  background: linear-gradient(135deg, #34d399 0%, #2dd4bf 100%);
  box-shadow: 0 6px 28px rgba(52, 211, 153, 0.55), 0 4px 12px rgba(0,0,0,0.4);
}

/* Si hay demo banner activo, subir el FAB para no tapar el cintillo en móvil */
body.has-demo-banner .fab-demo-btn {
  bottom: 1.5rem;
}

@media (max-width: 640px) {
  .fab-demo-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.7rem;
  }
}
