/* ==========================================================================
   ۱. انیمیشن چرخش نوار استوری
   ========================================================================== */
@keyframes loadingRotate {
    0% { transform: rotate(0deg); }
    15% { transform: rotate(360deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   ۲. استایل‌های لوگو و آواتار استوری
   ========================================================================== */
.logo-story-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: visible !important;
    cursor: pointer;
    background: transparent;
    transition: transform 0.2s ease, opacity 0.3s ease;
}

/* وضعیت استوری جدید: نوار رنگی متحرک */
.logo-story-container.unseen::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#f09433, #e6683c, #dc2743, #cc2366, #bc1888, #f09433);
    animation: loadingRotate 10s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    z-index: 1;
    padding: 2px;
}

/* وضعیت استوری دیده شده: نوار خاکستری ثابت و ماتی ملایم */

.logo-story-container.seen::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #e2e2e2;
    animation: none;
    z-index: 1;
    padding: 2px;
}

.logo-link {
    position: relative;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    background: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    overflow: hidden;
}

.logo-link img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.story-badge {
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(45deg, #f09433, #dc2743, #bc1888);
    color: white;
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 4px;
    z-index: 10;
    border: 1.5px solid #fff;
    white-space: nowrap;
}

/* تغییر رنگ بدج در حالت دیده شده */
.logo-story-container.seen .story-badge {
    background: #e2e2e2;
    color: #888;
}

/* ==========================================================================
   ۳. ایزوله‌سازی بخش آیکون کوچک استوری (Wrapper دوم)
   ========================================================================== */
.story-avatar-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 65px;
    height: 65px;
    cursor: pointer;
    background: transparent;
}

.story-avatar-wrapper.active-story::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(#f09433, #e6683c, #dc2743, #cc2366, #bc1888, #f09433);
    animation: loadingRotate 10s cubic-bezier(0.65, 0, 0.35, 1) infinite;
    z-index: 1;
}

.story-avatar-wrapper.viewed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #e2e2e2;
    animation: none;
    z-index: 1;
}

.story-avatar-inner {
    position: relative;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    background: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    overflow: hidden;
}

.story-avatar-inner img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   ۴. لایه پوشاننده کل صفحه (Overlay)
   ========================================================================== */
.story-full-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 999999 !important;
    justify-content: center;
    align-items: center;
}

/* ==========================================================================
   ۵. کارت استوری اصلی و محتوا
   ========================================================================== */
.story-card {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
}

.story-main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
    width: 100%;
    height: 100%;
    position: relative;
}

.story-main-content img,
.story-main-content video,
#storyContent video {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    object-fit: contain !important;  
    background-color: #000;
}

/* ==========================================================================
   ۶. هدر و فوتر کارت استوری
   ========================================================================== */
.story-card-header {
    padding: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, rgb(0 0 0 / 50%), transparent);
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 100;
    direction: rtl;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.close-story-btn {
    color: #fff;
    font-size: 22px;
    background: none;
    border: none;
    cursor: pointer;
}

.story-logo {
    width: 40px;
    height: 40px;
}

.border-story-logo {
    border-radius: 50%;
    border: 2px solid #fdf1cc;
}

.more-info-link {
    background: rgba(255, 255, 255, 0.85);
    color: #003399;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 11px;
    text-decoration: none;
    border: 1px solid #0d6efd;
}

.story-card-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 30px 20px 25px 20px;
    background: linear-gradient(to top, rgb(0 0 0 / 50%), transparent);
    color: #fff;
    z-index: 100;
}

/* ==========================================================================
   ۷. نوارهای پیشرفت (Progress Bars)
   ========================================================================== */
.multi-progress-container {
    position: absolute;
    top: 3px;
    width: calc(100% - 20px);
    left: 10px;
    display: flex;
    gap: 4px;
    z-index: 1000;
    direction: ltr;
    opacity: 0.5;
}

.progress-segment {
    height: 2.5px;
    background: rgba(255, 255, 255, 0.3);
    flex: 1;
    border-radius: 2px;
    overflow: hidden;
}

.progress-inner {
    height: 100%;
    width: 0%;
    background: #fff;
    transition: width linear;
}

/* ==========================================================================
   ۸. دکمه‌های ناوبری (Arrows)
   ========================================================================== */
.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgb(255 255 255 / 0%);
    color: white;
    border: 1px solid rgb(255 255 255 / 0%);
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.prev-story {
    left: 20px;
}

.next-story {
    right: 20px;
}

/* ==========================================================================
   ۹. تنظیمات ریسپانسیو (Media Queries)
   ========================================================================== */
@media (max-width: 600px) {
    .story-card {
        border-radius: 0;
        height: 100% !important;
    }
}

@media (min-width: 600px) {
    .prev-story {
        left: calc(50% - 260px);
    }
    .next-story {
        right: calc(50% - 260px);
    }
}