/* ==========================================================================
   Story Viewer — Fullscreen 24h Stories with Reactions & Pause
   ========================================================================== */

/* --- Story Viewer Modal --- */
.story-viewer-dialog {
    max-width: 420px;
    height: 92vh;
    background: #000;
    padding: 0 !important;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

/* --- Progress Bars --- */
.story-viewer-progress {
    position: absolute;
    top: 12px;
    left: 14px;
    right: 14px;
    display: flex;
    gap: 4px;
    z-index: 30;
}

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

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

.story-viewer-progress-fill.active {
    animation: storyProgressFill 5s linear forwards;
}

.story-viewer-progress-fill.watched {
    width: 100%;
    background: rgba(255, 255, 255, 0.6);
}

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

/* --- Author Header --- */
.story-viewer-header {
    position: absolute;
    top: 24px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 30;
    color: #FFF;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
    padding-bottom: 16px;
}

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

.story-viewer-author-avatar {
    border: 2px solid var(--primary) !important;
}

.story-viewer-author-name {
    font-weight: 700;
    font-size: 13px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.story-viewer-time {
    font-size: 11px;
    opacity: 0.85;
}

.story-viewer-close-btn {
    color: #FFF;
    font-size: 22px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: background var(--motion-fast);
}

.story-viewer-close-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* --- Media Display --- */
.story-viewer-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    background: #000;
}

.story-viewer-media img,
.story-viewer-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Loading State --- */
.story-viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 25;
    background: rgba(0, 0, 0, 0.4);
    transition: opacity 0.3s ease;
}

.story-viewer-loading.hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- Pause Indicator --- */
.story-viewer-pause-indicator {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 28;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.story-viewer-pause-indicator.show {
    opacity: 1;
}

.story-viewer-pause-icon {
    font-size: 48px;
    color: #FFF;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

/* --- Footer / Reaction Bar --- */
.story-viewer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    padding: 30px 16px 18px 16px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-viewer-caption {
    color: #FFF;
    font-size: 14px;
    text-align: center;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.story-viewer-reactions {
    display: flex;
    justify-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: var(--radius-full);
}

.story-viewer-reactions .emoji-pill {
    font-size: 20px;
}

/* --- Navigation Zones --- */
.story-viewer-nav-prev {
    position: absolute;
    top: 60px;
    bottom: 100px;
    left: 0;
    width: 35%;
    z-index: 20;
    cursor: pointer;
}

.story-viewer-nav-next {
    position: absolute;
    top: 60px;
    bottom: 100px;
    right: 0;
    width: 65%;
    z-index: 20;
    cursor: pointer;
}

/* --- Story Ring Watched State --- */
.story-ring-watched {
    padding: 2.5px;
    background: var(--border-color);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--motion-fast);
}

.story-ring-watched:hover {
    transform: scale(1.05);
}

.story-ring-watched .avatar {
    border: 2px solid var(--surface-1);
}

/* --- Mobile Adaptation --- */
@media (max-width: 767px) {
    .story-viewer-dialog {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .story-viewer-nav-prev {
        top: 80px;
        bottom: 120px;
    }

    .story-viewer-nav-next {
        top: 80px;
        bottom: 120px;
    }
}