.alnakhil-stories-section {
    direction: rtl;
    margin: 30px 0;
    font-family: inherit;
    width: 100%;
    overflow: hidden;
}

.stories-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.stories-container {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding-bottom: 15px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.story-item {
    flex: 0 0 150px;
    max-width: 150px;
    cursor: pointer;
}

.story-link-trigger {
    text-decoration: none;
    display: block;
    position: relative;
}

.story-image-box {
    position: relative;
    width: 100%;
    height: 260px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin-bottom: 5px;
}

/* تصویر موجود 450px است؛ CSS فقط آن را داخل قاب استوری نمایش می‌دهد و فایل جدیدی تولید نمی‌کند. */
.story-image-box img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.75;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.story-item:hover .story-image-box img,
.story-item:focus-within .story-image-box img {
    transform: scale(1.05);
    opacity: 0.9;
}

.story-play-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    color: rgba(255,255,255,0.9);
    font-size: 22px;
    z-index: 5;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.story-views-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 5;
    font-weight: bold;
}

.story-title-overlay {
    position: absolute;
    bottom: 15px;
    right: 0;
    left: 0;
    text-align: center;
    padding: 0 8px;
    z-index: 5;
}

.story-title-overlay span,
.story-modal-badge span {
    color: #fff;
    padding: 3px 8px;
    font-size: 13px;
    font-weight: bold;
    line-height: 1.8;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

.bg-red {
    background-color: #d1121c;
}

.bg-blue {
    background-color: #005a8c;
}

.story-hashtag {
    font-size: 13px;
    color: #005a8c;
    text-align: right;
    font-weight: bold;
    transition: color 0.3s;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.story-item:hover .story-hashtag,
.story-item:focus-within .story-hashtag {
    color: #d1121c;
}

.story-scroll-btn {
    position: absolute;
    top: 110px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    font-size: 18px;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.story-scroll-btn:hover {
    background: #fff;
}

.scroll-right {
    right: -12px;
}

.scroll-left {
    left: -12px;
}

/* Modal */
.story-modal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

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

.story-modal-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(8px);
}

.story-modal-close {
    position: absolute;
    top: 20px;
    left: 25px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000001;
    transition: background 0.2s;
}

.story-modal-close:hover,
.story-modal-close:focus-visible {
    background: rgba(255,255,255,0.4);
}

.story-modal-nav {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000001;
}

.modal-nav-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-nav-btn:hover,
.modal-nav-btn:focus-visible {
    background: rgba(255,255,255,0.4);
}

.story-modal-content {
    position: relative;
    z-index: 1000000;
    width: 100%;
    max-width: 400px;
    height: 85vh;
    max-height: 700px;
    padding: 10px;
    touch-action: pan-y;
}

.story-modal-card {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.story-modal-card img,
.story-modal-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.story-modal-meta-info {
    position: absolute;
    top: 15px;
    right: 15px;
    left: 15px;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.meta-item {
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

.meta-item i {
    margin-left: 4px;
    color: #ddd;
}

.story-modal-badge {
    position: relative;
    z-index: 5;
    padding: 20px 15px 10px 15px;
    text-align: center;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 100%);
}

.story-modal-readmore {
    position: relative;
    z-index: 5;
    margin: 0 10px 50px 10px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
    text-align: center;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
    display: block;
    border: 1px solid rgba(255,255,255,0.2);
}

.story-modal-readmore:hover,
.story-modal-readmore:focus-visible {
    background: #d1121c;
    border-color: #d1121c;
}

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

@media (max-width: 768px) {
    .story-scroll-btn {
        display: none;
    }

    .story-item {
        flex: 0 0 135px;
        max-width: 135px;
    }

    .story-image-box {
        height: 235px;
    }

    .story-modal-content {
        max-width: 100%;
        height: 100vh;
        max-height: none;
        padding: 0;
    }

    .story-modal-card {
        border-radius: 0;
    }

    /* روی موبایل ناوبری با Swipe انجام می‌شود؛ دکمه‌ها فقط مزاحم صفحه هستند. */
    .story-modal-nav {
        display: none;
    }

    .story-modal-close {
        left: 15px;
        top: 15px;
        background: rgba(0,0,0,0.5);
    }
}
