/* ===== ۱. استایل کلی نوار هایلایت‌ها در صفحه اصلی ===== */
.igs-bar {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 10px 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.igs-bar::-webkit-scrollbar { 
    display: none; 
}

.igs-avatar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    width: 74px;
    padding: 0;
}

/* ===== ۲. حلقه گرادینت اینستاگرام (دیده‌نشده - بنفش/صورتی/نارنجی) ===== */
.igs-ring,
.igs-ring.igs-ring-highlight {
    width: 86px;
    height: 86px;
    border-radius: 50% !important;
    padding: 3px;
    background: linear-gradient(45deg, #feda75, #fa7e1e, #d62976, #962fbf, #4f5bd5);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

/* تصویر داخل حلقه */
.igs-ring img,
.igs-ring.igs-ring-highlight img,
.igs-highlight-item img,
.igs-highlight-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50% !important;
    border: 2px solid #fff; /* فاصله سفید بین حلقه و عکس */
    display: block;
}

/* ===== ۳. وضعیت بی‌رنگ / دیده‌شده (Seen) ===== */
.igs-ring.igs-seen,
.igs-ring.igs-ring-highlight.igs-seen {
    background: #c7c7c7 !important; /* خاکستری بی‌رنگ پس از بازدید */
}

.igs-ring.igs-seen img,
.igs-ring.igs-ring-highlight.igs-seen img {
    border-color: #fff;
}

/* نام هایلایت زیر آیکون */
.igs-name {
    font-size: 12px;
    color: #333;
    max-width: 74px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ===== ۴. نمای‌گر استوری (مودال تمام‌صفحه / 16:9) ===== */
.igs-viewer {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 999999;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s ease;
}

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

/* کادر اصلی استوری با نسبت 9:16 */
.igs-modal-content,
.igs-story-wrapper,
.igs-stage {
    position: relative;
    width: 100%;
    max-width: 420px; /* عرض استاندارد موبایلی */
    aspect-ratio: 9 / 16 !important;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ===== ۵. دکمه بستن (X) - بزرگ، قرمز و شفاف ===== */
.igs-close,
.igs-close-btn {
    background: transparent !important;
    color: #ff3b30 !important; /* قرمز روشن */
    border: none !important;
    font-size: 36px !important; /* اندازه بزرگ و واضح */
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10001;
    padding: 6px 12px;
    box-shadow: none !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    transition: transform 0.2s ease;
}

.igs-close:hover,
.igs-close-btn:hover {
    transform: scale(1.15);
}

/* ===== ۶. دکمه‌های فلش ناوبری (مخصوص قالب RTL / راست‌به‌چپ) ===== */
.igs-nav-btn,
.igs-nav-prev,
.igs-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.55) !important;
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10000;
    font-size: 22px !important;
    font-weight: bold;
    transition: all 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

/* فلش بعدی (Next) -> سمت چپ در حالت RTL */
.igs-next-btn, 
.igs-nav-next {
    left: 12px !important;
    right: auto !important;
}
.igs-next-btn::before, 
.igs-nav-next::before {
    content: "❯"; /* اشاره به سمت چپ جهت جابه‌جایی به جلو */
    margin-right: 2px;
}

/* فلش قبلی (Prev) -> سمت راست در حالت RTL */
.igs-prev-btn, 
.igs-nav-prev {
    right: 12px !important;
    left: auto !important;
}
.igs-prev-btn::before, 
.igs-nav-prev::before {
    content: "❮"; /* اشاره به سمت راست جهت بازگشت به قبل */
    margin-left: 2px;
}

.igs-nav-btn:hover,
.igs-nav-prev:hover,
.igs-nav-next:hover {
    background: rgba(0, 0, 0, 0.85) !important;
    border-color: #ffffff !important;
    transform: translateY(-50%) scale(1.1);
}


/* ===== ۷. نوارهای پیشرفت (Progress Bars) ===== */
.igs-progress-row {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 4px;
    padding: 8px 10px 0;
    z-index: 9999;
}

.igs-progress-bar {
    flex: 1;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 2px;
    overflow: hidden;
}

.igs-progress-fill {
    height: 100%;
    width: 0%;
    background: #fff;
    transform-origin: left;
    will-change: width;
}

.igs-progress-fill.igs-instant-full { width: 100%; }


/* ===== ۸. هدر استوری (پروفایل و نام) ===== */
.igs-header {
    position: absolute;
    top: 14px;
    left: 0;
    right: 60px; /* عدم تداخل با دکمه بستن */
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #fff;
    z-index: 9999;
}

.igs-header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.igs-header-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}


/* ===== ۹. محتوای مدیا و لینک ===== */
.igs-media-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity;
    touch-action: none;
}

.igs-media-wrap img,
.igs-media-wrap video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.igs-link-cta {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    text-align: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    padding: 8px 18px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* اسپینر لودینگ */
.igs-media-wrap.igs-loading::after {
    content: "";
    position: absolute;
    width: 34px;
    height: 34px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: igs-spin 0.7s linear infinite;
}

@keyframes igs-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 480px) {
    .igs-ring, .igs-ring.igs-ring-highlight { width: 60px; height: 60px; }
    .igs-avatar-btn { width: 68px; }
    .igs-modal-content, .igs-story-wrapper, .igs-stage { max-height: 100vh; }
    .igs-nav-btn, .igs-nav-prev, .igs-nav-next { width: 38px !important; height: 38px !important; font-size: 18px !important; }
}