/*******************************************************
 * stories-reels.css — Estilos para Stories y Reels
 * Diseño minimalista, moderno y profesional
 *******************************************************/

/* =========================
   STORIES BAR (arriba del feed)
   ========================= */
#storiesBar {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: linear-gradient(145deg, #ffffff, #f0f0f0);
  border-bottom: 1px solid #efefef;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

#storiesBar::-webkit-scrollbar {
  display: none;
}

.story-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 70px;
  cursor: pointer;
  user-select: none;
}

.story-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
  overflow: hidden;
  transition: transform 0.2s;
}

.story-avatar:active {
  transform: scale(0.95);
}

/* Borde gradiente para stories no vistas - AZUL VEHYLY */
.story-avatar.unseen {
  background: linear-gradient(135deg, #2979FF 0%, #1565C0 100%);
  padding: 3px;
}

.story-avatar.unseen img,
.story-avatar.unseen .avatar-placeholder {
  border: 3px solid #fff;
  border-radius: 50%;
}

/* Borde gris para stories ya vistas */
.story-avatar.seen {
  border: 2px solid #dbdbdb;
}

/* Borde especial para "Add Story" */
.story-avatar.add-story {
  border: 2px dashed #dbdbdb;
  background: #fafafa;
}

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

.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-weight: 700;
  font-size: 24px;
  border-radius: 50%;
}

.add-icon {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  background: #2979FF;
  color: #fff;
  border-radius: 50%;
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
}

.story-name {
  font-size: 12px;
  color: #262626;
  text-align: center;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.no-stories {
  padding: 20px;
  text-align: center;
  color: #8e8e8e;
  font-size: 14px;
}

/* =========================
   STORY VIEWER (Fullscreen)
   ========================= */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
}

.story-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
}

.story-progress-bars {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.3);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.progress-bar.complete {
  background: rgba(255,255,255,0.9);
}

.progress-bar.active::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: rgba(255,255,255,0.9);
  animation: progress 5s linear forwards;
}

@keyframes progress {
  from { width: 0; }
  to { width: 100%; }
}

.story-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.story-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
}

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

.story-user-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  flex: 1;
}

.story-time {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}

.story-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0,0,0,0.5);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.story-close:hover {
  background: rgba(0,0,0,0.7);
}

.story-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.story-content img,
.story-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.story-controls {
  position: absolute;
  inset: 0;
  display: flex;
  z-index: 10000;
}

.story-tap-left,
.story-tap-right {
  flex: 1;
  cursor: pointer;
}

.story-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 100%);
}

.story-reply {
  width: 100%;
  padding: 14px;
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 24px;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.story-reply:hover {
  background: rgba(255,255,255,0.15);
}

/* =========================
   REELS PREVIEW (en feed)
   ========================= */
.reel-preview {
  margin-bottom: 20px;
}

.reel-media {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 600px;
  margin: 12px 0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
}

.reel-thumbnail {
  width: 100%;
  height: 100%;
  position: relative;
}

.reel-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.3);
  transition: background 0.2s;
}

.reel-media:hover .play-overlay {
  background: rgba(0,0,0,0.5);
}

.play-button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #000;
  transition: transform 0.2s;
}

.reel-media:hover .play-button {
  transform: scale(1.1);
}

.duration-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}
/* =========================
   BOTÓN TOGGLE FEED/REELS (arriba derecha)
   ========================= */
.toggle-feed-reels {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: all 0.3s ease;
}

.toggle-feed-reels:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.toggle-feed-reels:active {
  transform: translateY(0);
}

.toggle-feed-reels.active {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.toggle-feed-reels.hidden {
  display: none;
}

/* Ajustar para que no tape el contenido */
#homeScreen {
  padding-top: 0;
}

/* =========================
   REELS FULLSCREEN MODE
   ========================= */
.reels-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
}

.reels-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0) 100%);
}

.reels-title {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.reels-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.reels-close:hover {
  background: rgba(255,255,255,0.2);
}

.reels-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.reel-item {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.reel-video-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reel-video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

.reel-info {
  position: absolute;
  bottom: 100px;
  left: 20px;
  right: 20px;
  z-index: 10001;
  color: #fff;
}

.reel-author {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  cursor: pointer;
}

.reel-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  background: #333;
}

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

.reel-avatar .avatar-text {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.reel-author-name {
  font-weight: 600;
  font-size: 14px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.reel-caption {
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.reel-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hashtag {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.9;
}

.reel-actions {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

.reel-action {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: #fff;
}

.reel-action:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

.reel-action.liked {
  background: rgba(255,59,92,0.2);
  border-color: #ff3b5c;
}

.reel-action .icon {
  font-size: 24px;
  line-height: 1;
}

.reel-action .count {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
}

.reels-swipe-hint {
  position: absolute;
  bottom: 140px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  opacity: 0.5;
  pointer-events: none;
  animation: fadeInOut 3s ease-in-out infinite;
}

@keyframes fadeInOut {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.5; }
}

.swipe-up {
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* =========================
   RESPONSIVE
   ========================= */
@media (min-width: 768px) {
  .story-viewer,
  .reels-fullscreen {
    max-width: 500px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
  }
}

/**********************************
 * ESTILOS METÁLICOS - STORIES & REELS
 **********************************/

/* Story rings metálicos */
.story-ring {
  background: linear-gradient(145deg, #5ab0ff, #2979ff) !important;
  box-shadow: 0 4px 12px rgba(41,121,255,0.3), inset 0 1px 0 rgba(255,255,255,0.3) !important;
}

.story-ring.viewed {
  background: linear-gradient(145deg, #e0e0e0, #c0c0c0) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.5) !important;
}

/* Story avatar container metálico */
.story-avatar-container, .reel-avatar-container {
  background: linear-gradient(145deg, #ffffff, #f0f0f0) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* Story viewer metálico */
.story-viewer, .reel-viewer {
  background: linear-gradient(145deg, #2a2a2a, #1e1e1e) !important;
}

/* Story controls metálicos */
.story-controls, .reel-controls {
  background: linear-gradient(180deg, rgba(0,0,0,0.8), transparent) !important;
}

/* Story progress bar metálico */
.story-progress-bar {
  background: linear-gradient(145deg, #ffffff, #e0e0e0) !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.5) !important;
}

.story-progress-bar-fill {
  background: linear-gradient(145deg, #5ab0ff, #2979ff) !important;
  box-shadow: 0 0 8px rgba(41,121,255,0.6) !important;
}

/* Story creation button metálico */
.create-story-btn, .create-reel-btn {
  background: linear-gradient(145deg, #5ab0ff, #2979ff) !important;
  box-shadow: 0 4px 12px rgba(41,121,255,0.3), inset 0 1px 0 rgba(255,255,255,0.5) !important;
}

.create-story-btn:hover, .create-reel-btn:hover {
  box-shadow: 0 6px 16px rgba(41,121,255,0.4), inset 0 1px 0 rgba(255,255,255,0.6) !important;
}

/* Stories list container metálico */
.stories-container, .reels-container {
  background: linear-gradient(145deg, #f8f8f8, #e8e8e8) !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1) !important;
}

/* Story card metálica */
.story-card, .reel-card {
  background: linear-gradient(145deg, #ffffff, #f0f0f0) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,1) !important;
}

.story-card:hover, .reel-card:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.15), inset 0 2px 4px rgba(255,255,255,1) !important;
  transform: translateY(-2px);
}
