/**
 * Web Stories Stylesheet
 * Responsive, Light & Dark Mode Compatible
 */

/* ==========================================================================
   Web Story Section Wrapper
   ========================================================================== */
.webstory-section-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 25px;
}

/* ==========================================================================
   Web Story Cards Carousel
   ========================================================================== */
.webstory-carousel-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.webstory-cards-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 4px 16px 4px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.webstory-cards-track::-webkit-scrollbar {
    display: none;
}

/* Story Card Item */
.ws-story-card {
    flex: 0 0 168px;
    width: 168px;
    height: 275px;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}

.ws-card-inner {
    width: 100%;
    height: 100%;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.ws-story-card:hover {
    transform: translateY(-4px);
}

.ws-story-card:hover .ws-card-inner {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.ws-story-card:hover .ws-card-bg-img {
    transform: scale(1.06);
}

.ws-card-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Right Badge (Multi-layer story icon) */
.ws-card-badge {
    position: absolute;
    top: 9px;
    right: 9px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.58);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Dark Bottom Gradient for Text Legibility */
.ws-card-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.72) 45%, rgba(0, 0, 0, 0) 100%);
    z-index: 2;
    pointer-events: none;
}

.ws-card-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 10px;
    z-index: 3;
}

.ws-card-title {
    font-size: 13.5px;
    line-height: 1.4;
    font-weight: 600;
    color: #ffffff !important;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
}

/* Carousel Prev/Next Navigation Arrows */
.ws-carousel-nav {
    position: absolute;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    color: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.ws-carousel-prev {
    left: -16px;
}

.ws-carousel-next {
    right: -16px;
}

.ws-carousel-nav:hover {
    background: #DF2027;
    color: #ffffff;
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.ws-carousel-nav:disabled {
    opacity: 0;
    pointer-events: none;
}

.ws-no-stories-notice {
    padding: 24px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    width: 100%;
    text-align: center;
    color: #64748b;
    font-size: 14px;
}

/* ==========================================================================
   Full Screen Web Story Modal
   ========================================================================== */
.ws-modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #000000;
}

/* Ambient Blurred Backdrop */
.ws-modal-ambient-bg {
    position: absolute;
    inset: -50px;
    background-size: cover;
    background-position: center;
    filter: blur(55px) brightness(0.65) saturate(1.35);
    transform: scale(1.15);
    transition: background-image 0.4s ease;
    z-index: 1;
}

.ws-modal-backdrop-tint {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0.78) 100%);
    z-index: 2;
}

/* Modal Inner Container */
.ws-modal-container {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    gap: 30px;
    padding: 15px;
}

/* Desktop Side Navigation Buttons (< and >) */
.ws-side-nav-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #1e293b;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
    flex-shrink: 0;
}

.ws-side-nav-btn:hover {
    background: #ffffff;
    transform: scale(1.12);
    color: #000000;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}

.ws-side-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
}

/* Story Player Vertical Card (9:16 aspect ratio) */
.ws-modal-player {
    width: 100%;
    max-width: 410px;
    height: 90vh;
    max-height: 720px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    background: #000000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Toast Message */
.ws-share-toast {
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    color: #ffffff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 50;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

/* Segmented Progress Bars at Top */
.ws-progress-bars {
    position: absolute;
    top: 12px;
    left: 14px;
    right: 14px;
    display: flex;
    gap: 5px;
    z-index: 35;
}

.ws-progress-item {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.38);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.ws-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0%;
    background: #ffffff;
    border-radius: 3px;
}

/* Player Header (Circular Favicon & Action Controls) */
.ws-player-header {
    position: absolute;
    top: 24px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 35;
}

.ws-publisher-info {
    display: flex;
    align-items: center;
}

/* Favicon in white circular badge with border */
.ws-publisher-favicon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 3px;
    box-sizing: border-box;
}

.ws-publisher-favicon {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain;
    display: block;
}

.ws-player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ws-control-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.48);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.ws-control-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.08);
}

/* Slide Viewport */
.ws-slide-viewport {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 5;
    background: #000;
}

.ws-active-slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
    opacity: 1;
    transition: opacity 0.2s ease-in-out;
}

/* Tap Zones */
.ws-tap-zone {
    position: absolute;
    top: 65px;
    bottom: 120px;
    z-index: 25;
    cursor: pointer;
}

.ws-tap-left {
    left: 0;
    width: 35%;
}

.ws-tap-right {
    right: 0;
    width: 65%;
}

/* Bottom Caption Container */
.ws-caption-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 18px 24px 18px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.94) 0%, rgba(0, 0, 0, 0.78) 60%, rgba(0, 0, 0, 0) 100%);
    z-index: 30;
    pointer-events: none;
}

/* Golden Accent Line */
.ws-caption-divider {
    width: 70px;
    height: 3px;
    background: #f59e0b;
    border-radius: 2px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.5);
}

/* Bengali Caption Text */
.ws-caption-text {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.1px;
}

.ws-caption-text.ws-caption-animating {
    opacity: 0;
    transform: translateY(8px);
}

/* Read More Button */
.ws-read-more-btn {
    pointer-events: auto;
    margin-top: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    color: #ffffff !important;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.35);
    transition: all 0.2s ease;
}

.ws-read-more-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #ffffff !important;
    text-decoration: none;
    transform: translateY(-1px);
}

/* ==========================================================================
   Mobile & Responsive Adjustments
   ========================================================================== */
@media (max-width: 768px) {
    .ws-story-card {
        flex: 0 0 145px;
        width: 145px;
        height: 240px;
    }

    .ws-card-title {
        font-size: 12.5px;
    }

    .ws-carousel-nav {
        display: none;
    }

    .ws-modal-container {
        padding: 0;
        gap: 0;
    }

    .ws-side-nav-btn {
        display: none;
    }

    .ws-modal-player {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }

    .ws-caption-text {
        font-size: 15px;
    }
}

/* ==========================================================================
   Dark Mode Overrides
   ========================================================================== */
body.dark-mode .ws-carousel-nav,
html.dark .ws-carousel-nav {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .ws-carousel-nav:hover,
html.dark .ws-carousel-nav:hover {
    background: #DF2027;
    color: #ffffff;
}

body.dark-mode .ws-card-inner,
html.dark .ws-card-inner {
    border: 1px solid rgba(255, 255, 255, 0.08);
}
