/* ============================================================
   STORIES CAROUSEL — Módulo Historias de Negocios
   Fidelidad 100% al SDD original de Django
   ============================================================ */

/* --- Contenedor principal del carrusel --- */
.stories-section {
  width: 100%;
  padding: 8px 0 16px;
  margin-bottom: 10px;
}

.stories-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding-left: 4px;
}

.stories-section-label i {
  color: #25D366;
  font-size: 14px;
}

.stories-section-label span {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

/* --- Contenedor Padre: flexbox horizontal (SDD §3) --- */
.stories-container {
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding: 10px 0;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* Ocultar barra de scroll webkit (SDD §3) */
.stories-container::-webkit-scrollbar {
  display: none;
}

.stories-container {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* --- Tarjeta de Historia (SDD §3) --- */
.story-card {
  width: 120px;
  height: 200px;
  min-width: 120px;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-color: #1a1a1a;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.3s ease;
}

.story-card:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 8px 25px rgba(37, 211, 102, 0.15),
              0 4px 12px rgba(0, 0, 0, 0.4);
}

.story-card:active {
  transform: scale(0.97);
}

/* --- Overlay con gradiente lineal (SDD §3) --- */
.story-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
  pointer-events: none;
  z-index: 1;
}

/* --- Logo del negocio (SDD §3) --- */
.story-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: absolute;
  top: 10px;
  left: 10px;
  border: 3px solid #25D366;
  object-fit: cover;
  z-index: 2;
  background-color: #111;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Fallback del logo (iniciales) */
.story-logo-fallback {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  position: absolute;
  top: 10px;
  left: 10px;
  border: 3px solid #25D366;
  z-index: 2;
  background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* --- Título del negocio (SDD §3) --- */
.story-title {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  color: white;
  font-size: 12px;
  font-weight: bold;
  z-index: 2;
  line-height: 1.3;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* --- Badge "VIP" en tarjeta --- */
.story-vip-badge {
  position: absolute;
  top: 10px;
  right: 8px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #000;
  font-size: 8px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 4px;
  z-index: 3;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(255, 165, 0, 0.3);
}

/* --- Indicador de cantidad de historias --- */
.story-count-badge {
  position: absolute;
  top: 56px;
  left: 14px;
  background: rgba(37, 211, 102, 0.85);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  z-index: 3;
}

/* ============================================================
   VISOR FULLSCREEN DE HISTORIAS (Story Viewer Modal)
   ============================================================ */

.story-viewer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: storyFadeIn 0.25s ease-out;
}

@keyframes storyFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.story-viewer-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 480px;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  user-select: none;
}

@media (min-width: 768px) {
  .story-viewer-container {
    border-radius: 16px;
    height: 90vh;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
}

/* Cabecera del visor */
.story-viewer-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 16px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

/* Barras de progreso */
.story-progress-bars {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.story-progress-track {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  background: #fff;
  border-radius: 3px;
  transition: width 50ms linear;
}

/* Info del negocio en visor */
.story-viewer-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.story-viewer-business {
  display: flex;
  align-items: center;
  gap: 12px;
}

.story-viewer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.story-viewer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-viewer-avatar span {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.story-viewer-name h4 {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  margin: 0;
}

.story-viewer-name span {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

/* Botón cerrar */
.story-viewer-close {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  padding: 0;
  margin: 0;
}

.story-viewer-close:hover {
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
}

/* Contenido de la historia */
.story-viewer-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.story-viewer-content img {
  width: 100%;
  height: auto;
  max-height: 85vh;
  object-fit: contain;
}

/* Zonas táctiles de navegación */
.story-viewer-nav {
  position: absolute;
  top: 80px;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.story-nav-prev,
.story-nav-next {
  width: 33%;
  height: 100%;
  cursor: pointer;
  pointer-events: auto;
}

/* Pie del visor */
.story-viewer-footer {
  padding: 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  display: flex;
  justify-content: center;
  text-align: center;
}

.story-viewer-footer span {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

/* ============================================================
   ANIMACIONES PARA TARJETAS
   ============================================================ */

.story-card-enter {
  animation: storyCardSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}

@keyframes storyCardSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Estado vacío */
.stories-empty {
  display: none;
}
