/* =============================================
   Stories System - Design Redesenhado Vaibes
   ============================================= */

:root {
  --story-primary: #00636d;
  --story-secondary: #004953;
  --story-accent: #00a8b8;
  --story-gradient: linear-gradient(135deg, #004953 0%, #00636d 50%, #007a89 100%);
  --story-dark: #0d1117;
  --story-light: #ffffff;
  --story-radius: 16px;
  --story-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================
   Carrossel de Stories
   ============================================= */
.stories-desktop {
  display: flex;
  gap: 16px;
  padding: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: linear-gradient(180deg, rgba(0, 99, 109, 0.05) 0%, transparent 100%);
  border-radius: var(--story-radius);
  margin-bottom: 20px;
}

.stories-desktop::-webkit-scrollbar {
  display: none;
}

@media (min-width: 769px) {
  .stories-desktop {
    position: sticky;
    top: 80px;
    z-index: 40;
    backdrop-filter: blur(10px);
  }
}

/* =============================================
   Story Cards - NOVO DESIGN
   ============================================= */
.story-card {
  position: relative;
  min-width: 110px;
  width: 110px;
  cursor: pointer;
  transition: var(--story-transition);
  flex-shrink: 0;
}

.story-card:hover {
  transform: translateY(-4px);
}

/* Anel do Story */
.story-ring {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  padding: 3px;
  background: var(--story-gradient);
  box-shadow: 0 4px 12px rgba(0, 99, 109, 0.3);
  transition: var(--story-transition);
}

.story-ring.multiple {
  background: linear-gradient(135deg, 
    #00636d 0%, 
    #00a8b8 25%, 
    #00636d 50%, 
    #00a8b8 75%, 
    #00636d 100%);
  animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.story-card:hover .story-ring {
  box-shadow: 0 8px 24px rgba(0, 99, 109, 0.5);
  transform: scale(1.05);
}

/* Avatar */
.story-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--story-dark);
  transition: var(--story-transition);
}

.story-card:hover .story-avatar {
  border-color: var(--story-light);
}

/* Username */
.story-username {
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--story-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

/* Badge de Contagem */
.story-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--story-accent);
  color: white;
  font-size: 11px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 2px solid var(--story-dark);
}

/* =============================================
   Story Create Card
   ============================================= */
.story-create {
  position: relative;
}

.story-create .story-ring {
  background: linear-gradient(135deg, rgba(0, 99, 109, 0.2) 0%, rgba(0, 99, 109, 0.1) 100%);
  border: 2px dashed var(--story-primary);
}

.story-create:hover .story-ring {
  background: var(--story-gradient);
  border-style: solid;
}

.story-create-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.story-create-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--story-gradient);
  color: white;
  font-size: 28px;
  font-weight: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 99, 109, 0.4);
}

.story-create-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--story-primary);
}

/* =============================================
   Editor Modal - REDESENHADO
   ============================================= */
.story-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.story-editor-modal.active {
  opacity: 1;
}

.story-editor-container {
  width: 100%;
  max-width: 500px;
  max-height: 95vh;
  background: var(--story-dark);
  border-radius: var(--story-radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.editor-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.story-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: linear-gradient(135deg, var(--story-secondary) 0%, var(--story-primary) 100%);
  color: white;
  flex-shrink: 0;
}

.story-editor-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.story-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--story-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* =============================================
   Câmera Preview - ASPECT RATIO CORRETO
   ============================================= */
.camera-preview-wrapper {
  position: relative;
  background: #000;
  width: 100%;
  min-height: 500px;
  height: 70vh;
  max-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
/* =============================================
   CSS CRÍTICO PARA STORY VIEWER - CORREÇÃO URGENTE
   ============================================= */

#groupStoryViewer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.95) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  opacity: 0;
  transition: opacity 0.3s ease !important;
}

#groupStoryViewer.active {
  display: flex !important;
  opacity: 1 !important;
}

.story-viewer-container {
  position: relative !important;
  width: 100% !important;
  max-width: 500px !important;
  height: 95vh !important;
  background: #000 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

.story-viewer-content {
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000 !important;
}

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

/* Header visível */
.story-viewer-header {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px !important;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%) !important;
  z-index: 100 !important;
  color: white !important;
}

.story-viewer-user {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  color: white !important;
}

.story-viewer-avatar {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  border: 2px solid white !important;
  object-fit: cover !important;
}

.story-viewer-username {
  color: white !important;
  font-weight: 700 !important;
  font-size: 15px !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5) !important;
}

.story-viewer-close {
  background: rgba(255, 255, 255, 0.2) !important;
  border: none !important;
  color: white !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Progress bars */
.story-viewer-progress {
  position: absolute !important;
  top: 64px !important;
  left: 16px !important;
  right: 16px !important;
  display: flex !important;
  gap: 4px !important;
  z-index: 100 !important;
}

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

.progress-segment::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  height: 100% !important;
  width: 0% !important;
  background: white !important;
  border-radius: 2px !important;
  transition: width linear !important;
}

/* Navegação */
.story-viewer-nav {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  display: flex !important;
  z-index: 50 !important;
}

.story-nav-prev,
.story-nav-next {
  flex: 1 !important;
  cursor: pointer !important;
}
/* =============================================
   CSS CRÍTICO - ANIMAÇÕES DE FECHAMENTO
   ============================================= */

.story-viewer {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(0, 0, 0, 0.95) !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 10000 !important;
  opacity: 0;
  transition: opacity 0.3s ease !important;
}

.story-viewer.active {
  display: flex !important;
  opacity: 1 !important;
}

.story-viewer-container {
  position: relative !important;
  width: 100% !important;
  max-width: 500px !important;
  height: 95vh !important;
  background: #000 !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
  transform: scale(0.9);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.story-viewer.active .story-viewer-container {
  transform: scale(1) !important;
  opacity: 1 !important;
}

/* Botão de fechar com hover */
.story-viewer-close {
  background: rgba(255, 255, 255, 0.2) !important;
  border: none !important;
  color: white !important;
  width: 36px !important;
  height: 36px !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.2s ease !important;
}

.story-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3) !important;
  transform: rotate(90deg) scale(1.1) !important;
}

/* Garantir que o botão seja clicável */
.story-viewer-close svg {
  pointer-events: none !important;
}

.camera-preview {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ✅ FORÇAR ASPECT RATIO 9:16 */
.camera-preview video,
.camera-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain; /* ✅ MUDADO DE COVER PARA CONTAIN */
  display: block;
}

#cameraVideo {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important; /* ✅ EVITA CORTE */
  display: block !important;
  background: #000;
}

/* ✅ PREVIEW DE MÍDIA - ASPECT RATIO CORRETO */
.media-preview-wrapper {
  position: relative;
  background: #000;
  width: 100%;
  min-height: 500px;
  height: 70vh;
  max-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* ✅ MANTÉM ASPECT RATIO COMPLETO */
  display: block;
}

/* ✅ MOBILE - TELA CHEIA SEM CORTES */
@media (max-width: 768px) {
  .camera-preview-wrapper,
  .media-preview-wrapper {
    height: 100%;
    max-height: none;
    min-height: auto;
  }
  
  #cameraVideo,
  .media-preview img,
  .media-preview video {
    width: auto !important;
    height: 100% !important;
    max-width: 100%;
    object-fit: contain !important;
  }
}

/* =============================================
   Controles da Câmera
   ============================================= */
.camera-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 10;
}

.camera-btn {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--story-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

/* Botão de Captura */
.camera-btn-capture {
  width: 72px;
  height: 72px;
  padding: 6px;
}

.capture-ring {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  transition: var(--story-transition);
}

.camera-btn-capture:active .capture-ring {
  transform: scale(0.85);
}

/* Botão de Gravação */
.camera-btn-record {
  width: 72px;
  height: 72px;
}

.record-icon {
  width: 24px;
  height: 24px;
  background: #ff3b30;
  border-radius: 4px;
  transition: var(--story-transition);
}

.camera-btn-record.recording .record-icon {
  border-radius: 2px;
  animation: recordPulse 1.5s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Indicador de Gravação */
.recording-indicator {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(255, 59, 48, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  z-index: 100;
}

.recording-dot {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
  animation: blink 1s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* =============================================
   Preview de Mídia - CORRIGIDO
   ============================================= */
.media-preview-wrapper {
  position: relative;
  background: #000;
  width: 100%;
  min-height: 500px;
  height: 70vh;
  max-height: 700px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview {
  position: relative;
  width: 100%;
  height: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.media-preview img,
.media-preview video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.preview-controls {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 10;
  padding: 0 20px;
}

.preview-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 24px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--story-transition);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  justify-content: center;
}

.preview-btn-retake {
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.preview-btn-retake:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.preview-btn-proceed {
  background: var(--story-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 99, 109, 0.4);
}

.preview-btn-proceed:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 99, 109, 0.6);
}

/* =============================================
   Formulário do Editor
   ============================================= */
.story-editor-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.story-text-input-wrapper {
  position: relative;
}

#storyTextInput {
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: var(--story-transition);
}

#storyTextInput::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

#storyTextInput:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--story-accent);
}

.char-count {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

/* Menções */
.mention-suggestions {
  background: rgba(0, 0, 0, 0.9);
  border-radius: 12px;
  overflow: hidden;
  max-height: 200px;
  overflow-y: auto;
}

.mention-suggestions:empty {
  display: none;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--story-transition);
  color: white;
}

.mention-item:hover {
  background: var(--story-primary);
}

.mention-item img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

/* Seletor de Duração */
.story-duration-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.story-duration-selector label {
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.duration-options {
  display: flex;
  gap: 10px;
}

.duration-option {
  flex: 1;
  padding: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid transparent;
  border-radius: 10px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: var(--story-transition);
}

.duration-option:hover {
  background: rgba(255, 255, 255, 0.15);
}

.duration-option.active {
  background: var(--story-gradient);
  border-color: var(--story-accent);
}

/* Progresso de Upload */
#uploadProgress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--story-gradient);
  border-radius: 3px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-text {
  color: white;
  font-size: 13px;
  text-align: center;
}

/* Botão Publicar */
.story-publish-btn {
  padding: 14px;
  background: var(--story-gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--story-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.story-publish-btn:hover:not(:disabled) {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(0, 99, 109, 0.4);
}

.story-publish-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =============================================
   Viewer de Stories - COM ANIMAÇÕES
   ============================================= */
.story-viewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: background 0.3s ease;
}

.story-viewer.active {
  background: rgba(0, 0, 0, 0.95);
}

.story-viewer-container {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 95vh;
  background: #000;
  border-radius: var(--story-radius);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.8);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-viewer.active .story-viewer-container {
  transform: scale(1);
  opacity: 1;
}

/* Animação de navegação entre stories */
.story-viewer-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  position: relative;
}

.story-viewer-content.slide-left {
  animation: slideLeft 0.3s ease-out;
}

.story-viewer-content.slide-right {
  animation: slideRight 0.3s ease-out;
}

@keyframes slideLeft {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideRight {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

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

.story-viewer-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
  z-index: 100;
  animation: fadeInDown 0.4s ease-out;
}

@keyframes fadeInDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.story-viewer-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid white;
  object-fit: cover;
}

.story-viewer-username {
  color: white;
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.story-viewer-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--story-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-viewer-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

/* Progress Bars - CORRIGIDO */
.story-viewer-progress {
  position: absolute;
  top: 64px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  z-index: 100;
  animation: fadeInDown 0.4s ease-out 0.1s backwards;
}

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

.progress-segment::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: white;
  border-radius: 2px;
  transition: width linear;
}

.progress-segment.active::after {
  animation: progressFill var(--progress-duration, 5s) linear forwards;
}

.progress-segment.completed::after {
  width: 100%;
  transition: none;
}

@keyframes progressFill {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

/* Navegação */
.story-viewer-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  z-index: 50;
  pointer-events: none;
}

.story-nav-prev,
.story-nav-next {
  flex: 1;
  pointer-events: all;
  cursor: pointer;
  position: relative;
}

.story-nav-prev {
  cursor: w-resize;
}

.story-nav-next {
  cursor: e-resize;
}

/* Feedback visual ao clicar */
.story-nav-prev:active::before,
.story-nav-next:active::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

/* =============================================
   Notificações
   ============================================= */
.story-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  z-index: 10001;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-toast.show {
  opacity: 1;
  transform: translateX(0);
}

.story-toast-error {
  background: linear-gradient(135deg, #d32f2f, #f44336);
}

.story-toast-success {
  background: linear-gradient(135deg, #388e3c, #4caf50);
}

/* =============================================
   Responsivo
   ============================================= */
@media (max-width: 768px) {
  .stories-desktop {
    padding: 16px;
    gap: 12px;
  }
  
  .story-card {
    min-width: 90px;
    width: 90px;
  }
  
  .story-ring {
    width: 90px;
    height: 90px;
  }
  
  .story-username {
    font-size: 11px;
    max-width: 90px;
  }
  
  .story-viewer-container,
  .story-editor-container {
    width: 100%;
    height: 100vh;
    max-height: none;
    border-radius: 0;
  }
  
  .camera-preview-wrapper,
  .media-preview-wrapper {
    height: 100%;
    max-height: none;
    min-height: auto;
  }
  
  .story-toast {
    right: 10px;
    left: 10px;
    width: auto;
  }
  
  .preview-controls {
    flex-direction: column;
    gap: 10px;
  }
  
  .preview-btn {
    width: 80%;
    justify-content: center;
  }
}