/* کانتینر اصلی */
.elementor-story-widget-container {
    display: block;
    width: 100%;
    direction: rtl;
}

/* ردیف استوری‌ها با اسکرول نرم */
.story-bubbles-list {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    overflow-x: auto;
    padding: 10px 4px 14px 4px;
    scrollbar-width: thin;
}

.story-bubble-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.story-bubble-wrapper {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s ease;
}

.story-bubble-wrapper:hover {
    transform: translateY(-2px) scale(1.02);
}

.story-bubble-ring {
    position: relative;
    width: 86px;
    height: 86px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--ring-start, #ec4899), var(--ring-end, #8b5cf6));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.story-bubble-avatar-box {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border-radius: 50%;
    padding: 2.5px;
    overflow: hidden;
}

.story-bubble-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.story-bubble-title {
    margin-top: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    max-width: 90px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* مودال استوری */
.story-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    padding: 16px;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.story-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.story-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 15, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* دیالوگ استوری (با پشتیبانی از حالت درگ) */
.story-modal-dialog {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 390px;
    height: calc(100vh - 64px);
    max-height: 650px;
    background: #000;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    cursor: grab;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-modal-dialog:active {
    cursor: grabbing;
}

/* در موبایل: پاپ‌آپ کاملاً شناور با فاصله کافی از بالا و پایین تا دکمه خرید کاملاً در دید باشد */
@media (max-width: 640px) {
    .story-modal-overlay {
        padding: 8px !important;
    }
    .story-modal-dialog {
        width: calc(100% - 24px) !important;
        max-width: 385px !important;
        height: 82vh !important;
        max-height: 570px !important;
        border-radius: 26px !important;
        margin: auto !important;
        touch-action: pan-y;
    }
    .story-footer-bar {
        bottom: 32px !important;
    }
}

.story-progress-wrapper {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 10;
}

.story-progress-bar {
    height: 3px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    overflow: hidden;
}

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

/* هدر استوری */
.story-header-bar {
    position: absolute;
    top: 22px;
    left: 14px;
    right: 14px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.story-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.45);
    padding: 4px 12px;
    border-radius: 999px;
    backdrop-filter: blur(6px);
}

.story-header-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #fff;
}

.story-header-name {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.story-close-btn {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    backdrop-filter: blur(6px);
    transition: all 0.2s ease;
}

.story-close-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.story-video-container {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
}

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

/* فوتر و دکمه مشاهده و خرید: با فاصله مطمئن از پایین تا در تمام نمایشگرها کاملاً معلوم باشد */
.story-footer-bar {
    position: absolute;
    bottom: 36px;
    left: 14px;
    right: 14px;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-product-cta-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-decoration: none !important;
    background-color: #7c3aed;
    color: #ffffff !important;
    padding: 13px 18px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
}

.story-cta-content-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.story-cta-icon {
    font-size: 15px;
    flex-shrink: 0;
}

.story-cta-text {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-cta-badge {
    background-color: #a855f7;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

body.story-modal-open {
    overflow: hidden !important;
}
