/* Story Viewer Modal Styles */

.story-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.story-viewer-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
}

/* Close Button */
.story-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

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

.story-viewer-close svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
}

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

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

.story-progress-fill {
    height: 100%;
    background: #fff;
    width: 0%;
    transition: width 0.1s linear;
}

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

.story-progress-bar.active .story-progress-fill {
    animation: progressFill var(--duration) linear forwards;
}

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

/* Story Header */
.story-header {
    position: absolute;
    top: 24px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
    padding: 8px;
}

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

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

.story-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.story-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Story Actions */
.story-actions {
    display: flex;
    gap: 8px;
}

.story-action-btn {
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

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

.story-action-btn svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
}

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

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

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

/* Text Story */
.story-text-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.story-text {
    font-size: 32px;
    font-weight: 600;
    color: #fff;
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 100%;
}

/* Navigation Areas */
.story-nav-left,
.story-nav-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    cursor: pointer;
    z-index: 3;
}

.story-nav-left {
    left: 0;
}

.story-nav-right {
    right: 0;
}

/* Story Footer */
.story-footer {
    position: absolute;
    bottom: 20px;
    left: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    padding: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
}

.story-views {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}

.story-views svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
}

/* Loading State */
.story-loading {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .story-viewer-container {
        max-width: 100%;
    }

    .story-viewer-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }

    .story-header {
        top: 16px;
    }

    .story-text {
        font-size: 24px;
        padding: 20px;
    }

    .story-nav-left,
    .story-nav-right {
        width: 40%;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .story-viewer-container {
        max-width: 450px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .story-viewer-container {
        max-width: 500px;
    }
}

/* Paused State */
.story-viewer-modal.paused .story-progress-bar.active .story-progress-fill {
    animation-play-state: paused;
}

/* Accessibility */
.story-viewer-close:focus-visible,
.story-action-btn:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Reduce Motion */
@media (prefers-reduced-motion: reduce) {
    .story-viewer-modal {
        animation: none;
    }

    .story-progress-fill {
        transition: none;
    }

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

/* Prevent body scroll when viewer is open */
body.story-viewer-open {
    overflow: hidden;
}
