﻿

.stories-section {
    width: 100%;
    padding: 16px 0;
    margin-top: 0;
    position: relative;
    background: white;
}

.stories-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    margin-bottom: 12px;
}

.stories-title {
    font-weight: 600;
    font-size: 14px;
    color: #262626;
}

.watch-all {
    font-size: 12px;
    color: #0095f6;
    text-decoration: none;
    font-weight: 500;
}

.stories-container_ {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 16px;
    gap: 16px;
    scroll-behavior: smooth;
}

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

.story {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    position: relative;
    cursor: pointer;
}

.story-avatar {
    width: 66px;
    height: 66px;
    border-radius: 50%;
    padding: 2px;
    background: linear-gradient(45deg, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 8px;
}

.story-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid white;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #fff;
}

.story-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-username {
    font-size: 12px;
    color: #262626;
    max-width: 74px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
}

.stories-section:hover .nav-button {
    opacity: 1;
}

.nav-button.prev {
    right: 5px;
}

.nav-button.next {
    left: 5px;
}

.nav-button i {
    font-size: 14px;
    color: #333;
}

.storystyle {
    margin-bottom: 12px !important;
}

/* استوری ویوور (پاپ آپ نمایش استوری) */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.story-content {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.close-story {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 1001;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.story-username-viewer {
    position: absolute;
    top: 30px;
    color: white;
    font-weight: 500;
    font-size: 16px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
    width: 100%;
    text-align: center;
}

/* موبایل (اولویت اصلی) */
@media (max-width: 767px) {
    .stories-section {
        border-bottom: 1px solid #dbdbdb;
        border-radius: 0;
        padding: 12px 0;
    }

    .nav-button {
        display: none;
    }

    .stories-container_ {
        padding: 0 10px;
        gap: 12px;
    }

    body {
        padding: 0;
    }

    .story {
        width: 70px;
    }

    .story-avatar {
        width: 60px;
        height: 60px;
    }

    /* استوری ویوور در موبایل */
    .story-content {
        max-width: 100vw;
        max-height: 100vh;
    }

    .story-image {
        /* نسبت 9:16 برای موبایل */
        width: 100%;
        height: 100vh;
        object-fit: contain;
    }

    .story-username-viewer {
        top: 70px;
        font-size: 16px;
    }

    .close-story {
        top: 25px;
        left: 15px;
        width: 35px;
        height: 35px;
    }
}

/* تبلت */
@media (min-width: 768px) and (max-width: 1023px) {
    .container_ {
        max-width: 600px;
        margin: 20px auto;
        border: 1px solid #dbdbdb;
        border-radius: 8px;
        background: white;
    }

    .story-viewer {
        padding: 20px;
    }

    .story-content {
        max-width: 90%;
        max-height: 90vh;
    }

    .story-image {
        max-width: 100%;
        max-height: 90vh;
        object-fit: contain;
        border-radius: 8px;
    }
}

/* دسکتاپ */
@media (min-width: 1024px) {
    .container_ {
        max-width: 600px;
        margin: 40px auto;
        border: 1px solid #dbdbdb;
        border-radius: 8px;
        background: white;
    }

    .stories-section {
        border-radius: 8px;
    }

    .stories-container_ {
        padding: 0 20px;
    }

    .story {
        width: 80px;
    }

    .story-avatar {
        width: 70px;
        height: 70px;
    }

    .story-viewer {
        padding: 40px;
    }

    .story-content {
        max-width: 400px;
        max-height: 80vh;
    }

    .story-image {
        max-width: 100%;
        max-height: 80vh;
        object-fit: contain;
        border-radius: 8px;
    }
}


.story-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 4px; /* ارتفاع نازک */
    width: 100%;
    background: rgba(255,255,255,0.08);
    z-index: 1002;
    overflow: hidden;
}

.story-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.95), rgba(255,255,255,0.6));
    transition: width 0.1s linear;
}

/* وقتی مدال بسته است، aria-hidden=true لید می کنه ولی ما display:none با کلاس active می‌زنیم */
.story-viewer { /* از کد شما استفاده میشه */
}

/* در موبایل، اطمینان از اینکه پروگرس بالاست و دیده می‌شود */
@media (max-width:767px) {
    .story-progress {
        height: 3px;
    }
}