/* =========================
   Stories Bar
========================= */
.stories-bar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 0 10px;
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
}
.stories-bar[hidden] {
    display: none !important;
}
.stories-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 4px 12px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.stories-track::-webkit-scrollbar { height: 5px; }
.stories-track::-webkit-scrollbar-track { background: transparent; }
.stories-track::-webkit-scrollbar-thumb {
    background: rgba(47, 124, 255, .25);
    border-radius: 999px;
}

.story-item {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    width: 76px;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    outline: none;
    transition: transform .15s ease;
}
.story-item:focus-visible .story-item__ring {
    box-shadow: 0 0 0 3px rgba(47, 124, 255, .35);
}
.story-item:active { transform: scale(.96); }

.story-item__ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg,
        #feda75 0%,
        #fa7e1e 25%,
        #d62976 50%,
        #962fbf 75%,
        #4f5bd5 100%);
    transition: transform .2s ease;
    box-sizing: border-box;
}
.story-item:hover .story-item__ring { transform: scale(1.06); }
.story-item.is-seen .story-item__ring { background: #d1d5db; }

.story-item__img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #fff;
    overflow: hidden;
    background: #f6f8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.story-item__img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.story-item__img .no-image {
    font-size: 22px;
    color: #9ca3af;
}
.story-item__title {
    font-size: 11px;
    line-height: 1.4;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #374151;
    font-family: 'Vazirmatn', sans-serif;
    font-weight: 600;
}

/* =========================
   Story Viewer
========================= */
.story-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .92);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: storyOverlayIn .2s ease;
}
.story-viewer[hidden] { display: none !important; }
@keyframes storyOverlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.story-viewer__progress {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    height: 3px;
    background: rgba(255, 255, 255, .25);
    border-radius: 999px;
    overflow: hidden;
    z-index: 2;
}
.story-viewer__progress-bar {
    height: 100%;
    background: #fff;
    width: 0%;
    border-radius: 999px;
    transition: width .1s linear;
}

.story-viewer__close {
    position: absolute;
    top: 14px;
    right: 18px;
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #fff;
    font-size: 26px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background .15s ease, transform .15s ease;
}
.story-viewer__close:hover {
    background: rgba(255, 255, 255, .25);
    transform: scale(1.08);
}

.story-viewer__prev,
.story-viewer__next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, .12);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    transition: background .15s ease, transform .15s ease;
    font-weight: bold;
}
.story-viewer__prev { right: 18px; }
.story-viewer__next { left: 18px; }
.story-viewer__prev:hover,
.story-viewer__next:hover {
    background: rgba(255, 255, 255, .25);
    transform: translateY(-50%) scale(1.08);
}

.story-viewer__content {
    max-width: 420px;
    width: 100%;
    max-height: 80vh;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0, 0, 0, .4);
    animation: storyViewerIn .25s ease;
    cursor: pointer;
}
@keyframes storyViewerIn {
    from { opacity: 0; transform: scale(.95); }
    to { opacity: 1; transform: scale(1); }
}
.story-viewer__media {
    background: #000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    max-height: 55vh;
}
.story-viewer__media img {
    width: 100%;
    max-height: 55vh;
    object-fit: cover;
    display: block;
}

.story-viewer__info {
    padding: 18px 20px 20px;
    text-align: center;
    background: #fff;
}
.story-viewer__info h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.7;
    color: #111827;
    font-family: 'Vazirmatn', sans-serif;
}
.story-viewer__info p {
    margin: 0 0 14px;
    font-size: 13px;
    color: #6b7280;
    font-family: 'Vazirmatn', sans-serif;
}
.story-viewer__cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
    font-family: 'Vazirmatn', sans-serif;
    transition: opacity .15s ease, transform .15s ease;
}
.story-viewer__cta:hover {
    opacity: .9;
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .story-item { width: 70px; }
    .story-item__ring { width: 58px; height: 58px; }
    .stories-track {
        gap: 12px;
        padding: 4px 8px 12px;
    }
}

@media (max-width: 480px) {
    .story-item { width: 64px; }
    .story-item__ring { width: 52px; height: 52px; }
    .stories-bar {
        padding: 10px 0;
    }
    .stories-track {
        gap: 10px;
        padding: 4px 8px 10px;
    }
}