/* Stories Section Styles */
.stories-section {
    background-color: #f9fafb;
    padding: 25px 0;
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
}

.stories-container {
    display: flex;
    align-items: center;
    overflow-x: auto;
    padding: 15px 10px;
    gap: 20px;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.stories-container::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.story-item {
    flex: 0 0 auto;
    width: 85px;
    height: 105px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.story-item:hover {
    transform: translateY(-5px);
}

.story-item .story-image {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e5e7eb;
    transition: all 0.3s ease;
    margin-bottom: 8px;
}

.story-item:hover .story-image {
    border: 3px solid #E31B23;
    box-shadow: 0 8px 20px rgba(227, 27, 35, 0.3);
    transform: scale(1.05);
}

.story-item .story-title {
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: #1f2937;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    line-height: 1.2;
}

.story-item .story-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(0,0,0,0) 0%, rgba(0,0,0,0.2) 100%);
    border-radius: 50%;
    pointer-events: none;
}

.story-item .story-border {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #E31B23, #B71419, #E31B23, #B71419);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.story-item:hover .story-border {
    opacity: 1;
}

/* Add ring effect for visual enhancement */
.story-item::before {
    content: '';
    position: absolute;
    width: 78px;
    height: 78px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(45deg, #E31B23, #B71419) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
    top: -5px;
    left: -5px;
}

/* Story Modal Styles */
.story-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.story-modal.open {
    opacity: 1;
    visibility: visible;
}

.story-modal-content {
    position: relative;
    width: 90%;
    max-width: 500px;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.story-modal.open .story-modal-content {
    transform: scale(1);
}

.story-modal-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
}

.story-modal-info {
    padding: 25px;
    background: #ffffff;
}

.story-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: #1f2937;
    text-align: center;
}

.story-modal-description {
    color: #4b5563;
    margin-bottom: 20px;
    line-height: 1.6;
    text-align: center;
    font-size: 1rem;
}

.story-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.story-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    background: rgba(227, 27, 35, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    transition: all 0.3s ease;
}

.story-modal-close:hover {
    background: rgba(183, 20, 25, 1);
    transform: scale(1.1);
}

/* Social Media Style Story Modal */
.social-story-modal .social-story-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.social-story-modal.open .social-story-overlay {
    opacity: 1;
    visibility: visible;
}

.social-story-modal .story-progress-container {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
    z-index: 1002;
}

.story-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 2px;
    overflow: hidden;
}

.story-progress-bar.active {
    background: rgba(255, 255, 255, 0.8);
}

.story-progress-bar.completed {
    background: white;
}

.story-progress {
    height: 100%;
    width: 0%;
    background: white;
    transition: width 5s linear;
}

.social-story-modal .social-story-content {
    position: relative;
    height: min(80vh, 720px);
    aspect-ratio: 9 / 16;
    max-width: 420px;
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.social-story-modal.open .social-story-content {
    transform: scale(1);
}

.social-story-modal .story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1002;
}

.social-story-modal .story-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.social-story-modal .story-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(45deg, #E31B23, #B71419);
    border: 2px solid white;
}

.social-story-modal .story-username {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.social-story-modal .story-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-story-modal .story-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.social-story-modal .story-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.social-story-modal .social-story-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
}

.social-story-modal .social-story-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    width: auto;
    height: auto;
}

.social-story-modal .story-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent);
    color: white;
    z-index: 1002;
}

.social-story-modal .story-footer-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: white;
}

.social-story-modal .story-footer-description {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.4;
}

.social-story-modal .social-story-content .story-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 8px 20px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111827;
    z-index: 1003;
    cursor: pointer;
    transition: all 0.2s ease;
}
.social-story-modal .social-story-content .story-arrow:hover {
    background: #E31B23;
    color: white;
    transform: translateY(-50%) scale(1.05);
}
.social-story-modal .social-story-content .story-arrow.prev { left: -56px; }
.social-story-modal .social-story-content .story-arrow.next { right: -56px; }

@media (max-width: 768px) {
    .social-story-modal .social-story-content {
        height: 80vh;
        max-width: 370px;
        border-radius: 20px;
    }
    .social-story-modal .social-story-content .story-arrow {
        display: none;
    }
}

/* Navigation buttons for stories container */
.stories-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
}

.stories-nav-btn:hover {
    background: #E31B23;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.stories-nav-btn.prev {
    left: 10px;
}

.stories-nav-btn.next {
    right: 10px;
}

/* Responsive design */
@media (max-width: 768px) {
    .story-item {
        width: 70px;
        height: 90px;
    }
    
    .story-item .story-image {
        width: 70px;
        height: 70px;
    }
    
    .story-item .story-title {
        font-size: 0.65rem;
        max-width: 70px;
    }
    
    .story-modal-image {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .story-item {
        width: 60px;
        height: 80px;
    }
    
    .story-item .story-image {
        width: 60px;
        height: 60px;
    }
    
    .story-item .story-title {
        font-size: 0.6rem;
        max-width: 60px;
    }
    
    .story-modal-image {
        height: 250px;
    }
    
    .stories-nav-btn {
        display: none;
    }
}

/* Loading animation for images */
.story-image.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Story item with gradient border */
.story-item.gradient-border .story-image {
    border: 3px solid transparent;
    background: linear-gradient(white, white) padding-box, 
                linear-gradient(45deg, #E31B23, #B71419) border-box;
    border: 3px solid transparent;
    background-clip: padding-box, border-box;
}
