/*
Theme Name: Lichbongda
Theme URI: https://lichbongda.vn/
Description: Giao diện nhẹ, ưu tiên mobile cho Lichbongda.vn. Tương thích League Manager và Bảng Kèo BongDa.
Version: 1.0.3
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: lichbongda
License: GPLv2 or later
*/

/* ---------- Tokens ---------- */
:root {
	--c-brand: #0389ff;
	--c-brand-dark: #0067c2;
	--c-live: #d63638;
	--c-text: #1f2328;
	--c-muted: #656d76;
	--c-line: #e6e8eb;
	--c-soft: #f5f7f9;
	--c-bg: #fff;
	--radius: 6px;
	--header-h: 60px;
	--gap: 16px;
	--font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 8px); }
body {
	margin: 0;
	font: 15px/1.6 var(--font);
	color: var(--c-text);
	background: var(--c-bg);
	overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: var(--c-brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 1.2em 0 .5em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.08rem; }
p, ul, ol, table { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--c-line); margin: 20px 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--c-line); }
th { background: var(--c-soft); font-weight: 600; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100000; background: #fff; padding: 8px 12px; }
.button {
	display: inline-block; padding: 8px 16px; border-radius: var(--radius);
	background: var(--c-brand); color: #fff; font-weight: 600;
}
.button:hover { background: var(--c-brand-dark); text-decoration: none; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 var(--gap); }

/* ---------- Header ---------- */
.site-header {
	position: sticky; top: 0; z-index: 1000;
	height: var(--header-h);
	background: #fff;
	border-bottom: 1px solid var(--c-line);
}
.admin-bar .site-header { top: 32px; }
.header-inner { display: flex; align-items: center; height: 100%; gap: 24px; }
.site-logo { display: flex; align-items: center; flex: 0 0 auto; }
.site-logo-img { display: block; width: auto; height: 44px; max-width: 200px; object-fit: contain; }
.site-logo-text { font-weight: 800; font-size: 1.25rem; color: var(--c-brand); }

.primary-nav { margin-left: auto; }
.primary-nav .menu { display: flex; list-style: none; margin: 0; padding: 0; gap: 4px; }
.primary-nav .menu a {
	display: block; padding: 8px 12px; border-radius: var(--radius);
	color: var(--c-text); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.primary-nav .menu a:hover { background: var(--c-soft); text-decoration: none; }
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a { color: var(--c-brand); }
.primary-nav .sub-menu { display: none; }

.nav-toggle {
	display: none; margin-left: auto; align-items: center; gap: 8px;
	background: none; border: 1px solid var(--c-line); border-radius: var(--radius);
	padding: 6px 10px; font: 600 14px var(--font); color: var(--c-text); cursor: pointer;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
	display: block; width: 18px; height: 2px; background: currentColor; position: relative;
}
.nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }

/* ---------- Layout ---------- */
.site-content { display: flex; align-items: flex-start; gap: 32px; padding-top: 20px; padding-bottom: 32px; }
.content-area { flex: 1 1 auto; min-width: 0; }
.widget-area { flex: 0 0 300px; width: 300px; }
.content-full { max-width: 100%; }

/* ---------- Entry ---------- */
.entry-header { margin-bottom: 12px; }
.entry-title { margin: 0 0 6px; font-size: 1.5rem; }
.entry-meta, .card-meta { color: var(--c-muted); font-size: 13px; margin: 0; }
.entry-content > :first-child { margin-top: 0; }
.entry-content img { border-radius: var(--radius); }
.entry-content figure { margin: 0 0 1em; }
.entry-content figure.wp-block-image, .entry-content figure.wp-block-image img { display: block; margin-left: auto; margin-right: auto; }
.entry-thumb { margin: 0 0 16px; }
.entry-tags a {
	display: inline-block; margin: 0 6px 6px 0; padding: 2px 10px;
	background: var(--c-soft); border-radius: 99px; font-size: 13px; color: var(--c-muted);
}
.rank-math-breadcrumb { font-size: 13px; color: var(--c-muted); margin-bottom: 8px; }
.rank-math-breadcrumb p { margin: 0; }
.archive-desc { color: var(--c-muted); }

/* Danh sách bài viết */
.post-list { display: grid; gap: 16px; }
.card { display: flex; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--c-line); }
.card-thumb { flex: 0 0 200px; }
.card-thumb img { display: block; width: 200px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius); }
.card-title { margin: 0 0 4px; font-size: 1.05rem; }
.card-title a { color: var(--c-text); }
.card-excerpt { margin: 6px 0 0; color: var(--c-muted); font-size: 14px; }
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 20px; }
.nav-links .page-numbers { padding: 6px 12px; border: 1px solid var(--c-line); border-radius: var(--radius); }
.nav-links .current { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }

/* ---------- Widgets ---------- */
.widget { margin-bottom: 24px; font-size: 14px; }
.widget-title { margin: 0 0 10px; font-size: 1rem; text-transform: uppercase; letter-spacing: .02em; }
.widget ul { padding-left: 0; list-style: none; }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-soft); border-top: 1px solid var(--c-line); font-size: 14px; }
.footer-widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; padding-top: 24px; }
.footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; padding-top: 16px; padding-bottom: 16px; }
.footer-menu { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; }
.footer-menu a { color: var(--c-muted); }
.site-info { margin: 0; color: var(--c-muted); }

/* ---------- League Manager ---------- */
.lm-date-btn { line-height: 1.4; }
/* Plugin in CSS nội tuyến sau giao diện nên cần độ ưu tiên cao hơn. */
.site .lm-date-btn.active, .site .lm-league-menu a.active { background: var(--c-brand); color: #fff; }
.widget .lm-popular-list { padding-left: 18px; }
.lm-league-block h3, .lm-date-block h3 {
	display: flex; align-items: center; gap: 6px;
	margin-top: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--c-soft);
}
.lm-league-block h3 img { float: none; width: 20px; height: 20px; object-fit: contain; flex: 0 0 20px; }
.lm-match { min-height: 41px; }
.lm-team { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lm-team.lm-home { justify-content: flex-end; }
.lm-team img, .lm-team.lm-home img, .lm-away img {
	float: none; width: 20px; height: 20px; flex: 0 0 20px; margin: 0 !important; object-fit: contain;
}
.lm-league-menu { display: flex; flex-wrap: wrap; gap: 6px; }
.lm-league-menu a { margin-right: 0; }
.lm-table-ranking img { object-fit: contain; }
.lm-ranking-block, .bkbd-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lm-popular-block { border-radius: var(--radius); }

/* Bảng Kèo */
table td, table tr:hover td { background-color: unset; }
#bkbd-main-container td { font-size: 12px; }
h2.bg_h2 { font-size: 14px !important; margin: 0 !important; }
td.TYLETT_2a span { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
	:root { --header-h: 56px; }
	.nav-toggle { display: inline-flex; }
	.primary-nav {
		display: none; position: absolute; left: 0; right: 0; top: var(--header-h);
		background: #fff; border-bottom: 1px solid var(--c-line); box-shadow: 0 8px 16px rgba(0, 0, 0, .06);
	}
	.nav-open .primary-nav { display: block; }
	.primary-nav .menu { flex-direction: column; padding: 8px var(--gap); gap: 0; }
	.primary-nav .menu a { padding: 12px 8px; border-bottom: 1px solid var(--c-line); border-radius: 0; font-size: 15px; }
	.site-content { flex-direction: column; align-items: stretch; gap: 24px; padding-top: 16px; }
	.widget-area { width: 100%; flex-basis: auto; }
	.site-logo-img { height: 38px; }
}
@media (max-width: 782px) {
	.admin-bar .site-header { top: 46px; }
}
@media (max-width: 600px) {
	.admin-bar .site-header { top: 0; }
}
@media (max-width: 768px) {
	/* Plugin ẩn cột HS và Đ trên mobile; hiện lại cột Điểm, ẩn cột Phong độ. */
	.site .lm-table-ranking th:nth-child(8), .site .lm-table-ranking td:nth-child(8) { display: table-cell; font-weight: 700; }
	.site .lm-table-ranking th:nth-child(9), .site .lm-table-ranking td:nth-child(9) { display: none; }
}
@media (max-width: 767px) {
	/* Chừa chỗ cho thanh điều hướng dưới cùng của League Manager (60px). */
	body { padding-bottom: 64px; }
	h1, .entry-title { font-size: 1.3rem; }
	.card-thumb { flex-basis: 120px; }
	.card-thumb img { width: 120px; }
	.card-excerpt { display: none; }
}

/* ---------- Bảng kèo theo giải (League Manager: .lm-odds-table) ---------- */
.lm-odds-table { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 20px; }
.site .lm-odds-table .listing-match {
	width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 0;
	border: 1px solid var(--c-line); border-radius: var(--radius); overflow: hidden;
	font-size: 14px; line-height: 22px; font-variant-numeric: tabular-nums; margin: 0;
}
.site .lm-odds-table .listing-match td {
	padding: 8px 6px; border-bottom: 1px solid var(--c-line); vertical-align: top;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site .lm-odds-table .listing-match tr:last-child td { border-bottom: 0; }
/* Hàng quảng cáo trống giữa các trận. */
.site .lm-odds-table .listing-match tr:not(.match-row):not(.row-header) { display: none; }

.site .lm-odds-table .row-header td {
	background: var(--c-brand); color: #fff; font-size: 13px; font-weight: 600; white-space: normal; line-height: 1.25;
	text-align: center; vertical-align: middle; padding: 8px 4px; border-bottom: 0;
}
.site .lm-odds-table .row-header td:nth-child(1) { width: 64px; }
.site .lm-odds-table .row-header td:nth-child(2) { width: auto; text-align: left; padding-left: 10px; }
.site .lm-odds-table .row-header td:nth-child(3),
.site .lm-odds-table .row-header td:nth-child(4) { width: 130px; }
.site .lm-odds-table .row-header td:nth-child(5) { width: 64px; }

.site .lm-odds-table .match-row.even td { background: var(--c-soft); }
.site .lm-odds-table .match-row:hover td { background: #eaf4ff; }
.site .lm-odds-table .match-row td:nth-child(1) { color: var(--c-muted); font-size: 13px; text-align: center; }
.site .lm-odds-table .match-row td:nth-child(2) { padding-left: 10px; }
.site .lm-odds-table .match-row td:nth-child(3),
.site .lm-odds-table .match-row td:nth-child(5),
.site .lm-odds-table .match-row td:nth-child(7) { text-align: center; }
.site .lm-odds-table .match-row td:nth-child(4),
.site .lm-odds-table .match-row td:nth-child(6) { text-align: right; padding-right: 10px; border-right: 1px solid var(--c-line); }
.site .lm-odds-table .match-row td:nth-child(5) { color: var(--c-muted); }
/* Đội chấp và mức kèo. */
.site .lm-odds-table .fc-above { color: var(--c-live); font-weight: 700; }

@media (max-width: 600px) {
	.site .lm-odds-table .listing-match { font-size: 12px; line-height: 18px; }
	.site .lm-odds-table .listing-match td { padding: 6px 3px; }
	.site .lm-odds-table .row-header td { font-size: 11px; padding: 6px 2px; }
	.site .lm-odds-table .row-header td:nth-child(1) { width: 36px; }
	.site .lm-odds-table .row-header td:nth-child(2) { padding-left: 6px; }
	.site .lm-odds-table .row-header td:nth-child(3),
	.site .lm-odds-table .row-header td:nth-child(4) { width: 72px; }
	.site .lm-odds-table .row-header td:nth-child(5) { width: 38px; }
	.site .lm-odds-table .match-row td:nth-child(1) { font-size: 11px; }
	.site .lm-odds-table .match-row td:nth-child(2) { padding-left: 6px; }
	.site .lm-odds-table .match-row td:nth-child(4),
	.site .lm-odds-table .match-row td:nth-child(6) { padding-right: 5px; }
	.site .lm-odds-table .match-row td:nth-child(1),
	.site .lm-odds-table .match-row td:nth-child(3),
	.site .lm-odds-table .match-row td:nth-child(5),
	.site .lm-odds-table .match-row td:nth-child(7) { padding-left: 1px; padding-right: 1px; }
	/* Mức kèo như "0.5-1" cần vừa cột 36px. */
	.site .lm-odds-table .match-row td:nth-child(3),
	.site .lm-odds-table .match-row td:nth-child(5) { font-size: 11px; letter-spacing: -.3px; text-overflow: clip; }
}
