/* ============================================================================
   STORIES - ESTILO FACEBOOK/WHATSAPP - WEBCONVERSOR
   ============================================================================ */

/* Wrapper com largura limitada (desktop) - EXATAMENTE IGUAL AO CONTAINER DE PESQUISA */
.wc-stories-wrapper {
    position: relative;
    width: 90%;
    max-width: 600px;
    margin-top: 20px;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
    box-sizing: border-box;
    overflow: visible; /* NÃO corta a seta de navegação */
}

/* Fade nas bordas do container de stories */
.wc-stories-wrapper::before,
.wc-stories-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 25px;
    z-index: 5;
    pointer-events: none;
}

.wc-stories-wrapper::before {
    left: 0;
    background: linear-gradient(to right, #1B1B1B 0%, rgba(27,27,27,0) 100%);
    opacity: 0; /* Começa invisível */
    transition: opacity 0.3s ease;
}

/* Fade esquerdo só aparece quando scrollar */
.wc-stories-wrapper.scrolled::before {
    opacity: 1;
}

.wc-stories-wrapper::after {
    right: 0;
    background: linear-gradient(to left, #1B1B1B 0%, rgba(27,27,27,0) 100%);
    transition: opacity 0.3s ease;
}

/* Fade direito some quando chegar no final */
.wc-stories-wrapper.scroll-end::after {
    opacity: 0;
}

/* SEM FADE - stories aparecem normalmente com scroll horizontal */

/* Container geral dos stories (círculos no topo) */
.wc-stories-container {
    display: flex;
    gap: 12px;
    padding: 12px 0; /* Sem padding lateral - wrapper já controla a largura */
    margin-bottom: 0; /* SEM espaço embaixo */
    overflow-x: auto;
    overflow-y: visible; /* Permite que a seta apareça acima/abaixo */
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    justify-content: flex-start;
}
.wc-stories-container::-webkit-scrollbar {
    display: none;
}

/* Telas menores: STORIES VÃO ATÉ A BORDA - só a tela corta, não o container */
@media (max-width: 768px) {
    .wc-stories-wrapper {
        width: 100vw !important;
        max-width: none !important;
        margin-left: calc(-50vw + 50%) !important; /* Centraliza no viewport */
        margin-right: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
    
    .wc-stories-container {
        padding: 12px 16px !important; /* Padding dentro do container */
        overflow-x: auto !important;
        overflow-y: visible !important;
    }
}

/* Botões de navegação (só em desktop) */
.wc-stories-nav-btn {
    position: absolute;
    top: 54.5px; /* 12px (padding-top do container) + 42.5px (metade do anel 85px) */
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    z-index: 10;
    /* Animação de entrada */
    opacity: 0;
    animation: wc-nav-btn-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s forwards;
}

.wc-stories-nav-btn:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.wc-stories-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.wc-stories-nav-prev {
    left: -20px;
}

.wc-stories-nav-next {
    right: -20px;
}

/* Animação de entrada dos botões de navegação */
@keyframes wc-nav-btn-enter {
    0% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
    60% {
        opacity: 1;
        transform: translateY(-50%) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Tablets */
@media (max-width: 1024px) {
    .wc-stories-wrapper {
        margin-top: 20px;
        width: 90%; /* Mantém mesma largura do container */
    }

    /* Esconde botões de navegação em tablets */
    .wc-stories-nav-btn {
        display: none !important;
    }

    .wc-stories-container {
        justify-content: flex-start;
        padding: 12px 0; /* Sem padding lateral */
    }
}

/* Celulares */
@media (max-width: 600px) {
    .wc-stories-wrapper {
        margin-top: 15px;
        width: 90%; /* Mantém mesma largura do container */
    }

    .wc-stories-container {
        justify-content: flex-start;
        margin-bottom: 0;
        padding: 12px 0; /* Sem padding lateral */
    }

    /* Esconde botões de navegação em celulares */
    .wc-stories-nav-btn {
        display: none !important;
    }
}

/* Cada item de story (círculo) */
.wc-story-item {
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease;
    /* Animação de entrada escalonada */
    opacity: 0;
    transform: translateX(50px);
    animation: wc-story-item-enter 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Delay escalonado para cada item - efeito cascata */
.wc-story-item:nth-child(1) { animation-delay: 0.1s; }
.wc-story-item:nth-child(2) { animation-delay: 0.2s; }
.wc-story-item:nth-child(3) { animation-delay: 0.3s; }
.wc-story-item:nth-child(4) { animation-delay: 0.4s; }
.wc-story-item:nth-child(5) { animation-delay: 0.5s; }
.wc-story-item:nth-child(6) { animation-delay: 0.6s; }
.wc-story-item:nth-child(7) { animation-delay: 0.7s; }
.wc-story-item:nth-child(8) { animation-delay: 0.8s; }
.wc-story-item:nth-child(9) { animation-delay: 0.9s; }
.wc-story-item:nth-child(10) { animation-delay: 1.0s; }

@keyframes wc-story-item-enter {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.wc-story-item:hover {
    transform: scale(1.08);
}
.wc-story-item:active {
    transform: scale(0.95);
}

/* Anel do story (gradiente animado) */
.wc-story-ring {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #f05, #ff6b6b, #ffc107, #f05);
    background-size: 300% 300%;
    animation: wc-story-gradient 3s ease infinite;
    position: relative;
}

/* FORÇA a animação em todos os anéis não visualizados */
.wc-story-ring:not(.viewed) {
    animation: wc-story-gradient 4s ease-in-out infinite !important;
    background-size: 300% 300% !important;
}

.wc-story-ring.viewed {
    background: rgba(255,255,255,0.25);
    animation: none;
    background-size: 100% 100%;
}

@keyframes wc-story-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Imagem/capa dentro do anel */
.wc-story-thumb {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #1a1a1a;
    background: #1a1a1a;
}

/* Badge de ícone (Spotify ou YouTube) */
.wc-story-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
    border: 2px solid #1a1a1a;
}
.wc-story-badge.spotify {
    background: #1DB954;
}
.wc-story-badge.youtube {
    background: #FF0000;
}

/* Nome/título abaixo do círculo */
.wc-story-name {
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    text-align: center;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

/* Data de adição abaixo do nome */
.wc-story-date {
    font-size: 9px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    max-width: 90px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 400;
    margin-top: -2px;
}

/* ============================================================================
   MODAL FULLSCREEN DO STORY (quando abre)
   ============================================================================ */
.wc-story-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 100000;
    display: none;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.3s ease;
    overflow: visible; /* PERMITE que a seta apareça */
    /* 🚫 DESABILITA PULL-TO-REFRESH (arrastar de cima pra baixo não atualiza página) */
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.wc-story-modal.active {
    display: flex;
    opacity: 1;
}

/* Container do conteúdo do story */
.wc-story-content {
    flex: 1;
    position: relative;
    overflow: visible; /* Permite que a seta apareça fora do container */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animação de peek no conteúdo */
/* Mobile: arrasta para CIMA */
@media (max-width: 768px) {
    .wc-story-content.show-peek {
        animation: wc-content-peek-mobile 2.5s ease-in-out 1.2s 1 forwards;
    }

    @keyframes wc-content-peek-mobile {
        0% { transform: translateY(0); }
        20% { transform: translateY(-50px); }
        40% { transform: translateY(-50px); }
        60% { transform: translateY(0); }
        100% { transform: translateY(0); }
    }
}

/* Desktop: arrasta para ESQUERDA */
@media (min-width: 769px) {
    .wc-story-content.show-peek {
        animation: wc-content-peek-desktop 2.5s ease-in-out 1.2s 1 forwards;
    }

    @keyframes wc-content-peek-desktop {
        0% { transform: translateX(0); }
        20% { transform: translateX(-50px); }
        40% { transform: translateX(-50px); }
        60% { transform: translateX(0); }
        100% { transform: translateX(0); }
    }
}

/* Fundo embaçado (capa ou frame do vídeo) */
.wc-story-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(30px) brightness(0.4);
    transform: scale(1.2);
    z-index: 1;
}

/* Vídeo de fundo (YouTube) */
.wc-story-video-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    transform: translate(-50%, -50%) scale(1.2);
    filter: blur(15px) brightness(0.5);
    z-index: 1;
    object-fit: cover;
}

/* Overlay escuro sobre o vídeo - SUTIL para destacar botões */
.wc-story-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 15;
    pointer-events: none;
}

/* Conteúdo principal (capa grande no centro) */
.wc-story-main {
    position: relative;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    max-width: 400px;
    width: 100%;
    /* Transições suaves entre stories */
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Estado de transição - saindo */
.wc-story-main.transitioning-out {
    opacity: 0;
    transform: translateY(20px);
}

/* Estado de transição - entrando */
.wc-story-main.transitioning-in {
    opacity: 0;
    transform: translateY(-20px);
}

/* Capa da música - TRANSIÇÃO GAMER */
.wc-story-cover {
    width: 130px;
    height: 130px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.1);
    opacity: 0;
    transform: scale(0.7) rotate(-5deg);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: blur(8px);
}

.wc-story-cover.loaded {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    filter: blur(0px);
}

.wc-story-cover:hover {
    transform: scale(1.02);
}

/* Info da música - TRANSIÇÃO GAMER */
.wc-story-info {
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.08s;
    filter: blur(5px);
}

.wc-story-info.loaded {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0px);
}

.wc-story-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
    line-height: 1.3;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}
.wc-story-artist {
    font-size: 14px;
    opacity: 0.7;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* Botão de baixar - TRANSIÇÃO GAMER */
.wc-story-download-btn {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.5px;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.15s;
    filter: blur(4px);
}

.wc-story-download-btn.loaded {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0px);
}
.wc-story-download-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.35);
    transform: translateY(-2px);
}
.wc-story-download-btn:active {
    transform: scale(0.97);
    background: rgba(255,255,255,0.25);
}
.wc-story-download-btn i {
    font-size: 16px;
    opacity: 0.9;
}

/* Barra de progresso no topo */
.wc-story-progress-container {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 100;
}
.wc-story-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}
.wc-story-progress-bar .fill {
    width: 0%;
    height: 100%;
    background: #fff;
    border-radius: 2px;
    transition: width 0.1s linear;
}
.wc-story-progress-bar.active .fill {
    animation: wc-story-progress 50s linear forwards;
}
.wc-story-progress-bar.completed .fill {
    width: 100%;
}

@keyframes wc-story-progress {
    from { width: 0%; }
    to { width: 100%; }
}

/* Botão de fechar */
.wc-story-close {
    position: absolute;
    top: 30px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.wc-story-close:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.1);
}

/* Botão de volume (mute/unmute) */
.wc-story-volume {
    position: absolute;
    top: 30px;
    right: 70px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.wc-story-volume:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0,0,0,0.4);
}
.wc-story-volume:active {
    transform: scale(0.95);
}
.wc-story-volume.muted {
    background: rgba(255,50,50,0.25);
    border-color: rgba(255,100,100,0.4);
}
.wc-story-volume.muted:hover {
    background: rgba(255,50,50,0.35);
}

/* Hint de swipe - arrasta conteúdo mostrando preview */
.wc-story-swipe-hint {
    position: fixed !important;
    bottom: 80px !important;
    left: 50% !important;
    transform: translateX(-50%) translateY(80px); /* Começa FORA da tela */
    z-index: 100050 !important;
    display: none !important;
    align-items: center;
    gap: 10px;
    pointer-events: none;
    opacity: 0; /* INVISÍVEL antes da animação */
    /* ESTILO IGUAL AOS OUTROS BOTÕES DO STORY */
    background: rgba(255,255,255,0.12) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    color: #fff !important;
    border: 1px solid rgba(255,255,255,0.2) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5) !important;
    animation: wc-hint-slide 3s ease-in-out forwards;
    white-space: nowrap;
    padding: 14px 24px !important;
    border-radius: 50px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

.wc-story-swipe-hint[style*="display: flex"] {
    display: flex !important; /* FORÇA aparecer quando JS seta display flex */
}

.wc-story-swipe-hint .swipe-icon {
    font-size: 26px !important;
    color: #fff !important;
}

/* Desktop - garantir que apareça */
@media (min-width: 769px) {
    .wc-story-swipe-hint[style*="display: flex"] {
        display: flex !important;
        visibility: visible !important;
    }

    .wc-story-swipe-hint {
        bottom: 80px !important;
        font-size: 17px !important;
        padding: 14px 26px !important;
    }

    .wc-story-swipe-hint .swipe-icon {
        font-size: 28px !important;
    }
}

/* Tablets e mobile */
@media (max-width: 768px) {
    .wc-story-swipe-hint {
        bottom: 70px !important;
        font-size: 15px !important;
        padding: 10px 18px !important;
    }

    .wc-story-swipe-hint .swipe-icon {
        font-size: 22px !important;
    }
}

@media (max-width: 480px) {
    .wc-story-swipe-hint {
        bottom: 60px !important;
        font-size: 14px !important;
        padding: 8px 16px !important;
    }

    .wc-story-swipe-hint .swipe-icon {
        font-size: 20px !important;
    }
}

/* Animação do hint - 3s SIMPLES: entra, fica, sai */
@keyframes wc-hint-slide {
    /* ENTRADA: 0s a 0.5s (0% a 17%) */
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(80px);
    }
    17% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    /* PARADO: 0.5s a 2s (17% a 67%) */
    67% {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    /* SAÍDA: 2s a 3s (67% a 100%) */
    100% {
        opacity: 0;
        transform: translateX(-50%) translateY(80px);
    }
}

/* Áreas de navegação touch */
.wc-story-nav {
    position: absolute;
    top: 60px;
    bottom: 0;
    width: 30%;
    z-index: 50;
    cursor: pointer;
}
.wc-story-nav.prev {
    left: 0;
}
.wc-story-nav.next {
    right: 0;
}

/* Player de áudio (invisível) */
.wc-story-audio {
    display: none;
}

/* Indicador de carregando - TELA CHEIA */
.wc-story-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 300;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #0a0a0a 100%);
}

/* Ícone grande pulsante */
.wc-loading-icon {
    width: 120px;
    height: 120px;
    background: rgba(255,0,85,0.2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: wc-icon-pulse 1.5s ease-in-out infinite;
    border: 3px solid rgba(255,0,85,0.5);
}
.wc-loading-icon i {
    font-size: 50px;
    color: #fff;
}

@keyframes wc-icon-pulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255,0,85,0.4);
    }
    50% { 
        transform: scale(1.15);
        box-shadow: 0 0 60px rgba(255,0,85,0.7);
    }
}

/* Texto "Carregando vídeo..." */
.wc-loading-text {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 0 2px 15px rgba(0,0,0,0.8);
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* Dots animados */
.wc-loading-dots {
    display: flex;
    gap: 8px;
}
.wc-loading-dots span {
    width: 10px;
    height: 10px;
    background: #fff;
    border-radius: 50%;
    animation: wc-dots-bounce 1.4s ease-in-out infinite both;
}
.wc-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}
.wc-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}
.wc-loading-dots span:nth-child(3) {
    animation-delay: 0s;
}

@keyframes wc-dots-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .wc-story-cover {
        width: 110px;
        height: 110px;
        border-radius: 14px;
    }
    .wc-story-title {
        font-size: 16px;
    }
    .wc-story-artist {
        font-size: 13px;
    }
    .wc-story-download-btn {
        padding: 12px 24px;
        font-size: 13px;
        border-radius: 10px;
    }
    .wc-story-ring {
        width: 75px;
        height: 75px;
    }
    .wc-story-main {
        gap: 16px;
    }
}
