/*
Theme Name: Tivi Việt Green
Description: Theme danh mục truyền hình và phát HLS cho VTV, HTV, HTVC và SCTV.
Version: 1.3.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: tiviviet-green
*/

:root {
    color-scheme: dark;
    --page: #101311;
    --panel: #191e1a;
    --tile: #1b211d;
    --line: #303a32;
    --text: #f0f5ef;
    --muted: #acbbb0;
    --green: #79c97e;
    --deep: #202923;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.wrap { width: min(1440px, 90%); margin-inline: auto; }
.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: 12px; top: 12px; transform: translateY(-160%); background: var(--panel); padding: 8px 12px; z-index: 100; }
.skip:focus { transform: none; }

.top { background: #111512; border-bottom: 1px solid var(--line); }
.top-inner { min-height: 65px; display: flex; align-items: center; gap: clamp(18px, 3.5vw, 45px); }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 850; font-size: 20px; letter-spacing: -.045em; min-width: 0; }
.brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; flex: none; border-radius: 9px; color: #102114; background: var(--green); }
.brand-mark .ico { width: 21px; height: 21px; }
.top nav { display: flex; flex: none; align-self: stretch; gap: clamp(12px, 2.2vw, 28px); font-size: 14px; font-weight: 650; color: var(--muted); }
.top nav a { display: flex; align-items: center; position: relative; white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current], .top-find:hover { color: var(--green); }
.top nav a[aria-current]::after { content: ""; position: absolute; height: 2px; background: var(--green); bottom: 0; inset-inline: 0; }
.top-find { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 5px; white-space: nowrap; color: var(--muted); font-size: 13px; }
.top-find .ico { width: 17px; height: 17px; }

.watch-head { padding: 24px 0 16px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .13em; margin: 0; }
.eyebrow span { color: var(--muted); padding-inline: 5px; }
.watch-head h1 { font-size: clamp(25px, 3.2vw, 42px); line-height: 1.1; letter-spacing: -.04em; margin: 6px 0; }
.summary { color: var(--muted); font-size: 14px; margin: 0; }
.watch-layout { display: grid; grid-template-columns: minmax(0, 2.7fr) minmax(260px, 1fr); gap: 13px; margin-bottom: 29px; }
.player, .schedule { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; overflow: hidden; min-width: 0; }
.player-screen { position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; isolation: isolate; background: #0d110e; }
.player-placeholder { padding: 12px; display: grid; justify-items: center; gap: 12px; text-align: center; }
.player-placeholder p { color: var(--muted); font-size: 14px; margin: 0; }
.player-logo { display: grid; place-items: center; width: clamp(94px, 16vw, 155px); height: auto; aspect-ratio: 1.72; border-radius: 11px; background: #f0f4ee; color: #102215; padding: 8px; }
.player-logo img { width: 100%; height: 100%; object-fit: contain; }
.player-logo .wordmark { font-weight: 850; font-size: 17px; }
.primary { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 0; border-radius: 7px; background: var(--green); color: #102114; font-weight: 850; }
.primary:hover { background: #b3f7a9; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #070a08; }
.player-bottom { min-height: 45px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 13px; font-size: 13px; }
.player-bottom p { margin: 0; color: var(--muted); }
.player-bottom a, .schedule-browse { display: inline-flex; align-items: center; gap: 5px; color: var(--green); white-space: nowrap; }
.player-bottom .ico, .schedule-browse .ico { width: 15px; height: 15px; }

.schedule { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
.schedule-heading { display: flex; align-items: center; gap: 10px; padding: 14px; background: #202823; border-bottom: 1px solid var(--line); }
.schedule-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #2d5033; color: var(--green); flex: none; }
.schedule-heading h2 { font-size: 16px; margin: 0; }
.schedule-heading p { margin: 1px 0 0; font-size: 12px; color: #c1d9c3; }
.schedule-date { display: flex; align-items: center; justify-content: space-between; padding: 9px 14px; margin: 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.schedule-date time { color: var(--green); font-weight: 700; }
.schedule-date span { color: var(--muted); font-size: 12px; }
.schedule-select { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 14px; color: var(--muted); font-size: 13px; }
.schedule-select select { font: inherit; color: var(--text); background: var(--tile); padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; }
.schedule-days { min-height: 0; grid-row: 3; }
.schedule-day { display: flex; flex-direction: column; height: 100%; }
.schedule-credit { margin: 0; padding: 7px 14px; font-size: 11px; color: var(--muted); }
.schedule-list li[data-current] { background: #233429; }
.schedule-list li[data-current] time { font-weight: 850; }
.schedule-list { list-style: none; margin: 0; padding: 0 14px; overflow: auto; scrollbar-width: thin; max-height: 350px; flex: 0 1 auto; }
.schedule-list li { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.schedule-list li time { color: var(--green); font-variant-numeric: tabular-nums; font-weight: 700; }
.schedule-empty { display: grid; justify-items: center; text-align: center; padding: 23px 15px; }
.schedule-empty p { font-size: 14px; margin: 7px 0 3px; font-weight: 750; }
.schedule-empty span { color: var(--muted); font-size: 13px; }
.schedule-browse { grid-row: 4; border-top: 1px solid var(--line); justify-content: space-between; padding: 10px 14px; font-size: 13px; font-weight: 650; }

.directory { scroll-margin-top: 14px; padding-bottom: 29px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.section-head h2 { margin: 2px 0 0; font-size: clamp(21px, 2.7vw, 30px); line-height: 1.1; letter-spacing: -.035em; }
.count { color: var(--green); background: var(--deep); border: 1px solid var(--line); border-radius: 5px; padding: 3px 9px; white-space: nowrap; font-size: 12px; font-weight: 700; }
.directory-tools { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 13px 0 17px; border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: clamp(13px, 2vw, 25px); align-self: stretch; }
.filters button { color: var(--muted); white-space: nowrap; background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 6px 0 9px; font-size: 14px; font-weight: 650; }
.filters button[aria-pressed=true] { border-color: var(--green); }
.filters button:hover, .filters button[aria-pressed=true] { color: var(--green); }
.search { display: flex; align-items: center; gap: 7px; border: 1px solid #46564a; border-radius: 5px; padding: 0 10px; width: min(245px, 45%); color: var(--muted); margin-bottom: 6px; }
.search .ico { width: 17px; height: 17px; }
.search input { min-width: 0; width: 100%; border: 0; padding: 6px 0; color: var(--text); background: transparent; outline: none; font-size: 13px; }
.search:focus-within { outline: 2px solid var(--green); outline-offset: 2px; }
.channel-section { scroll-margin-top: 14px; margin-top: 20px; }
.channel-section h3 { margin: 0 0 9px; font-size: 18px; }
.channel-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.card { position: relative; display: grid; place-items: center; align-content: center; gap: 5px; padding: 9px; border: 1px solid var(--line); background: var(--tile); border-radius: 8px; min-width: 0; min-height: 103px; text-align: center; }
.card:hover, .card[aria-current] { border-color: var(--green); background: #26342a; }
.card-logo { display: grid; place-items: center; width: 79px; max-width: 100%; height: 44px; background: #ecf2ec; border-radius: 6px; color: #14331b; padding: 4px; }
.card-logo img { width: 100%; height: 100%; object-fit: contain; }
.card-logo .wordmark { font-size: 10px; font-weight: 850; line-height: 1.1; }
.card-text { display: grid; min-width: 0; }
.card-text strong { font-size: 13px; line-height: 1.22; }
.card-text small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-marker { position: absolute; top: 6px; right: 7px; color: var(--green); }
.card-marker .ico { width: 14px; height: 14px; }
.empty { color: var(--muted); }
.article { padding-block: 12px 24px; }
.article a { text-decoration: underline; }
.footer { border-top: 1px solid var(--line); background: #131814; color: var(--muted); font-size: 14px; }
.footer-grid, .footer-policies { display: grid; gap: 24px 36px; padding-block: 26px; }
.footer-grid { grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); }
.footer-policies { grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.footer h2 { color: var(--text); font-size: 15px; line-height: 1.35; margin: 0 0 9px; }
.footer p { margin: 0; }
.footer-about .brand { display: inline-flex; max-width: 100%; color: var(--text); }
.footer-about p { max-width: 420px; margin-top: 11px; }
.footer-nav ul { list-style: none; margin: 0; padding: 0; }
.footer-nav li + li { margin-top: 5px; }
.footer a:hover, .footer a:focus-visible { color: var(--green); }
.footer-policies section { min-width: 0; scroll-margin-top: 18px; }
.footer-policies p + p { margin-top: 6px; }
.footer-email { display: inline-block; color: var(--green); overflow-wrap: anywhere; margin-top: 6px; text-decoration: underline; text-underline-offset: 3px; }
.footer-details { margin-top: 8px; }
.footer-details summary { cursor: pointer; color: var(--text); }
.footer-details ul { margin: 8px 0 0; padding-inline-start: 20px; }
.footer-details li + li { margin-top: 5px; }
.footer-bottom { border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-block: 13px 17px; font-size: 13px; }

@media (max-width: 1000px) {
    .channel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .watch-layout { grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); }
}
@media (max-width: 720px) {
    .wrap { width: calc(100% - 28px); }
    .top-inner { min-height: 55px; gap: 13px; }
    .brand { font-size: 16px; gap: 6px; }
    .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
    .brand-mark .ico { width: 17px; height: 17px; }
    .top nav { gap: 9px; font-size: 12px; }
    .top nav .nav-home, .top nav .nav-tv, .top-find span { display: none; }
    .top-find { padding: 6px; }
    .watch-head { padding-top: 17px; }
    .watch-layout { grid-template-columns: minmax(0, 1fr); }
    .schedule-list { max-height: 245px; }
    .footer-grid, .footer-policies { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-block: 20px; }
    .footer-about { grid-column: 1 / -1; }
    .footer-policies { grid-template-columns: minmax(0, 1fr); }
    .channel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
}
@media (max-width: 420px) {
    .channel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .directory-tools { flex-direction: column-reverse; align-items: stretch; gap: 4px; }
    .search { width: 100%; }
    .player-bottom, .player-placeholder p { font-size: 12px; }
    .footer { font-size: 13px; }
}
