/* ======= Story Improvements ======= */

/* تحسينات ستوري البلدان */
.country-stories-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 5px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid #dee2e6;
    position: relative;
}

.country-stories-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--red-color), var(--primary-color));
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.country-stories {
    display: flex;
    overflow-x: auto;
    padding: 0px;
    gap: 15px;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #eee;
    position: relative;
}

.country-stories::-webkit-scrollbar {
    height: 6px;
}

.country-stories::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.country-stories::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary-color), var(--red-color));
    border-radius: 3px;
}

.country-stories::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--red-color), var(--primary-color));
}

.country-story {
    flex: 0 0 auto;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    border-radius: 15px;
}


.country-flag {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    overflow: hidden;
    margin: 0 auto 8px;
    border: 3px solid #e9ecef;
    position: relative;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.country-story:hover .country-flag {
    border-color: var(--primary-color);
}

.country-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}


.active-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 15px;
    height: 15px;
    background: linear-gradient(135deg, var(--red-color), #ff8800);
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.country-name {
    font-size: 13px;
    font-weight: 600;
    display: block;
    color: var(--dark-color);
    transition: color 0.3s ease;
    line-height: 1.3;
    margin-top: 5px;
}

.country-story:hover .country-name {
    color: var(--primary-color);
}

.country-story.active .country-flag {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.2);
}

.country-story.active .country-name {
    color: var(--primary-color);
    font-weight: 700;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .country-stories-container {
        padding: 10px 0;
        margin-bottom: 15px;
    }

    .country-stories {
        gap: 10px;
        padding: 5px 0;
        scroll-snap-type: x mandatory;
    }

    .country-story {
        scroll-snap-align: start;
        min-width: 75px;
        padding: 5px;
    }

    .country-flag {
        width: 55px;
        height: 55px;
        margin-bottom: 6px;
        border-width: 2px;
    }

    .country-name {
        font-size: 11px;
        line-height: 1.2;
    }

    .active-indicator {
        width: 12px;
        height: 12px;
        top: -1px;
        right: -1px;
    }
}

/* تحسينات للأجهزة اللوحية */
@media (min-width: 769px) and (max-width: 1024px) {
    .country-stories {
        gap: 12px;
    }

    .country-flag {
        width: 60px;
        height: 60px;
    }

    .country-name {
        font-size: 12px;
    }
}

/* تحسينات للأجهزة الكبيرة */
@media (min-width: 1025px) {

    .country-stories {
        gap: 10px;
    }

    .country-flag {
        width: 65px;
        height: 65px;
    }

    .country-name {
        font-size: 14px;
    }
}

/* ======= Story Modal Improvements ======= */

/* تحسينات ستوري مودال */
.story-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.85) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.story-content {
    width: 100%;
    max-width: 450px;
    height: 85vh;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: #f0f0f0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: contentSlideIn 0.4s ease;
}

@keyframes contentSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.story-header {
    /* position: absolute; */
    top: 0;
    right: 0;
    left: 0;
    z-index: 20;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.story-info {
    display: flex;
    flex-direction: column;
    color: white;
}

.story-country {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
}

.story-count {
    font-size: 12px;
    opacity: 0.8;
}

.story-progress {
    display: flex;
    flex: 1;
    gap: 4px;
    margin: 0 20px;
}

.progress-item {
    height: 3px;
    background-color: rgba(255, 255, 255, 0.3);
    flex: 1;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.progress-item::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(90deg, var(--red-color), #ff8800);
    width: 0%;
    transition: width 0.1s linear;
}

.progress-item.active::before {
    width: 100%;
    animation: progressFill 5s linear forwards;
}

.progress-item.completed::before {
    width: 100%;
}

@keyframes progressFill {
    from {
        width: 0%;
    }

    to {
        width: 100%;
    }
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.story-body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.story-items {
    width: 100%;
    height: 100%;
    position: relative;
}

.story-item {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    transform: scale(1.05);
}

.story-item.active {
    opacity: 1;
    transform: scale(1);
}

/* .story-image {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 20px;
    overflow: hidden;
}

.story-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 20px;
    transition: transform 0.3s ease;
} */

.story-overlay {
    /* position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    /* background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.6) 50%, transparent 100%); */
    padding: 40px 20px 20px;
    color: white;
    */ text-align: center;
}

.story-overlay h3 {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    inline-size: 100%;
    line-height: 2.375rem;
    margin: 0;
    max-inline-size: 100%;
    text-align: center;
    word-wrap: break-word;
}

.story-actions {
    display: flex;
    justify-content: flex-end;
}

.read-more-btn {
    background: var(--red-color);
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 50px;
    text-align: center;
}


.story-controls {
    position: absolute;
    top: 75%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 15px;
    z-index: 15;
}

.prev-btn,
.next-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--background-btn);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    font-size: 18px;
}

.prev-btn:hover,
.next-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.story-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 15;
}

.indicator-btn {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.indicator-btn.active {
    background: var(--red-color);
    transform: scale(1.2);
}

.indicator-btn:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* مؤشر التحميل */
.story-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
    animation: loadingFadeIn 0.3s ease;
}

@keyframes loadingFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.loading-spinner {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--red-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 16px;
    font-weight: 500;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .story-content {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .story-header {
        padding: 15px;
    }

    .story-country {
        font-size: 16px;
    }

    .story-overlay h3 {
        font-size: 18px;
    }

    .story-controls {
        padding: 0 10px;
    }

    .prev-btn,
    .next-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .story-indicators {
        bottom: 15px;
    }
}

/* تحسينات للأداء */
.story-item {
    will-change: opacity, transform;
}

.story-image img {
    will-change: transform;
}

.progress-item::before {
    will-change: width;
}



@media (max-width: 768px) {

    /* Story Modal Container */
    .story-modal {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: #f7f7f7;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        overflow: auto;
        padding: 0;
    }

    /* Header */
    .story-modal-header {
        position: relative;
        padding: 0 16px;
        background: #fff;
        border-bottom: 2px solid #eee;
        min-height: 56px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .story-modal-close {
        position: absolute;
        left: 16px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 28px;
        color: #888;
        background: none;
        border: none;
        z-index: 2;
    }

    .story-modal-title {
        font-size: 1.3rem;
        font-weight: bold;
        color: #2d3e50;
        text-align: center;
        margin: 0 auto;
        line-height: 1.3;
        max-width: 90vw;
        word-break: break-word;
        padding: 12px 0 0 0;
    }

    /* Progress Bar */
    .story-modal-progress {
        width: 100%;
        height: 4px;
        background: #eee;
        margin: 0;
        position: relative;
        overflow: hidden;
    }

    .story-modal-progress-bar {
        height: 100%;
        background: #b30000;
        width: 0;
        transition: width 0.3s linear;
    }

    /* Story Image */
    .story-modal-image-container {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        background: #fff;
        margin: 0;
        padding: 0;
    }

    .story-modal-image {
        width: 100%;
        max-width: 100vw;
        max-height: 45vh;
        object-fit: cover;
        border-radius: 12px;
        margin: 16px 0 0 0;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    /* Headline */
    .story-modal-headline {
        font-size: 1.1rem;
        color: #1a237e;
        text-align: center;
        margin: 24px 12px 0 12px;
        font-weight: 600;
        line-height: 1.5;
        max-width: 95vw;
        word-break: break-word;
    }

    /* Read More Button */
    .story-modal-readmore {
        display: block;
        width: 90%;
        max-width: 350px;
        margin: 24px auto 0 auto;
        padding: 14px 0;
        background: #b30000;
        color: #fff;
        font-size: 1.1rem;
        font-weight: bold;
        border: none;
        border-radius: 8px;
        text-align: center;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
        transition: background 0.2s;
    }

    .story-modal-readmore:hover {
        background: #d32f2f;
    }

    /* Navigation Arrows */
    .story-modal-arrow {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        background: #fff;
        color: #1a237e;
        border: none;
        border-radius: 50%;
        width: 38px;
        height: 38px;
        font-size: 1.7rem;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        cursor: pointer;
        z-index: 2;
        opacity: 0.85;
    }

    .story-modal-arrow.left {
        left: 8px;
    }

    .story-modal-arrow.right {
        right: 8px;
    }

    /* Dots */
    .story-modal-dots {
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 18px 0 8px 0;
    }

    .story-modal-dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
        background: #bbb;
        margin: 0 4px;
        transition: background 0.2s;
    }

    .story-modal-dot.active {
        background: #b30000;
    }

    /* Responsive */
    @media (max-width: 600px) {
        .story-modal-title {
            font-size: 1.1rem;
            padding-top: 8px;
        }

        .story-modal-headline {
            font-size: 1rem;
            margin-top: 16px;
        }

        .story-modal-image {
            max-height: 32vh;
            margin-top: 8px;
        }

        .story-modal-readmore {
            font-size: 1rem;
            padding: 12px 0;
            margin-top: 16px;
        }
    }
}

.country-flag {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 1;
    box-sizing: content-box;
}

.country-story.has-story .country-flag::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 66px;
    height: 66px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(#fcb900, #fd1d1d, #833ab4, #fcb900);
    z-index: 0;
    animation: insta-story-spin 2.5s linear infinite;
    box-sizing: border-box;
}

.country-flag img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: block;
    object-fit: cover;
    position: relative;
    z-index: 1;
    border: 2px solid #fff;
    box-sizing: border-box;
}

/* اسم الدولة */
.country-name {
    margin-top: 0px;
    font-size: 1.02rem;
    color: #222;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0px;
}

