/* ══════════════════════════════════════════════════
   INSTA MENTOR - STORIES WIDGET (ULTRA MAX EDITION)
   ══════════════════════════════════════════════════ */

:root {
    --story-transition: 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

/* ─── ROOT CONTAINER ─────────────────────────── */
.insta-stories-root {
    direction: ltr;
    font-family: 'Vazirmatn', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    padding: 10px 0;
}

/* ─── SCROLLABLE TRACK ───────────────────────── */
.insta-stories-scroll {
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 8px 6px 16px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.insta-stories-scroll::-webkit-scrollbar {
    display: none;
}

/* ─── SINGLE STORY ITEM ──────────────────────── */
.insta-story-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: transform var(--story-transition);
    position: relative;
}

.insta-story-item:hover {
    transform: translateY(-4px);
}

.insta-story-item:active {
    transform: scale(0.92);
}

/* ─── RING (MORPHING GRADIENT) ──────────────── */
.insta-story-ring {
    border-radius: 50%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.insta-story-ring.animated-gradient {
    background-size: 400% 400%;
    animation: gradientShift 4s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.insta-story-ring:not(.seen) {
    animation: subtlePulse 2.5s infinite;
}

.insta-story-ring.animated-gradient:not(.seen) {
    animation: subtlePulse 2.5s infinite, gradientShift 4s ease infinite;
}

@keyframes subtlePulse {
    0% { box-shadow: 0 0 0 0 rgba(225, 48, 108, 0.5); }
    70% { box-shadow: 0 0 0 10px rgba(225, 48, 108, 0); }
    100% { box-shadow: 0 0 0 0 rgba(225, 48, 108, 0); }
}

/* ⚡️ FIX: Override Elementor global styles */
.insta-stories-root .insta-story-ring-inner,
.elementor .insta-story-ring-inner {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    position: relative !important;
    background: #ffffff;
    border: 3px solid #ffffff;
    box-sizing: border-box;
    z-index: 2;
}

/* ⚡️ FIX: thumb-wrap */
.insta-stories-root .insta-story-thumb-wrap,
.elementor .insta-story-thumb-wrap {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}

/* ⚡️ FIX: خود عکس - این مهمترینه! */
.insta-stories-root .insta-story-thumb,
.elementor .insta-story-thumb,
.elementor img.insta-story-thumb {
    width: 110% !important;
    height: 110% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 50% !important;
    margin: -5% !important;
    transition: transform 0.1s ease-out !important;
    will-change: transform;
}

.insta-story-item:hover .insta-story-ring-inner {
    transform: scale(0.9);
}

/* ─── VIDEO PLAY ICON ────────────────────────── */
.insta-story-thumb-icon {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    z-index: 5;
    pointer-events: none;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
}

/* ─── ITEM LABEL ─────────────────────────────── */
.insta-story-item-label {
    max-width: 100%;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all var(--story-transition);
}

.insta-story-item:hover .insta-story-item-label {
    transform: translateY(-2px);
}

/* ══════════════════════════════════════════════
   MODAL (CINEMATIC EXPERIENCE)
   ══════════════════════════════════════════════ */
.insta-story-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    animation: modalCinematicIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

@keyframes modalCinematicIn {
    from { opacity: 0; backdrop-filter: blur(0px); }
    to   { opacity: 1; backdrop-filter: blur(20px); }
}

.insta-story-modal-header {
    position: absolute;
    top: 24px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 8px 16px 8px 8px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.insta-story-modal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.7);
}

.insta-story-modal-username {
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.3px;
}

.insta-story-modal-time {
    color: rgba(255, 255, 255, 0.75);
    display: block;
}

.insta-story-progress-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 25;
    background: rgba(255, 255, 255, 0.15);
}

.insta-story-progress-fill {
    height: 100%;
    width: 0%;
    background: #ffffff;
    border-radius: 0 2px 2px 0;
    transition: width 0.1s linear;
    box-shadow: 0 0 12px rgba(255,255,255,0.6);
}

.insta-story-modal-close {
    position: absolute;
    top: 26px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 26px;
    cursor: pointer;
    z-index: 30;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #ffffff;
}

.insta-story-modal-close:hover {
    background: rgba(255, 0, 0, 0.4);
    transform: scale(1.1) rotate(90deg);
}

.insta-story-media-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 5;
}

.insta-story-media-img,
.insta-story-media-vid {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    transition: opacity 0.4s ease;
    display: none;
}

.story-reaction-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-reaction-emoji {
    position: absolute;
    font-size: 100px;
    animation: reactionPop 1s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
    opacity: 0;
    transform: scale(0);
    text-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

@keyframes reactionPop {
    0% { opacity: 1; transform: scale(0) rotate(-15deg); }
    50% { opacity: 1; transform: scale(1.2) rotate(5deg); }
    100% { opacity: 0; transform: scale(1.5) rotate(0deg); }
}

.insta-story-cta {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    pointer-events: auto;
    display: none;
    text-decoration: none;
}

.insta-story-cta:hover {
    background: #fff;
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

.insta-story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #ffffff;
}

.insta-story-nav:hover {
    background: rgba(0, 0, 0, 0.6);
    transform: translateY(-50%) scale(1.1);
}

.insta-story-nav-prev {
    left: 16px;
}

.insta-story-nav-next {
    right: 16px;
}

/* ══════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════ */
@media (max-width: 767px) {
    .insta-story-item:hover {
        transform: none;
    }

    .insta-story-item:active {
        transform: scale(0.9);
    }

    .insta-story-nav {
        width: 38px;
        height: 38px;
        font-size: 18px;
    }

    .insta-story-nav-prev {
        left: 6px;
    }

    .insta-story-nav-next {
        right: 6px;
    }

    .insta-story-modal-close {
        top: 20px;
        right: 12px;
        font-size: 22px;
        width: 38px;
        height: 38px;
    }

    .insta-story-modal-header {
        top: 16px;
        left: 12px;
        padding: 6px 12px 6px 6px;
        gap: 8px;
    }

    .insta-story-modal-avatar {
        width: 32px;
        height: 32px;
    }

    .story-reaction-emoji {
        font-size: 70px;
    }
}

/* ══════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════ */
.dark-mode .insta-story-ring-inner {
    background: #1a1a1a;
    border-color: #1a1a1a;
}

.dark-mode .insta-story-item-label {
    color: #fafafa;
}