/* Stories Component - Modern Design */
.stories-container {
    padding: 30px 0;
    background: #222;
    overflow: hidden;
    user-select: none;
    color: #fff;
}

.stories-carousel {
    padding: 10px 0px;
}

.stories-wrapper-layout {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.stories-carousel-list {
    flex: 1;
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.stories-carousel-list::-webkit-scrollbar {
    height: 8px;
}

.stories-carousel-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.stories-carousel-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.story-description-panel {
    width: 320px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.story-desc-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.story-desc-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.story-desc-username {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.story-desc-content {
    font-size: 13px;
    line-height: 1.5;
    color: #ccc;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

@media (max-width: 900px) {
    .stories-wrapper-layout {
        display: block;
        /* Stack everything */
    }

    .story-description-panel {
        display: none !important;
        /* Hide description on mobile as requested */
    }

    .stories-carousel-list {
        width: 100vw;
        margin-left: -20px;
        /* Counteract page padding if necessary */
        padding-left: 20px;
        padding-right: 20px;
    }
}

.story-item {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    width: 140px;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s;
    background: #222;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

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

.story-preview-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

.story-preview-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s;
}

.story-item.playing .story-preview-video {
    opacity: 1;
}

.story-overlay-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 3;
}

.story-label {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 5px;
}

/* Story Viewer (Fullscreen Modal) */
.story-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.story-viewer.active {
    display: flex;
}

.story-modal {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    position: relative;
    background: #111;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
}

.story-modal-inner {
    display: flex;
    width: 100%;
    height: 100%;
}

.story-video-area {
    flex: 1;
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-modal-sidebar {
    width: 320px;
    background: #1a1a1a;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    padding: 30px;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.sidebar-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid #444;
}

.sidebar-info {
    display: flex;
    flex-direction: column;
}

.sidebar-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
}

.sidebar-time {
    font-size: 12px;
    color: #888;
}

.sidebar-description {
    font-size: 13.5px;
    line-height: 1.6;
    color: #ddd;
    overflow-y: auto;
    flex: 1;
    margin-bottom: 20px;
    padding-right: 10px;
}

.sidebar-description::-webkit-scrollbar {
    width: 4px;
}

.sidebar-description::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

.sidebar-metrics {
    display: flex;
    gap: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #eee;
}

.metric-item i {
    color: #ff3040;
}

.metric-item i.fa-comment {
    color: #3b82f6;
}

.sidebar-ig-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fff;
    color: #000;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: transform 0.2s, background 0.2s;
    margin-top: 10px;
}

.sidebar-ig-link:hover {
    background: #eee;
    transform: translateY(-2px);
}

.sidebar-ig-link i {
    font-size: 18px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 900px) {
    .story-modal {
        max-width: 450px;
    }

    .story-modal-sidebar {
        display: none;
    }
}

@media (max-width: 600px) {
    .story-modal {
        height: 100%;
        border-radius: 0;
        max-width: 100%;
    }
}

/* Progress Bars */
.story-progress-container {
    position: absolute;
    top: 15px;
    left: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

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

.story-progress-fill {
    height: 100%;
    background: #fff;
    width: 0%;
}

/* Story Header */
.story-modal-header {
    position: absolute;
    top: 30px;
    left: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.story-modal-header img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #fff;
}

.story-modal-header .info {
    display: flex;
    flex-direction: column;
}

.story-modal-header .name {
    font-size: 14px;
    font-weight: 700;
}

.story-modal-header .time {
    font-size: 12px;
    opacity: 0.8;
}

.story-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.story-mute-btn,
.story-modal-close {
    font-size: 22px;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 50%;
    transition: background 0.2s;
}

.story-mute-btn:hover,
.story-modal-close:hover {
    background: rgba(0, 0, 0, 0.5);
}

/* Story Content */
.story-content-main {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000;
}

.story-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: story-spin 1s linear infinite;
    z-index: 5;
    display: none;
}

@keyframes story-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.story-content-main img,
.story-content-main video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Navigation Buttons */
.story-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    z-index: 100;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.story-nav-prev {
    left: 20px;
}

.story-nav-next {
    right: 20px;
}

@media (max-width: 600px) {
    .story-nav {
        background: none;
        border: none;
        font-size: 24px;
        width: 60px;
        height: 60px;
    }
}

/* Story Footer */
.story-modal-footer {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    z-index: 10;
}

.story-link-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 25px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    transition: background 0.2s;
}

.story-link-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}