/* ===== Story Viewer Modal ===== */
.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.story-viewer.active {
  display: flex;
}

.story-viewer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  cursor: pointer;
}

.story-viewer-content {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 750px;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Story Progress Bar */
.story-progress-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  padding: 12px 12px 8px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4) 0%, transparent 100%);
}

.story-progress-bar {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
  overflow: hidden;
}

.story-progress-fill {
  height: 100%;
  width: 0%;
  background: white;
  border-radius: 2px;
  transition: width 0.1s linear;
}

.story-progress-bar.completed .story-progress-fill {
  width: 100%;
}

.story-progress-bar.active .story-progress-fill {
  transition: width 0.1s linear;
}

/* Story Header */
.story-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 12px 12px;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, transparent 100%);
}

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

.story-profile-pic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
}

.story-username {
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.story-time {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  margin-left: 4px;
}

.story-close-btn {
  padding: 8px;
  color: white;
  transition: transform var(--transition-fast);
}

.story-close-btn:hover {
  transform: scale(1.1);
}

.story-close-btn svg {
  width: 24px;
  height: 24px;
}

/* Story Content */
.story-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

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

.story-content .story-text-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  width: 100%;
  height: 100%;
  text-align: center;
}

.story-content .story-text-content p {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.6;
  white-space: pre-line;
  max-width: 80%;
}

/* Story Text Overlay */
.story-text-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 60px 20px 40px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.story-text-overlay p {
  color: white;
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Story Navigation */
.story-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all var(--transition-fast);
  opacity: 0;
  z-index: 10;
}

.story-viewer-content:hover .story-nav {
  opacity: 1;
}

.story-nav:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-50%) scale(1.1);
}

.story-nav.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.story-prev {
  left: 12px;
}

.story-next {
  right: 12px;
}

.story-nav svg {
  width: 20px;
  height: 20px;
}

/* Touch/click areas for navigation */
.story-touch-area {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 30%;
  z-index: 5;
  cursor: pointer;
}

.story-touch-prev {
  left: 0;
}

.story-touch-next {
  right: 0;
}

/* Pause indicator */
.story-paused-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  padding: 16px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.story-paused-indicator.visible {
  opacity: 1;
}

.story-paused-indicator svg {
  width: 32px;
  height: 32px;
  color: white;
}

/* Story Loading State */
.story-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}

.story-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: white;
}

/* Mobile Adjustments */
@media (max-width: 735px) {
  .story-viewer-content {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  
  .story-nav {
    opacity: 0 !important;
  }
  
  .story-touch-area {
    width: 40%;
  }
  
  .story-content .story-text-content p {
    font-size: 1.25rem;
    max-width: 90%;
  }
}

/* Animation for story entrance */
@keyframes storySlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.story-viewer.active .story-viewer-content {
  animation: storySlideIn 0.2s ease-out;
}
