/**
 * Developer Stories - Frontend Styles
 * مطابق با ساختار HTML نمونه قبلی
 */

:root {
    --story-ring-active: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
    --story-ring-seen: #dbdbdb;
}

/* ============================================
   Story Wrapper & List
   ============================================ */
.story-wrapper {
    max-height: 200px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.overfllow-wrapper {
    width: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    /* overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none; */
}

.overfllow-wrapper::-webkit-scrollbar {
    display: none;
}

/* ============================================
   Story Item (Thumbnail Circle)
   ============================================ */
.story-item {
    /* margin-left: 24px; */
    padding: 6px 12px 0;
    /* width: 120px; */
    width: 100%;
    max-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
}

.story-pic {
    width: 70px !important;
    height: 70px !important;
    border-radius: 50%;
    position: relative;
    cursor: pointer;
}

.story-pic img {
    border-radius: 50%;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 3px solid #fff;
}

.story-title {
    width: 100%;
    font-size: 0.8rem;
    text-align: center;
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Story Ring SVG */
.story-pic figcaption {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none;
}

.story-item svg {
    display: block;
    overflow: visible;
    fill: none;
    stroke-linecap: round;
    stroke-width: 3px;
    stroke-dasharray: 1;
    stroke-dashoffset: 0;
    width: 100%;
    height: 100%;
    stroke: var(--dark-secondary);
}

/* Active Story (Loading Animation) */
.active-story svg {
    animation: stroke-draw 3s ease-out infinite alternate;
    -webkit-animation: stroke-draw 3s ease-out infinite alternate;
    stroke: var(--light-content);
}

@keyframes stroke-draw {
    0% {
        stroke-dasharray: 1;
    }
    100% {
        -webkit-transform: rotate(180deg);
        transform: rotate(180deg);
        stroke-dasharray: 8;
    }
}

/* Seen Story */
.seen-story svg {
    stroke: var(--story-ring-seen);
}

/* Not Seen Story - Gradient Ring */
.story-item:not(.seen-story) .story-pic::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: var(--story-ring-active);
    z-index: -1;
}

.story-item:not(.seen-story) .story-pic img {
    border: 3px solid #fff;
}

.seen-story .story-pic::before {
    background: var(--story-ring-seen);
}

/* ============================================
   Story Content Wrapper (Modal)
   ============================================ */
.story-content-wrapper {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.95);
    display: none;
    z-index: 1001;
}

/* Close Button */
.close-story {
    position: absolute;
    top: 38px;
    right: 56px;
    color: #fff;
    font-size: 1.5rem;
    z-index: 10000;
    cursor: pointer;
    text-shadow: 1px 1px 5px rgba(88, 88, 88, 0.5), -1px -1px 5px rgba(88, 88, 88, 0.5);
    transition: transform 0.2s ease;
}

.close-story:hover {
    transform: scale(1.1);
}

/* Navigation Arrows */
.story-content-wrapper > i {
    position: absolute;
    width: 60px;
    cursor: pointer;
    height: 80vh;
    top: 10%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    z-index: 100000;
}

.story-content-wrapper > i::before {
    text-shadow: 1px 1px 5px rgba(88, 88, 88, 0.5), -1px -1px 5px rgba(88, 88, 88, 0.5);
}

.next-story {
    left: 0;
}

.prev-story {
    right: 16px;
}

/* ============================================
   Splide Slider Container
   ============================================ */
.stories-slider-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#stories-splide {
    width: 100%;
    max-width: 420px;
    height: 95vh;
    max-height: 750px;
}

#stories-splide .splide__track {
    height: 100%;
}

#stories-splide .splide__list {
    height: 100%;
}

/* Story Slide */
.story-slide {
    height: 100%;
}

.story-slide-inner {
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Progress Bars
   ============================================ */
.story-progress-container {
    display: flex;
    gap: 4px;
    padding: 12px 12px 8px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.4), transparent);
}

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

.story-progress-fill {
    height: 100%;
    background: #fff;
    width: 0;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.story-progress-bar.completed .story-progress-fill {
    width: 100% !important;
}

.story-progress-bar.active .story-progress-fill {
    /* Width controlled by JS */
}

/* ============================================
   Story Header
   ============================================ */
.story-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 35px 12px 12px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99;
}
.story-header>div {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    max-width: calc(100% - 50px);
}
.story-header-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50%;
    object-fit: cover !important;
    border: 2px solid #fff;
    margin-left: 6px;
}

.story-header-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ============================================
   Story Items Container (Media)
   ============================================ */
.story-items-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.story-media-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
}

.story-media-item.active {
    display: flex;
}

.story-media-item img,
.story-media-item video {
    width: 100%;
    height: 100%;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain;
}

/* Loading Indicator */
.story-media-item.loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Navigation Areas
   ============================================ */
.story-nav-area {
    position: absolute;
    top: 80px;
    bottom: 100px;
    width: 10%;
    z-index: 50;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.story-nav-area i{
    color: #fff;
    font-size: 2rem;
}
.story-nav-prev {
    right: 0;
}

.story-nav-next {
    left: 0;
}

/* ============================================
   Link Button
   ============================================ */
.story-link-btn {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.story-link-btn a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 30px;
    background: rgba(255, 255, 255, 0.95);
    color: #262626;
    text-decoration: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.story-link-btn a:hover {
    background: #fff;
    transform: scale(1.05);
}

.story-link-btn i {
    font-size: 18px;
    animation: bounce-up 1s ease infinite;
}
.story_carousel .splide__arrow{
    border: 2px solid #2ab24b7a;
}
.story_carousel .splide__arrows--rtl .splide__arrow--next {
    left: -24px;
}    
.story_carousel .splide__arrows--rtl .splide__arrow--prev {
    right: -24px;
}

@keyframes bounce-up {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* ============================================
   Responsive - Tablet
   ============================================ */
@media screen and (min-width: 1024px) and (max-width: 1280px) {
    /* .story-item {
        width: 100px;
        margin-left: 16px;
    } */
    
    .story-pic {
        width: 70px !important;
        height: 70px !important;
    }
}

@media screen and (max-width: 1023px) {
    .story-wrapper {
        max-height: 200px;
        overflow: auto;
    }
    
    .story-item {
        /* width: 90px; */
        max-height: 180px;
    }
    
    .story-pic {
        width: 70px !important;
        height: 70px !important;
    }
    
    .close-story {
        top: 24px;
        right: 24px;
    }
    
    .prev-story {
        right: 0px;
    }
    
    #stories-splide {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .story-slide-inner {
        border-radius: 0;
    }
    
    .story-content-wrapper > i {
        width: 50px;
    }
    .story_carousel .splide__arrows--rtl .splide__arrow--next {
        left: -12px;
    }    
    .story_carousel .splide__arrows--rtl .splide__arrow--prev {
        right: -12px;
    }
    .story_carousel .splide__arrow {
        height: 24px;
        width: 24px;
    }
}

/* ============================================
   Responsive - Mobile
   ============================================ */
@media screen and (max-width: 599px) {
    .close-story {
        top: 29px;
        right: 8px;
        font-size: 1.8rem;
    }
    
    .story-content-wrapper > i {
        display: none;
    }
    
    .story-item {
        /* width: 80px; */
        max-height: 180px;
    }
    
    .story-pic {
        width: 60px;
        height: 60px;
    }
    
    .story-title {
        font-size: 0.7rem;
    }
    
    .story-progress-container {
        padding: 8px 8px 6px;
        gap: 3px;
    }
    
    .story-progress-bar {
        height: 2px;
    }
    
    .story-header {
        padding: 30px 10px 10px;
    }
    
    .story-header-avatar {
        width: 32px;
        height: 32px;
    }
    
    .story-header-title {
        font-size: 13px;
    }
    
    .story-link-btn {
        bottom: 20px;
    }
    
    .story-link-btn a {
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .story-nav-area {
        top: 60px;
        bottom: 80px;
        width: 10%;
    }
}

/* Very Small Screens */
@media screen and (max-width: 360px) {
    .story-item {
        /* width: 70px; */
        margin-left: 8px;
    }
    
    .story-pic {
        width: 54px !important;
        height: 54px !important; 
    }
    
    .story-title {
        font-size: 0.65rem;
    }
}

/* ============================================
   RTL Support
   ============================================ */
/* [dir="rtl"] .story-item {
    margin-left: 0;
    margin-right: 24px;
} */

[dir="rtl"] .next-story {
    right: auto;
    left: 16px;
}

[dir="rtl"] .prev-story {
    left: auto;
    right: 0;
}

[dir="rtl"] .close-story {
    right: auto;
    left: 15px;
}

@media screen and (max-width: 1023px) {
    [dir="rtl"] .close-story {
        left: 24px;
    }
    
    [dir="rtl"] .prev-story {
        left: 0px;
    }
}

@media screen and (max-width: 599px) {
    [dir="rtl"] .close-story {
        left: 8px;
    }
    
    .story-item {
        margin-left: 15px;
    }
}

/* ============================================
   Animations
   ============================================ */
.story-content-wrapper {
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Disable animations for reduced motion */
@media (prefers-reduced-motion: reduce) {
    .story-content-wrapper,
    .active-story svg,
    .story-link-btn i,
    .story-media-item.loading::after {
        animation: none;
    }
}
