/**
 * News Slider Magazine Component - High Performance News Carousel & Side Tabs
 */

.news-slider-mag-wrapper {
    position: relative;
    margin-bottom: 1.25rem;
}

/* =========================================
   ROW & COLUMN LAYOUT (EQUAL HEIGHT)
   ========================================= */
.news-slider-mag-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
}

.news-slider-mag-row>.col {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    align-self: flex-start !important;
}

@media (min-width: 769px) {
    .news-slider-mag-row {
        align-items: flex-start !important;
    }

    .news-slider-mag-row>.col {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        align-self: flex-start !important;
    }

    .news-slider-mag-left {
        height: auto !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-self: flex-start !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
    }

    .news-slider-main-box {
        flex: 0 0 auto !important;
        margin: 0 !important;
    }

    .news-slider-pager-bar {
        flex: 0 0 auto !important;
        margin: 0 !important;
    }

    .news-slider-mag-right {
        background: #ffffff;
        border: 1px solid #e2e8f0;
        border-radius: 4px;
        padding: 14px 16px;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        align-self: flex-start !important;
        position: relative !important;
    }

    .news-slider-right-header {
        flex: 0 0 auto !important;
        margin-bottom: 12px !important;
    }

    .news-slider-right-body {
        flex: 1 1 0% !important;
        min-height: 0 !important;
        height: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .news-slider-right-panel {
        display: none;
        box-sizing: border-box !important;
    }

    .news-slider-right-panel.active {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 0% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* =========================================
   LEFT SECTION: Fade Slider
   ========================================= */
.news-slider-main-box {
    position: relative;
    border-radius: 4px 4px 0 0;
    overflow: hidden;
    background-color: #f8fafc !important;
    width: 100%;
}

.news-slider-fade-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Inactive slides are absolute with opacity 0 */
.news-slider-slide-item {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.45s ease !important;
    z-index: 1 !important;
    background-color: #f8fafc !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* The active slide has position: relative to set container height naturally in document flow */
.news-slider-slide-item.active {
    position: relative !important;
    height: auto !important;
    min-height: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 2 !important;
}

.news-slider-slide-thumb {
    position: relative !important;
    width: 100% !important;
    display: block !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    background-color: #f8fafc !important;
}

.news-slider-slide-thumb .image-cover {
    position: relative !important;
    width: 100% !important;
    height: 0 !important;
    margin: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    overflow: hidden !important;
    background-color: #f1f5f9 !important;
}

/* Auto fill entire area with object-fit: cover */
.news-slider-slide-thumb img,
.news-slider-slide-thumb .image-cover img,
.news-slider-img,
.image-cover img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

/* Prev / Next Slide Nav Arrows */
.news-slider-arrow {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 38px !important;
    height: 48px !important;
    border-radius: 4px !important;
    background: rgba(0, 0, 0, 0.45) !important;
    color: #fff !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 0.8 !important;
    transition: all 0.25s ease !important;
    z-index: 10 !important;
    padding: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

.news-slider-arrow:hover {
    background: rgba(0, 0, 0, 0.75) !important;
    opacity: 1 !important;
}

.news-slider-arrow svg {
    width: 18px !important;
    height: 18px !important;
    fill: #ffffff !important;
    pointer-events: none !important;
}

.news-slider-arrow.prev {
    left: 10px !important;
}

.news-slider-arrow.next {
    right: 10px !important;
}

.news-slider-arrow.slider-nav-circle {
    width: 42px !important;
    height: 42px !important;
    border-radius: 50% !important;
}

/* =========================================
   BOTTOM HEADLINE PAGER BAR & TOOLTIP
   ========================================= */
.news-slider-pager-bar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 4px 4px;
    flex: 0 0 auto !important;
    position: relative !important;
    overflow: visible !important;
    /* Crucial: allows tooltip bubble to float cleanly above */
}

.news-slider-pager-item {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 12px;
    border-right: 1px solid #edf2f7;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s ease;
    user-select: none;
    background: #ffffff;
    position: relative;
}

.news-slider-pager-item:last-child {
    border-right: none;
}

.news-slider-pager-item:hover {
    background: #f8fafc;
}

.news-slider-pager-title {
    margin: 0 !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: #334155 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.news-slider-pager-item:hover .news-slider-pager-title {
    color: var(--news-slider-accent, var(--fs-color-primary, #446084)) !important;
}

.news-slider-pager-item.active {
    background: #f8fafc;
    border-bottom-color: var(--news-slider-accent, var(--fs-color-primary, #446084));
}

.news-slider-pager-item.active .news-slider-pager-title {
    color: var(--news-slider-accent, var(--fs-color-primary, #446084)) !important;
    font-weight: 700 !important;
}

/* Floating Tooltip Bubble (matches giaophanvinh.com) */
.news-slider-pager-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #ffffff;
    color: #0f172a;
    padding: 7px 15px;
    border-radius: 20px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.35;
    white-space: normal;
    width: max-content;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 25px -4px rgba(0, 0, 0, 0.14), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(226, 232, 240, 0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s cubic-bezier(0.4, 0, 0.2, 1), transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.22s ease;
    z-index: 100;
}

.news-slider-pager-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

.news-slider-pager-item:hover .news-slider-pager-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip boundary protections for first and last tab */
.news-slider-pager-item:first-child .news-slider-pager-tooltip {
    left: 10px;
    transform: translateY(6px);
}

.news-slider-pager-item:first-child:hover .news-slider-pager-tooltip {
    transform: translateY(0);
}

.news-slider-pager-item:first-child .news-slider-pager-tooltip::after {
    left: 28px;
    transform: none;
}

.news-slider-pager-item:last-child .news-slider-pager-tooltip {
    left: auto;
    right: 10px;
    transform: translateY(6px);
}

.news-slider-pager-item:last-child:hover .news-slider-pager-tooltip {
    transform: translateY(0);
}

.news-slider-pager-item:last-child .news-slider-pager-tooltip::after {
    left: auto;
    right: 28px;
    transform: none;
}

/* =========================================
   RIGHT SECTION: Dual Tabs & Vertical News List
   ========================================= */
.news-slider-mag-right {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 14px 16px;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
}

/* Tabs Header */
.news-slider-right-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-around !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 12px !important;
    padding-bottom: 0 !important;
    flex: 0 0 auto !important;
}

.news-slider-right-tab-btn {
    background: none !important;
    border: none !important;
    padding: 0px 6px 0px 6px !important;
    font-family: inherit !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    color: #64748b !important;
    cursor: pointer !important;
    border-bottom: 3px solid transparent !important;
    margin-bottom: -1px !important;
    transition: color 0.2s ease, border-color 0.2s ease !important;
    outline: none !important;
    box-shadow: none !important;
}

.news-slider-right-tab-btn:hover {
    color: var(--news-slider-accent, var(--fs-color-primary, #446084)) !important;
}

.news-slider-right-tab-btn.active {
    color: var(--news-slider-accent, var(--fs-color-primary, #446084)) !important;
    border-bottom-color: var(--news-slider-accent, var(--fs-color-primary, #446084)) !important;
    cursor: default !important;
}

/* Right Content & Custom Scrollbar */
.news-slider-right-body {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
}

.news-slider-right-panel {
    display: none;
    box-sizing: border-box !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 6px;
}

.news-slider-right-panel.active {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
}

.news-slider-right-panel::-webkit-scrollbar {
    width: 4px;
}

.news-slider-right-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 2px;
}

.news-slider-right-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.news-slider-right-panel::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Right List Items */
.news-slider-right-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 0px solid #f1f5f9;
}

.news-slider-right-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.news-slider-right-thumb {
    flex: 0 0 var(--news-slider-thumb-w, 80px) !important;
    width: var(--news-slider-thumb-w, 80px) !important;
    height: var(--news-slider-thumb-h, 54px) !important;
    border-radius: var(--news-slider-thumb-r, 3px) !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.news-slider-right-thumb a {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: inherit !important;
}

.news-slider-right-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: var(--news-slider-thumb-r, 3px) !important;
    display: block !important;
    transition: transform 0.3s ease !important;
}

.news-slider-right-thumb .no-thumb-placeholder {
    width: 100% !important;
    height: 100% !important;
    border-radius: var(--news-slider-thumb-r, 3px) !important;
    background: #e2e8f0 !important;
}

.news-slider-right-item:hover .news-slider-right-thumb img {
    transform: scale(1.07) !important;
}

.news-slider-right-content {
    flex: 1;
    min-width: 0;
}

.news-slider-right-title {
    margin: 0 !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
}

.news-slider-right-title a {
    color: #1e293b !important;
    text-decoration: none !important;
    transition: color 0.2s ease !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-slider-right-title a:hover {
    color: var(--news-slider-accent, var(--fs-color-primary, #446084)) !important;
}

/* Mobile & Tablet */
@media (max-width: 768px) {
    .news-slider-pager-bar {
        grid-auto-flow: initial;
        grid-auto-columns: initial;
        display: flex;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .news-slider-pager-bar::-webkit-scrollbar {
        display: none;
    }

    .news-slider-pager-item {
        flex: 0 0 200px;
        min-width: 180px;
        padding: 8px 10px;
        text-align: left;
    }

    /* On mobile, tooltips are hidden to avoid blocking the viewport */
    .news-slider-pager-tooltip {
        display: none !important;
    }

    .news-slider-mag-right {
        margin-top: 20px;
        height: auto !important;
        max-height: none !important;
    }

    .news-slider-right-panel {
        max-height: 380px !important;
        height: auto !important;
    }
}