/**
 * @Project NSSV3 - Sài Gòn Giải Trí Editorial Theme
 * @Module news
 * @Description Supplementary styles for module news & Homepage Editorial Blocks (DESIGN_SYSTEM.md)
 */

/* ==========================================================================
   1. Voice Player Autoplay Toggle & Dropdown (detail.tpl)
   ========================================================================== */
.news-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 34px;
    height: 18px;
    border-radius: 9999px;
    background-color: var(--border-dashed, #dcdcdc);
    cursor: pointer;
    transition: background-color 0.2s ease;
    vertical-align: middle;
}

.news-switch .news-switch-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 9999px;
    background-color: var(--text-inverse, #ffffff);
    transition: transform 0.2s ease;
}

.news-switch.checked {
    background-color: var(--color-primary, #eba222);
}

.news-switch.checked .news-switch-slider {
    transform: translateX(16px);
}

.voice-dropdown {
    position: relative;
    display: inline-block;
}

.voice-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    min-width: 160px;
    background-color: var(--bg-body, #ffffff);
    border: 1px solid var(--border-light, #e5e5e5);
    border-radius: var(--radius-card, 4px);
    padding: 4px 0;
    z-index: 40;
    list-style: none;
    margin: 0;
}

.voice-dropdown.open .voice-dropdown-menu {
    display: block;
}

/* ==========================================================================
   2. Hero Spotlight Block (block_newscenter.tpl)
   ========================================================================== */
.editorial-hero-others:empty {
    display: none;
}

.editorial-hero-quickfeed.is-populated {
    display: flex !important;
}

.editorial-hero-quickfeed [data-hero-quicklist] .editorial-hero-other-thumb {
    display: none !important;
}

.editorial-hero-quickfeed [data-hero-quicklist] > li {
    padding-top: 10px;
    padding-bottom: 10px;
}

.editorial-hero-quickfeed [data-hero-quicklist] > li:first-child {
    padding-top: 4px;
}

.editorial-hero-quickfeed [data-hero-quicklist] > li:last-child {
    padding-bottom: 0;
}

.editorial-hero-quickfeed [data-hero-quicklist] .editorial-hero-other-title {
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.42;
}

.editorial-hero-quickfeed [data-hero-quicklist] .editorial-hero-other-title a {
    color: var(--text-primary, #222222);
}

.editorial-hero-quickfeed [data-hero-quicklist] .editorial-hero-other-title a:hover {
    color: var(--color-primary-dark, #af7011);
}

/* Fallback if >3 items remain inside [data-hero-subcards] (mobile / tablet or when [LEFT] slot is used) */
.editorial-hero-others > .editorial-hero-other-item:nth-child(n+4) .editorial-hero-other-thumb {
    display: none;
}

.editorial-hero-others > .editorial-hero-other-item:nth-child(n+4) {
    border-top: 1px dashed var(--border-dashed, #dcdcdc);
    padding-top: 10px;
}

.editorial-hero-others > .editorial-hero-other-item:nth-child(n+4) .editorial-hero-other-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.44;
    position: relative;
    padding-left: 13px;
}

.editorial-hero-others > .editorial-hero-other-item:nth-child(n+4) .editorial-hero-other-title::before {
    content: "";
    position: absolute;
    left: 0;
    top: 7px;
    width: 5px;
    height: 5px;
    border-radius: 9999px;
    background-color: var(--color-primary, #eba222);
}

/* ==========================================================================
   3. Horizontal Category / Multimedia Slider (block_cat_slider.tpl)
   ========================================================================== */
.cat-slider-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 9999px;
    background-color: var(--border-dashed, #dcdcdc);
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.cat-slider-dot:hover {
    background-color: var(--text-subtle, #888888);
}

.cat-slider-dot.is-active {
    width: 20px;
    background-color: var(--color-primary, #eba222);
}

/* Compact vertical/Zoom card proportions when slider is placed inside [RIGHT] / [LEFT] sidebar */
aside .news_slider {
    margin-top: 0;
    margin-bottom: 0;
}

aside .news_slider [data-slider-item] {
    width: 168px;
}

/* Avoid double grey box if admin wraps block_cat_slider inside block.primary.tpl */
.editorial-block-body > .news_slider {
    padding: 0;
    margin: 0;
    background-color: transparent;
}

/* ==========================================================================
   4. Ranked TopHits List (block_tophits.tpl)
   ========================================================================== */
.editorial-tophits-list {
    counter-reset: tophits-counter;
}

.editorial-tophits-item {
    counter-increment: tophits-counter;
}

.editorial-tophits-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border-radius: 4px;
    background-color: var(--bg-pill, #f0f2f5);
    color: var(--text-muted, #666666);
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.editorial-tophits-rank::before {
    content: counter(tophits-counter);
}

.editorial-tophits-item:nth-child(-n+3) .editorial-tophits-rank {
    background-color: var(--color-primary, #eba222);
    color: var(--text-primary, #222222);
}

.editorial-tophits-item:nth-child(1) a {
    font-weight: 700;
}

/* ==========================================================================
   5. 4-Column Category Grids (block_news_each_cat.tpl & block_news_multicat_list.tpl)
   ========================================================================== */
.editorial-each-cat-item:first-child {
    padding-bottom: 10px;
}

.editorial-each-cat-item:first-child .editorial-each-cat-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.38;
    color: var(--text-primary, #222222);
}

.editorial-each-cat-item:not(:first-child) {
    border-top: 1px dashed var(--border-dashed, #dcdcdc);
    padding-top: 10px;
    padding-bottom: 10px;
}

.editorial-each-cat-item:last-child {
    padding-bottom: 0;
}

.editorial-each-cat-item:not(:first-child) .editorial-each-cat-thumb {
    display: none;
}

.editorial-each-cat-item:not(:first-child) .editorial-each-cat-title {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.45;
}

.editorial-each-cat-item:not(:first-child) .editorial-each-cat-title a {
    color: var(--text-secondary, #444444);
}

.editorial-each-cat-item:not(:first-child) .editorial-each-cat-title a:hover {
    color: var(--color-primary-dark, #af7011);
}

.editorial-multicat-item:first-child h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary, #222222);
}

.editorial-multicat-item:not(:first-child) h4 {
    font-size: 14px;
    font-weight: 400;
}

.editorial-multicat-item:not(:first-child) h4 a {
    color: var(--text-secondary, #444444);
}

.editorial-multicat-item:not(:first-child) h4 a:hover {
    color: var(--color-primary-dark, #af7011);
}

/* ==========================================================================
   6. Category Tabs & Headline Tabs/Slider (block_news_cattab.tpl, block_headline.tpl)
   ========================================================================== */
#topnews {
    display: none;
}

.editorial-cattab-nav li.active > a,
.editorial-cattab-nav a.is-active,
.editorial-headline-tabs li.active > a,
.editorial-headline-tabs a.is-active {
    color: var(--text-primary, #222222);
    border-bottom-color: var(--color-primary, #eba222);
    font-weight: 700;
}

.editorial-cattab-pane {
    display: none;
}

.editorial-cattab-pane.active {
    display: block;
}

@media (min-width: 768px) {
    .editorial-cattab-grid > .editorial-cattab-item:first-child {
        grid-row: span 3;
        flex-direction: column;
        border-bottom: 0;
        padding-bottom: 0;
        padding-right: 16px;
        border-right: 1px solid var(--border-light, #e5e5e5);
    }

    .editorial-cattab-grid > .editorial-cattab-item:first-child .editorial-cattab-thumb {
        width: 100%;
        margin-bottom: 8px;
    }

    .editorial-cattab-grid > .editorial-cattab-item:first-child .editorial-cattab-title {
        font-size: 17px;
        line-height: 1.38;
    }

    .editorial-cattab-grid > .editorial-cattab-item:not(:first-child) .editorial-cattab-sapo {
        display: none;
    }
}

#topnews .contentdiv {
    display: none;
}

#topnews .contentdiv.is-active {
    display: block;
}

#paginate-slider1 a.toc {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 9999px;
    background-color: var(--border-dashed, #dcdcdc);
    text-indent: -9999px;
    overflow: hidden;
    transition: width 0.25s ease, background-color 0.25s ease;
}

#paginate-slider1 a.toc.selected {
    width: 20px;
    background-color: var(--color-primary, #eba222);
}

/* ==========================================================================
   7. Collapsible File Preview & Star Rating Alignment (detail.tpl)
   ========================================================================== */
.news-file-collapse {
    display: none;
}

.news-file-collapse.in,
.news-file-collapse.show {
    display: block;
}

.editorial-rating-stars .star-rating-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    vertical-align: middle;
}

.editorial-admin-links {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    line-height: 1.4;
}

.editorial-admin-links .dropdown-divider {
    display: inline-block;
    width: 1px;
    height: 11px;
    background-color: var(--border-light, #e5e5e5);
    margin: 0 2px;
    vertical-align: middle;
}

.editorial-admin-links a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary-dark, #af7011);
    background-color: rgba(235, 162, 34, 0.1);
    border: 1px solid rgba(235, 162, 34, 0.3);
    border-radius: 4px;
    padding: 1px 7px;
    transition: all 0.15s ease;
}

.editorial-admin-links a:hover {
    color: #ffffff;
    background-color: var(--color-primary-dark, #af7011);
    border-color: var(--color-primary-dark, #af7011);
}

/* ==========================================================================
   8. Print View Rules (print.tpl)
   ========================================================================== */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background-color: var(--bg-body, #ffffff) !important;
        color: var(--text-primary, #222222) !important;
    }
}
