/* ==========================================================================
   Narratix — Explorar Historias (Explore Suite)
   Estilo Cyber-Cinemático, Glassmorphism & Animaciones Awwwards
   ========================================================================== */

/* Fondo y Estructura Global de Exploración */
.explore-page-wrapper {
  position: relative;
  min-height: 100vh;
  overflow-x: clip;
  max-width: 100%;
  width: 100%;
  background: var(--color-bg-body);
  color: var(--color-text-primary);
}

/* Luces Ambientales Cósmicas de Fondo */
.ambient-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(100px);
  max-width: 100vw;
  overflow: hidden;
}

.ambient-glow-explore-1 {
  width: min(600px, 90vw);
  height: min(600px, 90vw);
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, transparent 70%);
  top: -120px;
  left: 0;
  animation: exploreOrbFloat 14s ease-in-out infinite alternate;
}

.ambient-glow-explore-2 {
  width: min(550px, 85vw);
  height: min(550px, 85vw);
  background: radial-gradient(circle, rgba(236, 72, 153, 0.16) 0%, transparent 70%);
  top: 300px;
  right: 0;
  animation: exploreOrbFloat 18s ease-in-out infinite alternate-reverse;
}

.ambient-glow-explore-3 {
  width: min(500px, 80vw);
  height: min(500px, 80vw);
  background: radial-gradient(circle, rgba(6, 182, 212, 0.14) 0%, transparent 70%);
  bottom: 100px;
  left: 10%;
}

@keyframes exploreOrbFloat {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.08); }
  100% { transform: translateY(20px) scale(0.95); }
}

.explore-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
  box-sizing: border-box;
}

/* =========================================
   Header de Exploración
========================================= */
.explore-header {
  padding: 3.5rem 0 1.8rem;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.explore-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #C7D2FE;
  font-family: var(--font-primary);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  width: fit-content;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.explore-hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #06B6D4;
  box-shadow: 0 0 10px #06B6D4;
  animation: exploreDotPulse 2s ease-in-out infinite;
}

@keyframes exploreDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.explore-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 800;
  margin: 0;
  color: #FFFFFF;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.explore-title span {
  background: linear-gradient(135deg, #A5B4FC 0%, #6366F1 50%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.explore-subtitle {
  color: var(--color-text-secondary);
  font-size: clamp(0.95rem, 1.5vw, 1.05rem);
  margin: -0.4rem 0 0;
  max-width: 640px;
  line-height: 1.55;
}

/* Barra de Búsqueda Cyber */
.explore-search-wrap {
  width: 100%;
  max-width: 680px;
  position: relative;
  margin-top: 0.5rem;
}

.explore-search-wrap::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.4), rgba(236, 72, 153, 0.4), rgba(6, 182, 212, 0.4));
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 0;
  pointer-events: none;
  filter: blur(6px);
}

.explore-search-wrap:focus-within::before {
  opacity: 1;
}

.search-input {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 1rem 1.4rem 1rem 3.4rem;
  background: rgba(18, 22, 36, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: #FFFFFF;
  font-family: var(--font-primary);
  font-size: 0.98rem;
  box-sizing: border-box;
  transition: all var(--transition-spring);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.search-input::placeholder {
  color: #64748B;
}

.search-input:focus {
  border-color: rgba(99, 102, 241, 0.7);
  background: rgba(22, 28, 48, 0.9);
  outline: none;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 30px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #818CF8;
  z-index: 2;
  pointer-events: none;
  transition: color var(--transition-fast);
}

.explore-search-wrap:focus-within .search-icon {
  color: #A5B4FC;
}

/* =========================================
   Pestañas de Feed (Descubrir / Siguiendo)
========================================= */
.feed-tabs {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.8rem;
  background: rgba(18, 22, 36, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.35rem;
  border-radius: var(--radius-full);
  width: fit-content;
}

.feed-tab {
  position: relative;
  padding: 0.6rem 1.4rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--color-text-secondary);
  font-family: var(--font-primary);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-spring);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.feed-tab:hover {
  color: #FFFFFF;
  background: rgba(255, 255, 255, 0.06);
}

.feed-tab.active {
  background: var(--gradient-brand);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.45), 0 0 15px rgba(236, 72, 153, 0.3);
}

/* =========================================
   Filtros y Categorías
========================================= */
.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.2rem;
  padding-bottom: 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.categories {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category-pill {
  padding: 0.5rem 1.15rem;
  background: rgba(18, 22, 36, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--color-text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-family: var(--font-primary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-spring);
}

.category-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.category-pill.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(236, 72, 153, 0.3));
  color: #FFFFFF;
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.35);
  font-weight: 700;
}

.sort-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.sort-select {
  background: rgba(18, 22, 36, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--color-text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 2.2rem 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.sort-select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(28, 36, 60, 0.9);
}

.sort-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.sort-select-arrow {
  position: absolute;
  right: 0.9rem;
  pointer-events: none;
  color: var(--color-text-muted);
}

/* =========================================
   Grilla y Tarjetas de Historias Cyber
========================================= */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.8rem;
  perspective: 1000px;
}

.story-card {
  position: relative;
  min-width: 0;
  background: rgba(18, 22, 36, 0.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-radius: var(--radius-2xl);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.25s;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  color: inherit;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform-style: preserve-3d;
}

.story-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18) 0%, rgba(99, 102, 241, 0.2) 50%, transparent 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.story-card:hover {
  transform: translateY(-8px);
  border-color: rgba(99, 102, 241, 0.55);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.25), 0 0 15px rgba(236, 72, 153, 0.15);
}

.story-card:hover::before {
  opacity: 1;
}

.story-card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Portada y Miniatura */
.story-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #090B12;
}

.story-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: block;
}

.story-card:hover .story-thumb {
  transform: scale(1.08);
}

/* Brillo Glassmorphic en Hover */
.story-card-glass-shine {
  position: absolute;
  top: 0;
  left: -120%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: skewX(-25deg);
  pointer-events: none;
  transition: left 0.7s ease;
}

.story-card:hover .story-card-glass-shine {
  left: 180%;
}

/* Overlay de Reproducción con Radar */
.story-play-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(9, 10, 16, 0.4) 0%, rgba(9, 10, 16, 0.75) 100%);
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.story-card:hover .story-play-overlay {
  opacity: 1;
}

.story-play-radar {
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.8);
  animation: storyRadarExpand 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes storyRadarExpand {
  0% { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(1.8); opacity: 0; }
}

.story-play-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gradient-brand);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.7), 0 0 15px rgba(236, 72, 153, 0.5);
  transform: scale(0.9);
  transition: transform var(--transition-spring);
}

.story-card:hover .story-play-icon {
  transform: scale(1.08);
}

.story-badge-scenes {
  position: absolute;
  bottom: 0.65rem;
  right: 0.65rem;
  background: rgba(9, 10, 16, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Información de la Tarjeta */
.story-info {
  padding: 1.25rem 1.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.story-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: #06B6D4;
  font-weight: 800;
  letter-spacing: 0.08em;
  margin-bottom: 0.45rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.story-category::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #06B6D4;
  box-shadow: 0 0 6px #06B6D4;
}

.story-title {
  font-family: var(--font-display);
  font-size: 1.18rem;
  margin: 0;
  line-height: 1.35;
  font-weight: 700;
  color: #FFFFFF;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast);
}

.story-card:hover .story-title {
  color: #A5B4FC;
}

/* Footer de la Tarjeta */
.story-card-footer {
  padding: 0.85rem 1.35rem 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.story-card-author {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  overflow: hidden;
  color: var(--color-text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.story-card-author:hover {
  color: #FFFFFF;
}

.story-card-author strong {
  color: #F8FAFC;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.story-card-avatar {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--gradient-brand);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.35);
}

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

.story-card-views {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #94A3B8;
  font-weight: 600;
  font-size: 0.78rem;
}

.story-card-views svg {
  color: #6366F1;
}

/* =========================================
   Estado Vacío y Spinner Cyber
========================================= */
.empty-state {
  text-align: center;
  padding: 4.5rem 2rem;
  color: var(--color-text-muted);
  grid-column: 1 / -1;
  background: rgba(18, 22, 36, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-2xl);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  max-width: 600px;
  margin: 2rem auto;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  display: grid;
  place-items: center;
  margin: 0 auto 1.2rem;
  color: #818CF8;
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.25);
}

.empty-state h3 {
  margin: 0 0 0.5rem;
  color: #FFFFFF;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
}

.empty-state p {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

/* Spinner Futurista de Doble Anillo Neón */
.loading-spinner-wrap {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 5rem 0;
}

.loading-spinner {
  position: relative;
  width: 50px;
  height: 50px;
}

.loading-spinner::before,
.loading-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
}

.loading-spinner::before {
  border-top-color: #6366F1;
  border-right-color: #6366F1;
  animation: spinnerSpin 0.9s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.loading-spinner::after {
  border-bottom-color: #EC4899;
  border-left-color: #EC4899;
  animation: spinnerSpinRev 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
  box-shadow: 0 0 15px rgba(236, 72, 153, 0.4);
}

@keyframes spinnerSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spinnerSpinRev {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(-360deg); }
}

.loading-text {
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #A5B4FC;
  animation: loadingTextFade 1.5s ease-in-out infinite alternate;
}

@keyframes loadingTextFade {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* =========================================
   Responsive
========================================= */
@media (max-width: 768px) {
  .explore-container {
    padding: 0 1rem 4rem;
  }
  .explore-header {
    padding-top: 2rem;
  }
  .filters {
    flex-direction: column;
    align-items: stretch;
  }
  .categories {
    width: 100%;
  }
  .sort-select-wrap {
    width: 100%;
  }
  .sort-select {
    width: 100%;
  }
  .stories-grid {
    gap: 1.2rem;
  }
}

@media (max-width: 480px) {
  .explore-container {
    padding: 0 0.75rem 3.5rem;
  }
  .explore-title {
    font-size: 1.85rem;
  }
  .explore-subtitle {
    font-size: 0.95rem;
  }
}
