/* ============================================
   INSTAGRAM/TELEGRAM STYLE STORIES
   ============================================ */

.stories-container {
    margin-bottom: 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.stories-wrapper {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px 8px 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

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

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

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

.story-avatar {
    position: relative;
    width: 72px;
    height: 72px;
}

.story-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(45deg, #1E88E5, #42A5F5, #64B5F6);
    animation: rotate 3s linear infinite;
}

.story-ring.viewed {
    background: var(--border-color);
    animation: none;
}

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

.story-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-primary);
    padding: 3px;
}

.story-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--bg-primary);
}

.story-add-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: #1E88E5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-primary);
}

.story-add-icon i {
    font-size: 16px;
    color: white;
}

.story-label {
    font-size: 12px;
    color: var(--text-primary);
    max-width: 72px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Story Viewer Modal */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.story-viewer.active {
    display: flex;
}

.story-viewer-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100vh;
    max-height: 800px;
    background: #000;
    border-radius: 0;
}

@media (min-width: 768px) {
    .story-viewer-content {
        border-radius: 12px;
        height: 90vh;
    }
}

.story-viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
    z-index: 10;
}

.story-progress-bars {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}

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

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

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

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

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

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

.story-viewer-name {
    flex: 1;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.story-viewer-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

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

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

.story-viewer-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.story-viewer-nav {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    cursor: pointer;
    z-index: 5;
}

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

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

.story-viewer-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
}

.story-viewer-caption {
    color: white;
    font-size: 14px;
    line-height: 1.4;
}

.story-viewer-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.story-action-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.story-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.story-action-btn i {
    font-size: 18px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .story-avatar {
        width: 64px;
        height: 64px;
    }
    
    .story-label {
        max-width: 64px;
        font-size: 11px;
    }
    
    .stories-wrapper {
        gap: 12px;
    }
    
    .story-viewer-content {
        max-width: 100%;
        border-radius: 0;
    }
}

/* Dark mode adjustments */
body.light-mode .story-ring.viewed {
    background: #E5E5E5;
}

body.light-mode .story-add-icon {
    border-color: #FFFFFF;
}

body.light-mode .story-image {
    border-color: #FFFFFF;
}
