/* ==================== استوری بار - استایل مشابه اینستاگرام ==================== */

/* Container */
.stories-container {
    background: #fff;
    padding: 16px 0;
    border-bottom: 1px solid #dbdbdb;
    position: relative;
    direction: rtl;
}

.stories-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.stories-scroll-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.stories-bar {
    display: flex;
    gap: 16px;
    padding: 0 8px;
}

/* Story Item */
.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    min-width: 80px;
    transition: transform 0.2s ease;
}

.story-item:hover {
    transform: translateY(-2px);
}

/* Story Circle */
.story-circle {
    position: relative;
    width: 68px;
    height: 68px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-radius: 50%;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.story-circle:hover {
    transform: scale(1.05);
}

/* Seen stories - gray gradient */
.story-circle.story-seen {
    background: linear-gradient(135deg, #a0a0a0, #707070);
    opacity: 0.6;
}

.story-avatar,
.story-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #fff;
    object-fit: cover;
    background: #fff;
}

.story-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 24px;
}

/* Story Count Badge */
.story-count-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #ff4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Story Title */
.story-title {
    font-size: 12px;
    color: #262626;
    text-align: center;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== Story Modal ==================== */

.story-modal .modal-content {
    background: #000;
    border: none;
    border-radius: 0;
}

.story-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* Story Header */
.story-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent);
}

.story-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.story-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #fff;
    object-fit: cover;
}

.story-user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.story-username {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.story-time {
    color: rgba(255,255,255,0.8);
    font-size: 12px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.story-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.story-close:hover {
    transform: scale(1.1);
}

/* Progress Bars */
.story-progress {
    position: absolute;
    top: 12px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 4px;
    z-index: 999;
}

.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;
}

/* Video Container */
.story-video-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

.story-video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.story-video-title {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    padding: 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    border-radius: 8px;
}

/* Navigation Areas */
.story-nav-previous,
.story-nav-next {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    cursor: pointer;
    z-index: 100;
}

.story-nav-previous {
    left: 0;
}

.story-nav-next {
    right: 0;
}

/* Story Actions */
.story-actions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    padding: 12px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.story-action-btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 10px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.story-action-btn:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
    transform: scale(1.05);
}

.story-action-btn i {
    font-size: 16px;
}

/* ==================== Responsive Design ==================== */

@media (max-width: 768px) {
    .stories-container {
        padding: 12px 0;
    }
    
    .stories-bar {
        gap: 12px;
        padding: 0 4px;
    }
    
    .story-item {
        min-width: 70px;
    }
    
    .story-circle {
        width: 60px;
        height: 60px;
        padding: 2px;
    }
    
    .story-avatar,
    .story-avatar-placeholder {
        width: 54px;
        height: 54px;
        border: 2px solid #fff;
    }
    
    .story-title {
        font-size: 11px;
        max-width: 70px;
    }
    
    .story-count-badge {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
    
    .story-header {
        padding: 12px 16px;
    }
    
    .story-progress {
        top: 10px;
        left: 16px;
        right: 16px;
        gap: 3px;
    }
    
    .story-progress-bar {
        height: 2px;
    }
    
    .story-video-title {
        bottom: 100px;
        font-size: 14px;
        padding: 10px;
    }
    
    .story-actions {
        bottom: 16px;
        padding: 10px 16px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .story-action-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .story-action-btn span {
        display: none;
    }
    
    .story-action-btn i {
        font-size: 18px;
        margin: 0;
    }
}

@media (max-width: 480px) {
    .story-item {
        min-width: 60px;
    }
    
    .story-circle {
        width: 56px;
        height: 56px;
    }
    
    .story-avatar,
    .story-avatar-placeholder {
        width: 50px;
        height: 50px;
    }
    
    .story-title {
        font-size: 10px;
        max-width: 60px;
    }
}

/* ==================== Animations ==================== */

@keyframes storyPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.story-circle:active {
    animation: storyPulse 0.3s ease;
}

/* Fade in animation for modal */
.story-modal.show {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==================== Accessibility ==================== */

.story-item:focus-visible,
.story-action-btn:focus-visible,
.story-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ==================== Loading State ==================== */

.story-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 18px;
}

.story-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
