/*
Theme Name: Bóng Đá 24h
Description: Giao diện trực tiếp bóng đá, kết quả và lịch thi đấu cho người dùng Việt Nam. Dữ liệu từ AIScore schedule API.
Version: 1.0.0
Author: Bóng Đá 24h
Text Domain: bongda24h
Requires PHP: 8.0
*/

:root {
	--navy: #0b1e2d;
	--navy-2: #12304a;
	--green: #00a650;
	--green-d: #008a43;
	--red: #e5212e;
	--yellow: #ffcc00;
	--bg: #eef1f5;
	--card: #fff;
	--line: #e3e7ee;
	--text: #18212b;
	--muted: #6b7684;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
	--font: "Be Vietnam Pro", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--green-d); }
img { max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.3; margin: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 12px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: #fff; padding: 8px 12px; }
.muted { color: var(--muted); margin: 0; }
[hidden] { display: none !important; }

/* ----------------------------------------------------------- header ---- */
.topbar { background: #061420; color: #9fb3c8; font-size: 12px; }
.topbar__in { display: flex; justify-content: space-between; align-items: center; height: 30px; }
.topbar__upd { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; box-shadow: 0 0 0 0 rgba(229, 33, 46, .6); animation: pulse 1.6s infinite; }
.topbar .dot { background: var(--green); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229, 33, 46, .6); } 70% { box-shadow: 0 0 0 8px rgba(229, 33, 46, 0); } 100% { box-shadow: 0 0 0 0 rgba(229, 33, 46, 0); } }

.site-header { background: linear-gradient(90deg, var(--navy), var(--navy-2)); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 8px rgba(0, 0, 0, .25); border-bottom: 3px solid var(--green); }
.site-header__in { display: flex; align-items: center; gap: 24px; height: 60px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: #fff; flex-shrink: 0; }
.logo:hover { color: #fff; }
.logo__txt { display: flex; align-items: baseline; gap: 4px; font-size: 22px; letter-spacing: -.5px; }
.logo__txt b { font-weight: 800; }
.logo__txt i { font-style: normal; font-weight: 800; background: var(--green); color: #fff; padding: 0 6px; border-radius: 4px; transform: skew(-8deg); display: inline-block; }
.nav { flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav__list { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; white-space: nowrap; }
.nav__list a { display: flex; align-items: center; gap: 6px; padding: 0 14px; height: 60px; font-weight: 600; font-size: 15px; color: #d6e2ee; border-bottom: 3px solid transparent; margin-bottom: -3px; }
.nav__list a:hover, .nav__list a.is-active, .nav__list .current-menu-item a { color: #fff; border-bottom-color: var(--yellow); }
.pill-live { background: var(--red); color: #fff; font-size: 11px; padding: 0 6px; border-radius: 10px; line-height: 18px; }
.hdr-live { display: inline-flex; align-items: center; gap: 8px; background: var(--red); color: #fff; font-weight: 700; padding: 8px 14px; border-radius: 6px; font-size: 13px; flex-shrink: 0; }
.hdr-live .dot { background: #fff; }
.hdr-live:hover { color: #fff; background: #c81723; }

/* ------------------------------------------------------------ layout --- */
.site-main { padding: 16px 0 32px; min-height: 60vh; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.content { min-width: 0; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.intro { margin: 4px 0 14px; }
.intro h1 { font-size: 22px; font-weight: 800; color: var(--navy); }
.intro p { margin: 4px 0 0; color: var(--muted); }
.intro strong { color: var(--text); }
.sec-title { font-size: 17px; font-weight: 700; margin: 20px 0 10px; padding-left: 10px; border-left: 4px solid var(--green); color: var(--navy); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs a { color: var(--green-d); }

/* ---------------------------------------------------------- featured --- */
.featured { margin-bottom: 16px; }
.featured__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.featured__head h2 { font-size: 17px; font-weight: 700; color: var(--navy); }
.featured__hint { font-size: 12px; color: var(--muted); }
.featured__track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin; }
.fcard { scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(160deg, #0f2a40, #0b1e2d 60%); color: #fff; border-radius: var(--radius); padding: 12px; position: relative; overflow: hidden; border: 1px solid #1d3c56; }
.fcard::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(0, 166, 80, .35), transparent 70%); }
.fcard:hover { color: #fff; border-color: var(--green); }
.fcard.is-live { border-color: var(--red); }
.fcard__league { font-size: 12px; color: #9fb3c8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fcard__teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.fcard__team { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-weight: 600; font-size: 13px; line-height: 1.25; }
.fcard__team span:last-child { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fcard__mid { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fcard__mid .score { font-size: 22px; color: var(--yellow); }
.fcard .st { color: #c5d3e0; font-size: 12px; }
.fcard .st--live { color: #fff; background: var(--red); padding: 1px 8px; border-radius: 10px; }
.fcard__cta { text-align: center; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, .08); border-radius: 6px; padding: 6px; }
.fcard.is-live .fcard .st { color: #c5d3e0; font-size: 12px; }
.fcard .st--live { color: #fff; background: var(--red); padding: 1px 8px; border-radius: 10px; }
.fcard__cta { background: var(--red); }

/* ----------------------------------------------------------- toolbar --- */
.mblock { margin-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; background: var(--card); padding: 8px; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; position: sticky; top: 63px; z-index: 20; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { border: 1px solid var(--line); background: #f6f8fa; color: var(--text); border-radius: 20px; padding: 6px 12px; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tab__n { display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 10px; background: #e3e8ef; font-size: 11px; line-height: 18px; text-align: center; }
.tab.is-active { background: var(--green); border-color: var(--green); color: #fff; }
.tab.is-active .tab__n { background: rgba(255, 255, 255, .25); }
.tab--live .tab__n { background: var(--red); color: #fff; }
.search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 20px; padding: 0 12px; background: #f6f8fa; color: var(--muted); min-width: 220px; }
.search input { border: 0; background: transparent; height: 34px; outline: 0; width: 100%; font: inherit; color: var(--text); }
.search--block { margin-bottom: 12px; background: #fff; }

/* ------------------------------------------------------- match list ---- */
.league { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.league__head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f4f7fa; border-bottom: 1px solid var(--line); }
.league__toggle { border: 0; background: none; padding: 0; color: var(--muted); display: flex; transition: transform .2s; }
.league.is-closed .league__toggle { transform: rotate(-90deg); }
.league.is-closed .league__body { display: none; }
.league__name { font-size: 14px; font-weight: 700; color: var(--navy); }
.league__orig { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.league__count { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

.mrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; min-height: 52px; border-bottom: 1px solid #f0f2f5; }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: #f8fbf9; }
.mrow.is-live { background: #fff7f7; }
.mrow__time { display: flex; flex-direction: column; align-items: center; font-size: 12px; color: var(--muted); }
.mrow__time small { font-size: 11px; }
.mrow__teams { display: grid; grid-template-columns: minmax(0, 1fr) 70px minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 0; }
.mrow__teams:hover { color: inherit; }
.team { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.team--home { justify-content: flex-end; text-align: right; }
.team__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow__teams:hover .team__name { color: var(--green-d); }
.score { font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mrow .score { background: var(--navy); color: #fff; border-radius: 6px; padding: 4px 0; font-size: 14px; }
.mrow.is-scheduled .score, .mrow.is-postponed .score { background: #eef1f5; color: var(--muted); font-weight: 600; font-size: 12px; }
.mrow.is-live .score { background: var(--red); }
.mrow.flash .score { animation: flash 1.2s 3; }
@keyframes flash { 50% { background: var(--yellow); color: var(--navy); } }
.mrow__act { display: flex; justify-content: center; }
.st { font-weight: 700; font-size: 12px; }
.st--live { color: var(--red); }
.st--live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 4px; vertical-align: middle; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.st--scheduled { color: var(--text); font-size: 13px; }
.st--finished { color: var(--muted); }
.st--postponed, .st--pending { color: #b7791f; }
.btn-live { display: inline-flex; align-items: center; gap: 3px; background: #e9f7ef; color: var(--green-d); border-radius: 14px; padding: 4px 10px; font-weight: 700; font-size: 12px; }
.btn-live i { font-style: normal; font-size: 9px; }
.btn-live.is-on { background: var(--red); color: #fff; }
.btn-live:hover { background: var(--green); color: #fff; }
.btn-info { color: #b4bcc7; font-size: 22px; line-height: 1; padding: 0 10px; }

.badge { --c: #345; width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center; background: var(--c); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: -.3px; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .25); }
.badge--lg { width: 42px; height: 42px; font-size: 14px; }
.badge--xl { width: 72px; height: 72px; font-size: 24px; }
.empty { background: var(--card); border-radius: var(--radius); padding: 24px; text-align: center; color: var(--muted); margin: 0 0 10px; }

/* ------------------------------------------------------------ days ----- */
.days { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; scrollbar-width: none; }
.day { flex: 0 0 auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; display: flex; flex-direction: column; align-items: center; min-width: 84px; }
.day b { font-size: 13px; }
.day small { color: var(--muted); font-size: 11px; }
.day.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.day.is-active small { color: #9fb3c8; }

/* --------------------------------------------------------- sidebar ----- */
.sidebar { position: sticky; top: 76px; }
.card__title { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; padding-bottom: 8px; border-bottom: 2px solid var(--green); }
.mini { list-style: none; margin: 0; padding: 0; }
.mini li + li { border-top: 1px solid #f0f2f5; }
.mini a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; font-size: 13px; }
.mini__teams { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mini .score { color: var(--red); }
.mini__time { color: var(--green-d); }
.leagues { list-style: none; margin: 0; padding: 0; }
.leagues a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line); }
.leagues em { font-style: normal; background: #eef1f5; border-radius: 10px; padding: 0 8px; font-size: 12px; color: var(--muted); height: 20px; }
.card__more { display: block; margin-top: 10px; font-weight: 600; color: var(--green-d); font-size: 13px; }

/* ---------------------------------------------------------- match ------ */
.scoreboard { background: radial-gradient(ellipse at top, #1b4a35 0%, var(--navy) 65%); color: #fff; border-radius: var(--radius); padding: 18px 16px; text-align: center; margin-bottom: 12px; }
.scoreboard__league { color: #9fd9b8; font-weight: 600; font-size: 13px; }
.scoreboard__row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 14px 0 8px; }
.scoreboard__team { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.scoreboard__team b { font-size: 17px; }
.scoreboard__team small { color: #9fb3c8; font-size: 12px; }
.scoreboard__mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.score--xl { font-size: 40px; color: var(--yellow); letter-spacing: 2px; }
.scoreboard .st { background: rgba(255, 255, 255, .1); padding: 3px 10px; border-radius: 12px; color: #fff; }
.scoreboard .st--live { background: var(--red); }
.scoreboard__time { margin: 0; color: #c5d3e0; font-size: 13px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--yellow); font-size: 13px; }

.player-wrap { margin-bottom: 12px; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player__start { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; padding: 14px 26px; border: 0; border-radius: 40px; background: var(--red); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 6px 20px rgba(229, 33, 46, .5); }
.player__start span { margin-right: 4px; }
.player.is-error .player__err { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 13px; text-align: center; }
.player--off { aspect-ratio: auto; min-height: 180px; display: grid; place-items: center; background: linear-gradient(135deg, #0b1e2d, #12304a); }
.player__msg { display: flex; flex-direction: column; gap: 6px; text-align: center; color: #c5d3e0; padding: 20px; }
.player__msg b { color: #fff; font-size: 18px; }
.servers { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.server { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 6px 12px; font-weight: 600; }
.server.is-active { background: var(--green); color: #fff; border-color: var(--green); }
.match-h1 { font-size: 20px; font-weight: 800; color: var(--navy); margin-bottom: 12px; }
.info { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.info th, .info td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.info th { width: 130px; color: var(--muted); font-weight: 500; background: #f8fafc; }
.info a { color: var(--green-d); font-weight: 600; }

/* ---------------------------------------------------------- leagues ---- */
.comp-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.comp-grid a { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); height: 100%; }
.comp-grid__name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.comp-grid__name b, .comp-grid__name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comp-grid__name small { color: var(--muted); }
.comp-grid em { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ------------------------------------------------------- content ------- */
.seo-copy { margin-top: 16px; color: #33404d; }
.seo-copy h2 { font-size: 18px; color: var(--navy); margin: 8px 0; }
.seo-copy h3 { font-size: 16px; margin: 12px 0 6px; }
.entry h1 { font-size: 24px; color: var(--navy); margin-bottom: 12px; }
.entry p, .entry li { line-height: 1.7; }
.entry a { color: var(--green-d); text-decoration: underline; }
.meta { color: var(--muted); font-size: 13px; }
.faq details { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; background: #fafbfc; }
.faq summary { padding: 10px 14px; font-weight: 600; cursor: pointer; }
.faq details p { margin: 0; padding: 0 14px 12px; }
.posts { display: grid; gap: 12px; }
.post-card { display: grid; grid-template-columns: 220px 1fr; gap: 14px; padding: 12px; margin: 0; }
.post-card:not(:has(.post-card__img)) { grid-template-columns: 1fr; }
.post-card__img img { border-radius: 8px; aspect-ratio: 16 / 10; object-fit: cover; width: 100%; }
.post-card h2 { font-size: 17px; }
.post-card time { font-size: 12px; color: var(--muted); }
.post-card p { margin: 6px 0 0; color: #4a5562; }
.nav-links { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.page-numbers { padding: 6px 12px; background: #fff; border-radius: 6px; box-shadow: var(--shadow); }
.page-numbers.current { background: var(--green); color: #fff; }
.notfound { text-align: center; padding: 40px 16px; }
.btn { display: inline-block; background: var(--green); color: #fff; font-weight: 700; padding: 10px 18px; border-radius: 8px; margin: 4px; }
.btn:hover { color: #fff; background: var(--green-d); }
.btn--ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }

/* ----------------------------------------------------------- footer ---- */
.site-footer { background: var(--navy); color: #9fb3c8; padding: 32px 0 0; font-size: 13px; }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.footer__grid ul { list-style: none; margin: 0; padding: 0; }
.footer__grid li { margin-bottom: 8px; }
.footer__grid a:hover { color: #fff; }
.footer__h { color: #fff; font-size: 15px; margin-bottom: 12px; }
.logo--ft .logo__txt { font-size: 20px; }
.footer__bottom { border-top: 1px solid #1d3c56; margin-top: 24px; padding: 14px 12px; font-size: 12px; }
.footer__bottom p { margin: 0; }
.tabbar { display: none; }

/* ----------------------------------------------------------- mobile ---- */
@media (max-width: 1024px) {
	.layout { grid-template-columns: 1fr; }
	.sidebar { position: static; }
	.hdr-live { display: none; }
}
@media (max-width: 768px) {
	body { font-size: 14px; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
	.site-header__in { height: 52px; gap: 12px; }
	.nav { display: none; }
	.logo__txt { font-size: 19px; }
	.logo__ball { width: 32px; height: 32px; }
	.intro h1 { font-size: 18px; }
	.toolbar { top: 55px; padding: 6px; }
	.search { min-width: 0; width: 100%; }
	.mrow { grid-template-columns: 50px minmax(0, 1fr) 46px; min-height: 56px; }
	.mrow__teams { grid-template-columns: 1fr; gap: 3px; position: relative; padding-right: 50px; }
	.team, .team--home { justify-content: flex-start; text-align: left; flex-direction: row; }
	.team--home .badge { order: -1; }
	.mrow__teams .score { position: absolute; right: 0; top: 50%; transform: translateY(-50%); width: 46px; }
	.badge { width: 20px; height: 20px; font-size: 8px; }
	.btn-live span { display: none; }
	.btn-live i { font-size: 12px; }
	.btn-live { padding: 6px 8px; }
	.league__orig { display: none; }
	.score--xl { font-size: 30px; }
	.badge--xl { width: 54px; height: 54px; font-size: 18px; }
	.scoreboard__team b { font-size: 14px; }
	.footer__grid { grid-template-columns: 1fr 1fr; }
	.footer__about { grid-column: 1 / -1; }
	.post-card { grid-template-columns: 110px 1fr; }
	.tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: #fff; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(0, 0, 0, .06); }
	.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 58px; font-size: 11px; color: var(--muted); font-weight: 600; }
	.tabbar a.is-active { color: var(--green); }
	.topbar__in > span:first-child { display: none; }
	.topbar__in { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
