/**
 * News Ticker 02 — Thanh tin chạy (Breaking News)
 */

.nt02-bar {
    display: grid;
    grid-template-columns: var(--nt02-left, 12%) minmax(0, 1fr) var(--nt02-right, 18%);
    align-items: center;
    width: 100%;
    min-height: var(--nt02-height, 48px);
    padding: var(--nt02-pad, 8px) 12px;
    /* Fluid Typography: Tự động co giãn theo viewport, giới hạn bởi min (mob) và max (desktop) */
    font-size: clamp(var(--nt02-font-mob, 12px), 1vw + 8px, var(--nt02-font, 14px));
    line-height: 1.35;
    box-sizing: border-box;
    gap: 0;
    overflow: hidden;
    background: var(--nt02-bar-bg, #f7f7f7);
    border-bottom: 1px solid var(--nt02-bar-border, #e8e8e8);
    isolation: isolate;
    margin-bottom: var(--nt02-mb, 0);
}

.nt02-bar.nt02-no-left {
    grid-template-columns: minmax(0, 1fr) var(--nt02-right, 18%);
}

.nt02-bar.nt02-no-right {
    grid-template-columns: var(--nt02-left, 12%) minmax(0, 1fr);
}

.nt02-bar.nt02-no-left.nt02-no-right {
    grid-template-columns: minmax(0, 1fr);
}

.nt02-col {
    display: flex;
    align-items: center;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
}

.nt02-left {
    justify-content: center;
    padding-right: 10px;
    border-right: 1px solid var(--nt02-divider, rgba(0, 0, 0, 0.08));
    flex-shrink: 0;
}

.nt02-center {
    overflow: hidden;
    padding: 0 10px;
    min-width: 0;
    position: relative;
}

.nt02-right {
    justify-content: flex-end;
    padding-left: 10px;
    border-left: 1px solid var(--nt02-divider, rgba(0, 0, 0, 0.08));
    flex-shrink: 0;
    overflow: hidden;
    max-width: 100%;
}

.nt02-left-inner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    white-space: nowrap;
    font-weight: 700;
    color: var(--nt02-left-color, #ac1f24);
    text-align: center;
}

.nt02-left-icon .fa,
.nt02-left-icon .bf-icon {
    font-size: 1.15em;
    line-height: 1;
}

.nt02-left-text {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Marquee — hiệu ứng chạy chữ liên tục */
.nt02-marquee {
    width: 100%;
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}

.nt02-marquee-track {
    display: flex;
    width: max-content;
    will-change: transform;
    animation: nt02-marquee-scroll var(--nt02-duration, 40s) var(--nt02-easing, linear) infinite;
}

.nt02-pause-hover .nt02-marquee:hover .nt02-marquee-track {
    animation-play-state: paused;
}

@keyframes nt02-marquee-scroll {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

.nt02-marquee-group {
    display: inline-flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--nt02-gap, 16px);
    padding-right: var(--nt02-gap, 16px);
    flex-shrink: 0;
}

.nt02-label {
    display: inline-flex;
    flex-shrink: 0;
    max-width: var(--nt02-label-max, 280px);
    vertical-align: middle;
}

.nt02-label-link,
.nt02-label-text {
    display: block;
    max-width: 100%;
    padding: var(--nt02-label-pad, 8px) calc(var(--nt02-label-pad, 8px) + 6px);
    background: var(--nt02-label-bg, #ac1f24);
    color: var(--nt02-label-color, #fff);
    border-radius: var(--nt02-radius, 6px);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: inherit;
    line-height: 1.3;
    font-weight: 500;
}

.nt02-label-link:hover,
.nt02-label-link:focus {
    background: var(--nt02-label-hover-bg, #8a181d);
    color: var(--nt02-label-hover-color, #fff);
    text-decoration: none;
}

.nt02-label--border .nt02-label-link,
.nt02-label--border .nt02-label-text {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.nt02-label--shadow .nt02-label-link,
.nt02-label--shadow .nt02-label-text {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

/* Đồng hồ */
.nt02-clock {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.9em;
    color: var(--nt02-clock-color, #333);
    font-weight: 500;
}

.nt02-clock-icon {
    flex-shrink: 0;
}

.nt02-clock-icon .fa,
.nt02-clock-icon .bf-icon {
    font-size: 1em;
    opacity: 0.8;
}

.nt02-clock-time {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    min-width: 0;
}

/* Tablet */
@media (max-width: 991px) {
    .nt02-bar {
        min-height: var(--nt02-height-tab, 42px);
        padding: var(--nt02-pad-tab, 6px) 10px;
        /* Bỏ font-size tĩnh để nhường cho clamp() */
    }

    .nt02-label {
        max-width: min(var(--nt02-label-max, 280px), 220px);
    }
}

/* Mobile */
@media (max-width: 767px) {
    .nt02-bar {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto auto;
        min-height: var(--nt02-height-mob, 38px);
        padding: var(--nt02-pad-mob, 6px) 15px; /* Tăng padding x lên chút cho mobile breakout */
        /* Bỏ font-size tĩnh để nhường cho clamp() */
        row-gap: 4px;
        margin-bottom: var(--nt02-mb-mob, var(--nt02-mb, 0));
        /* Mobile Breakout: Ép full-width bất chấp container cha */
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .nt02-bar:not(.nt02-hide-left-mobile) {
        grid-template-columns: max-content minmax(0, 1fr);
        grid-template-rows: auto auto;
    }

    .nt02-bar.nt02-hide-left-mobile {
        grid-template-columns: minmax(0, 1fr);
    }

    .nt02-hide-left-mobile .nt02-left {
        display: none;
    }

    .nt02-hide-clock-mobile .nt02-right {
        display: none;
    }

    .nt02-left {
        grid-column: 1;
        grid-row: 1;
        border-right: 1px solid var(--nt02-divider, rgba(0, 0, 0, 0.08));
        border-bottom: none;
        padding-right: 8px;
    }

    .nt02-center {
        grid-column: 2;
        grid-row: 1;
        padding: 0 6px;
    }

    .nt02-bar.nt02-hide-left-mobile .nt02-center {
        grid-column: 1 / -1;
    }

    .nt02-right {
        grid-column: 1 / -1;
        grid-row: 2;
        border-left: none;
        border-top: 1px solid var(--nt02-divider, rgba(0, 0, 0, 0.06));
        padding: 4px 0 0;
        justify-content: center; /* Căn giữa timestamp container */
    }

    .nt02-right .nt02-clock {
        justify-content: center; /* Ép thẻ con căn giữa thật sự */
    }

    .nt02-label {
        max-width: min(var(--nt02-label-max, 280px), 180px);
    }

    .nt02-marquee {
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
        mask-image: linear-gradient(90deg, transparent 0, #000 8px, #000 calc(100% - 8px), transparent 100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nt02-marquee-track {
        animation: none;
        transform: none;
    }

    .nt02-marquee {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        mask-image: none;
        -webkit-mask-image: none;
    }
}


