/* Instagram Stories Style Video Viewer */

.stories-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    z-index: -9999 !important;
}

.stories-overlay.active {
    display: flex;
    opacity: 1;
}

.stories-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.story-slide {
    position: absolute;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform: translateX(100%);
}

.story-slide.active {
    transform: translateX(0);
}

.story-slide.prev {
    transform: translateX(-100%);
}

.story-slide.next {
    transform: translateX(100%);
}

.story-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* Progress Bars */
.stories-progress {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

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

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

/* Navigation Areas */
.nav-area {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    z-index: 5;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.nav-area:hover {
    opacity: 1;
}

.nav-left {
    left: 0;
    background: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, transparent 100%);
}

.nav-right {
    right: 0;
    background: linear-gradient(-90deg, rgba(0,0,0,0.3) 0%, transparent 100%);
}

.nav-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    backdrop-filter: blur(10px);
}

/* Close Button */
.stories-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.stories-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

/* Story Info */
.story-info {
    position: absolute;
    bottom: 60px;
    left: 20px;
    right: 20px;
    color: white;
    z-index: 10;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.story-info.visible {
    opacity: 1;
    transform: translateY(0);
}

.story-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.story-description {
    font-size: 16px;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Loading State */
.story-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 18px;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .nav-area {
        width: 40%;
    }
    
    .story-info {
        bottom: 40px;
        left: 15px;
        right: 15px;
    }
    
    .story-title {
        font-size: 20px;
    }
    
    .story-description {
        font-size: 14px;
    }
    
    .stories-progress {
        top: 15px;
        left: 15px;
        right: 15px;
    }
    
    .stories-close {
        top: 15px;
        right: 15px;
        width: 35px;
        height: 35px;
        font-size: 18px;
    }
}

/* Accessibility */
.stories-overlay:focus-within .nav-area {
    opacity: 1;
}

.nav-area:focus {
    outline: 2px solid white;
    outline-offset: -2px;
}

/* Smooth scrolling for touch devices */
.stories-container {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.story-slide {
    scroll-snap-align: center;
}

/* Video Controls Auto-hide */
.story-video::-webkit-media-controls {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-slide:hover .story-video::-webkit-media-controls {
    opacity: 1;
}

/* Pause Indicator */
.pause-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 30px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 10;
}

.pause-indicator.visible {
    opacity: 1;
}