/**
 * Bakala Stories v2.0
 * کلاس‌های پیشوند: bs2-
 */

/* لیست استوری‌ها */
.bs2-stories {
    padding: 20px 0;
}

.bs2-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.bs2-list::-webkit-scrollbar {
    display: none;
}

/* آیتم استوری */
.bs2-item {
    min-width: 80px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.bs2-item:hover {
    transform: scale(1.05);
}

.bs2-item:active {
    transform: scale(0.95);
}

/* تصویر آیکون */
.bs2-icon {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 8px;
}

.bs2-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bs2-icon svg {
    position: absolute;
    top: -4px;
    left: -4px;
    width: calc(100% + 8px);
    height: calc(100% + 8px);
    pointer-events: none;
}

.bs2-icon svg circle {
    fill: none;
    stroke: var(--bs2-color, #ed1b34);
    stroke-width: 3;
    stroke-dasharray: 251.2;
    transform: rotate(-90deg);
    transform-origin: center;
}

/* عنوان */
.bs2-title {
    font-size: 12px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* دیده شده */
.bs2-item.seen .bs2-icon svg circle {
    stroke: #c4c4c4;
}

/* ویوئر (مودال) */
.bs2-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.bs2-viewer.open {
    display: flex;
    opacity: 1;
}

/* کانتینر */
.bs2-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* پروگرس بار */
.bs2-progress {
    position: absolute;
    top: 20px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.bs2-progress-item {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.bs2-progress-item span {
    display: block;
    width: 0;
    height: 100%;
    background: #fff;
}

.bs2-progress-item.active span {
    animation: bs2-fill linear forwards;
}

.bs2-progress-item.paused span {
    animation-play-state: paused;
}

.bs2-progress-item.seen {
    background: rgba(255,255,255,0.8);
}

@keyframes bs2-fill {
    from { width: 0%; }
    to { width: 100%; }
}

/* اسلایدر */
.bs2-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.bs2-track {
    display: flex;
    height: 100%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.bs2-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.bs2-slide.active {
    opacity: 1;
}

.bs2-slide img,
.bs2-slide video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* لینک */
.bs2-link {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 30px;
    background: rgba(255,255,255,0.95);
    color: #000;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    transition: all 0.3s;
    z-index: 5;
}

.bs2-link:hover {
    background: #fff;
    transform: translateX(-50%) scale(1.05);
}

/* دکمه‌ها */
.bs2-btn {
    position: absolute;
    cursor: pointer;
    transition: all 0.2s;
}

.bs2-btn-prev,
.bs2-btn-next {
    width: 30%;
    height: 100%;
    z-index: 2;
}

.bs2-btn-prev { left: 0; top: 0; }
.bs2-btn-next { right: 0; top: 0; }

.bs2-btn-close {
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    z-index: 15;
}

.bs2-btn-close::before,
.bs2-btn-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 2px;
    background: #fff;
}

.bs2-btn-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.bs2-btn-close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.bs2-btn-mute {
    bottom: 80px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.bs2-btn-mute.visible {
    display: flex;
}

.bs2-btn-mute::before {
    content: '🔇';
    font-size: 20px;
    filter: grayscale(1) brightness(3);
}

.bs2-btn-mute.unmute::before {
    content: '🔊';
}

.bs2-btn-close:hover,
.bs2-btn-mute:hover {
    background: rgba(0,0,0,0.7);
    transform: scale(1.1);
}

/* قلب (لایک) */
.bs2-heart {
    position: absolute;
    font-size: 80px;
    pointer-events: none;
    z-index: 20;
    animation: bs2-heart 1s ease-out forwards;
}

@keyframes bs2-heart {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -80%) scale(0.8);
    }
}

/* موبایل */
@media (max-width: 768px) {
    .bs2-icon {
        width: 70px;
        height: 70px;
    }
    .bs2-title {
        font-size: 11px;
    }
    .bs2-container {
        max-width: 100%;
    }
}
