/*
 * KTDB.NET — Frontend Redesign
 * Modern layout system for the existing GeneratePress-based theme.
 *
 * IMPORTANT: no global element reset (no Tailwind-style preflight) is
 * applied here on purpose. Several bundled plugins (kitu-khoang-trong,
 * ktdb-chunguoc, kituiam, ...) print raw <button>/<input>/<textarea>
 * markup straight into post content and rely on either their own CSS or
 * sane browser defaults. Resetting those tags globally would silently
 * break their UI even though we never touched their code.
 */

/* ============ Mobile overflow fix (Core Web Vitals / Mobile-Friendly) ============ */
/* Root cause: dequeuing GeneratePress's own all.min.css (done for the redesign)
   also removed its universal box-sizing:border-box reset, and it was never
   re-added here. Using box-sizing:inherit (not !important) means any plugin
   that sets its own box-sizing on specific elements (e.g. Bootstrap loaded by
   name-generator-pro) still wins locally -- this only fixes the elements that
   had no box-sizing rule at all. overflow-x:hidden on html/body is a hard
   safety net for anything still spilling out (verified via live iframe test
   against #primary / .row.ktdb-nho, which were the confirmed offenders). */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
html, body { overflow-x: hidden; max-width: 100%; }
img, video, iframe, table, embed { max-width: 100%; height: auto; }

/* WordPress's [caption]/image-caption block writes an inline style="width:NNNpx"
   on .wp-caption using the image's native pixel size (not responsive). This
   was the actual root cause found while live-testing #primary at 424px width:
   it's a plain block element with a hardcoded pixel width, so it doesn't
   respond to flexbox min-width:0 at all -- it just forces every ancestor in
   the flex chain (#primary, #content) to expand to contain it. !important is
   needed to beat the inline style. */
.wp-caption {
	width: auto !important;
	max-width: 100% !important;
}
.wp-caption img { max-width: 100%; height: auto; }

/* NOTE: an earlier attempt added `#primary { overflow-x: hidden; }` here as
   a belt-and-suspenders safety net against wide descendants. Reverted --
   setting overflow-x alone on a flex item (with align-items:flex-start on
   its .site-content parent) forces overflow-y to auto per spec, which
   collapsed #primary's height to 0 on real 390px-width test (all page
   content invisible, only header/footer showing). The .wp-caption fix
   above already removes the actual source of the overflow, and body{
   overflow-x:hidden} (further down) is a safe non-flex fallback -- no
   flex-item-level overflow rule needed. */

/* Bootstrap .row/.col-* grids are used by several bundled plugins
   (name-generator-pro, ktdb-nho). Their negative-margin .row can bleed past
   the viewport on narrow screens -- clip it without touching plugin files.
   max-width alone isn't enough: .row and .col-* are flex items whose default
   min-width:auto lets their own content (e.g. Bootstrap <input class="form-control">)
   force the box wider than the max-width cap. min-width:0 is required at
   every level of the chain to actually let it shrink. Verified against a live
   430px iframe test on the #SymbolTextGenerator (name-generator-pro) form. */
@media (max-width: 600px) {
	.row,
	.container,
	.container-fluid,
	[class*="col-"] {
		max-width: 100%;
		min-width: 0;
		margin-left: 0;
		margin-right: 0;
	}
	input, textarea, select, button, .form-control, .btn {
		max-width: 100%;
		min-width: 0;
		box-sizing: border-box;
	}
	/* Block-flow ancestors between the flex layout and the plugin markup --
	   without min-width:0 here, #primary (a flex item) still balloons to
	   fit non-shrinking descendants despite its own max-width. */
	#primary, .entry-content, .inside-article, article, #main {
		min-width: 0;
	}
}

/* ============ Design tokens ============ */
:root {
	--ktdb-primary: #fc6e0b;
	--ktdb-primary-dark: #e35f00;
	--ktdb-primary-light: #fff1e6;
	--ktdb-ink: #1c1f26;
	--ktdb-ink-soft: #565b66;
	--ktdb-line: #e7e8ec;
	--ktdb-bg: #f7f7f9;
	--ktdb-surface: #ffffff;
	--ktdb-radius-sm: 8px;
	--ktdb-radius: 14px;
	--ktdb-radius-lg: 20px;
	--ktdb-shadow: 0 2px 10px rgba(28, 31, 38, .06);
	--ktdb-shadow-lg: 0 12px 32px rgba(28, 31, 38, .12);
	--ktdb-container: 1200px;
	--ktdb-header-h: 68px;
	--ktdb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Arial, sans-serif;
}

/* ============ Base ============ */
html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--ktdb-header-h) + 16px);
}

body {
	background: var(--ktdb-bg);
	color: var(--ktdb-ink);
	font-family: var(--ktdb-font);
	line-height: 1.65;
	font-size: 16px;
	-webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--ktdb-primary-dark); text-decoration: none; }
a:hover { color: var(--ktdb-primary); }

.entry-content a,
.entry-summary a,
.comment-content a {
	text-decoration: underline;
	text-decoration-color: rgba(252, 110, 11, .35);
	text-underline-offset: 2px;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; overflow: hidden;
	clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.screen-reader-text:focus {
	position: fixed !important;
	top: 8px; left: 8px;
	width: auto; height: auto;
	padding: 10px 16px; z-index: 10000;
	background: var(--ktdb-ink); color: #fff;
	border-radius: var(--ktdb-radius-sm);
	clip: auto;
}

/* ============ Page shell ============ */
#page {
	max-width: var(--ktdb-container);
	margin: 0 auto;
	padding: 0 20px;
}

.site-content {
	display: flex;
	flex-wrap: wrap;
	gap: 32px;
	align-items: flex-start;
	padding-top: 24px;
}

#primary {
	flex: 1 1 0;
	min-width: 0;
}

/* When a right/left sidebar is present, keep it a fixed, sticky column */
#right-sidebar,
#left-sidebar {
	flex: 0 0 300px;
	width: 300px;
}
#right-sidebar .inside-right-sidebar,
#left-sidebar .inside-left-sidebar {
	position: sticky;
	top: calc(var(--ktdb-header-h) + 16px);
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* ============ Header ============ */
#masthead {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--ktdb-surface);
	border-bottom: 1px solid var(--ktdb-line);
}

/* Logo on its own row, menu wraps to a new row below it (kituhay.com style).
   #site-navigation is rendered as a flex child inside .inside-header by
   GeneratePress's "float-right" nav location setting -- forcing it to
   flex-basis:100% pushes it onto its own line without touching that setting. */
#masthead .inside-header {
	max-width: var(--ktdb-container);
	margin: 0 auto;
	padding: 16px 20px 0;
	min-height: var(--ktdb-header-h);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 24px;
}

#masthead .inside-header > .site-branding,
#masthead .inside-header > .site-logo,
#masthead .inside-header > .site-branding-container {
	flex: 0 0 auto;
	margin: 0 auto;
}

#masthead .inside-header > #site-navigation {
	flex-basis: 100%;
	order: 10;
}

.site-logo img { display: block; height: 40px; width: auto; }

.site-branding .main-title {
	font-size: 20px;
	font-weight: 800;
	margin: 0;
	letter-spacing: -.01em;
}
.site-branding .main-title a { color: var(--ktdb-ink); }
.site-branding .site-description {
	margin: 2px 0 0;
	font-size: 13px;
	color: var(--ktdb-ink-soft);
}

/* Random color menu shortcode ([random_menu]) — keep the inline
   background-color from PHP, just modernize shape/spacing/hover. */
.ktdb-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 10px 0;
}
.ktdb-menu .menu-btn {
	color: #fff !important;
	padding: 7px 14px;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 700;
	white-space: nowrap;
	box-shadow: var(--ktdb-shadow);
	transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.ktdb-menu .menu-btn:hover {
	transform: translateY(-2px);
	filter: brightness(1.05);
	box-shadow: var(--ktdb-shadow-lg);
}

/* ============ Primary navigation ============ */
#site-navigation {
	border-top: 1px solid var(--ktdb-line);
}
#site-navigation .inside-navigation {
	max-width: var(--ktdb-container);
	margin: 0 auto;
	padding: 0 20px;
	display: flex;
	align-items: center;
	gap: 16px;
}

/*
 * Primary menu — flat, single level (wp_nav_menu 'depth' => 1 in
 * inc/structure/navigation.php), styled as wrapping colored pill buttons
 * (matches kituhay.com reference layout). No dropdown, no hamburger --
 * items just wrap onto new lines on narrow viewports.
 */
.main-nav {
	flex: 1 1 auto;
}
.main-nav ul {
	list-style: none;
	margin: 0;
	padding: 8px 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
}
.main-nav ul li { position: relative; }
.main-nav ul li a {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 8px 16px;
	border-radius: 6px;
	color: #fff;
	font-weight: 700;
	font-size: 13.5px;
	box-shadow: var(--ktdb-shadow);
	transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.main-nav ul li a:hover {
	color: #fff;
	transform: translateY(-2px);
	filter: brightness(1.05);
	box-shadow: var(--ktdb-shadow-lg);
}
.main-nav ul li.current-menu-item > a {
	outline: 2px solid var(--ktdb-ink);
	outline-offset: 2px;
}

/* Color cycle -- same 10-color brand palette used by [random_menu] */
.main-nav ul li:nth-child(10n+1) a { background: #e91e63; }
.main-nav ul li:nth-child(10n+2) a { background: #3f51b5; }
.main-nav ul li:nth-child(10n+3) a { background: #4caf50; }
.main-nav ul li:nth-child(10n+4) a { background: #ff9800; }
.main-nav ul li:nth-child(10n+5) a { background: #2196f3; }
.main-nav ul li:nth-child(10n+6) a { background: #9c27b0; }
.main-nav ul li:nth-child(10n+7) a { background: #f44336; }
.main-nav ul li:nth-child(10n+8) a { background: #607d8b; }
.main-nav ul li:nth-child(10n+9) a { background: #00bcd4; }
.main-nav ul li:nth-child(10n)   a { background: #8bc34a; }

/* depth=>1 means no sub-menus ever render, so the arrow icon injected by
   generate_dropdown_icon_to_menu_link() is always meaningless -- hide it. */
.main-nav .dropdown-menu-toggle { display: none; }

/* Hamburger removed in favor of natural wrapping (kituhay-style) --
   nav is always visible, at every viewport width. */
.menu-toggle { display: none !important; }

.search-item { display: none !important; }
.navigation-search {
	position: absolute;
	right: 20px; top: 100%;
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-sm);
	box-shadow: var(--ktdb-shadow-lg);
	padding: 10px;
	display: none;
}
.navigation-search.nav-search-active { display: block; }
.navigation-search .search-field {
	border: 1px solid var(--ktdb-line);
	border-radius: 999px;
	padding: 8px 14px;
	width: 220px;
}

/* Mobile nav (JS toggles .toggled on #site-navigation, aria-* attrs) */
@media (max-width: 860px) {
	#site-navigation .inside-navigation { flex-wrap: wrap; padding: 12px 20px; }
	.main-nav { flex-basis: 100%; order: 3; }
	.main-nav ul li a { padding: 7px 14px; font-size: 13px; }
}

/* ============ Breadcrumbs (Yoast) ============ */
#breadcrumbs,
.webzalo-breadcrumbs,
.ktdb-breadcrumbs {
	font-size: 13px;
	color: var(--ktdb-ink-soft);
	margin: 16px 0 12px;
}
#breadcrumbs a,
.webzalo-breadcrumbs a,
.ktdb-breadcrumbs a { color: var(--ktdb-ink-soft); text-decoration: underline; }

/* ============ Article / entry ============ */
article {
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-lg);
	box-shadow: var(--ktdb-shadow);
	overflow: hidden;
}
article .inside-article { padding: 24px 28px 32px; }
@media (max-width: 600px) {
	article .inside-article { padding: 18px 16px 24px; }
}

.entry-title {
	font-size: clamp(22px, 3vw, 32px);
	line-height: 1.3;
	font-weight: 800;
	margin: 0 0 12px;
	letter-spacing: -.01em;
}
article .post-image img,
article .entry-image img {
	display: block;
	width: 100%;
	border-radius: var(--ktdb-radius);
	margin-bottom: 18px;
}

.entry-meta,
footer.entry-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 14px;
	font-size: 13px;
	color: var(--ktdb-ink-soft);
	margin-bottom: 18px;
}
.entry-meta .avatar-user img {
	width: 28px; height: 28px;
	border-radius: 50%;
	vertical-align: middle;
	margin-right: 6px;
}
.entry-meta .byline,
.entry-meta .posted-on,
.entry-meta .cat-links,
.entry-meta .tags-links,
.entry-meta .comments-link {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.entry-meta a { color: var(--ktdb-ink-soft); }
.entry-meta a:hover { color: var(--ktdb-primary-dark); }

.entry-content,
.entry-summary {
	font-size: 16px;
	color: var(--ktdb-ink);
}
.entry-content h2 { font-size: 22px; margin: 28px 0 12px; font-weight: 800; }
.entry-content h3 { font-size: 18px; margin: 22px 0 10px; font-weight: 700; }
.entry-content p { margin: 0 0 16px; }
.entry-content ul,
.entry-content ol { padding-left: 22px; margin: 0 0 16px; }
.entry-content img { border-radius: var(--ktdb-radius-sm); }
.entry-content table {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 20px;
}
.entry-content table th,
.entry-content table td {
	border: 1px solid var(--ktdb-line);
	padding: 8px 12px;
	text-align: left;
}

.page-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 20px 0;
}
.page-links a {
	padding: 6px 12px;
	border: 1px solid var(--ktdb-line);
	border-radius: 8px;
}

/* ============ Symbol / character grid (core product) ============ */
/* Used by [ki-tu-dep], [tengamehay] shortcodes and the ACF "dsktdb" loop
   on the ki-tu single template. Markup/PHP untouched — only visuals. */
.ten-game-hay {
	background: var(--ktdb-primary-light);
	border-radius: var(--ktdb-radius);
	padding: 14px 18px;
	margin: 0 0 16px;
	font-weight: 700;
}

.symbols,
.ktdb {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 24px;
	padding: 16px;
	background: var(--ktdb-bg);
	border: 1px dashed var(--ktdb-line);
	border-radius: var(--ktdb-radius);
}
.symbols a,
.ktdb a {
	display: inline-flex;
	align-items: center;
	cursor: pointer;
}
.symbols .icon,
.ktdb .icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 12px;
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-sm);
	font-size: 15px;
	font-weight: 600;
	color: var(--ktdb-ink);
	transition: border-color .15s ease, background .15s ease, transform .1s ease;
}
.symbols a:hover .icon,
.ktdb a:hover .icon {
	border-color: var(--ktdb-primary);
	background: var(--ktdb-primary-light);
	transform: translateY(-1px);
}
.symbols a:active .icon,
.ktdb a:active .icon { transform: scale(.96); }

.copy-ktdb {
	font-size: 13.5px;
	color: var(--ktdb-ink-soft);
	background: #fff8ef;
	border: 1px solid #ffe1bf;
	border-radius: var(--ktdb-radius-sm);
	padding: 10px 14px;
	margin: 0 0 12px;
}

/* Generic tuyển dụng / game / FAQ block classes (content-* templates) */
.job {
	display: flex; flex-direction: column; gap: 6px;
	background: var(--ktdb-bg);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius);
	padding: 16px 18px;
	margin: 0 0 20px;
}
.job .dia-chi,
.job .muc-luong,
.job .thoi-gian { font-size: 14px; color: var(--ktdb-ink-soft); }

.gamehay-item {
	background: var(--ktdb-bg);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius);
	padding: 16px 18px;
	margin: 0 0 14px;
}
.title-game-hay { font-weight: 800; font-size: 17px; margin-bottom: 6px; }
.mota-gamehay { color: var(--ktdb-ink-soft); font-size: 14.5px; }

.fqa_list,
.list-cau-hoi {
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius);
	padding: 6px 18px;
	margin: 0 0 14px;
	background: var(--ktdb-surface);
}
.cau-hoi { font-weight: 700; margin-top: 12px; }
.cau-tra-loi { color: var(--ktdb-ink-soft); margin-bottom: 12px; }

.likebtn-wrapper { margin: 18px 0; }

/* ============ Related posts ("Có thể bạn thích!") ============ */
.tin-lien-quan {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--ktdb-line);
}
.tin-lien-quan .title .list-entry-title {
	font-size: 18px;
	font-weight: 800;
	margin: 0 0 16px;
}
.tin-lien-quan {
	display: block;
}
.tin-lien-quan .list-post {
	display: grid;
	grid-template-columns: 96px 1fr;
	gap: 14px;
	padding: 12px 0;
	border-bottom: 1px solid var(--ktdb-line);
}
.tin-lien-quan .list-post:last-child { border-bottom: 0; }
.list-tpost-thumb-img {
	display: block;
	border-radius: var(--ktdb-radius-sm);
	overflow: hidden;
	aspect-ratio: 1 / 1;
}
.list-tpost-thumb-img img { width: 100%; height: 100%; object-fit: cover; }
.list-entry-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; line-height: 1.4; }
.list-tpost-content p { margin: 0; font-size: 13.5px; color: var(--ktdb-ink-soft); }

/* ============ Pagination ============ */
.paging-navigation,
.post-navigation {
	width: 100%;
	box-sizing: border-box;
	margin-top: 24px;
	display: flex;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}
.nav-links { display: flex; gap: 8px; flex-wrap: wrap; }
.nav-previous a,
.nav-next a,
.page-numbers {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 9px 16px;
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-sm);
	font-weight: 600;
	background: var(--ktdb-surface);
}
.page-numbers.current { background: var(--ktdb-primary); color: #fff; border-color: var(--ktdb-primary); }
a.page-numbers:hover,
.nav-previous a:hover,
.nav-next a:hover { border-color: var(--ktdb-primary); color: var(--ktdb-primary-dark); }

/* ============ Comments ============ */
.comments-area {
	margin-top: 24px;
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-lg);
	padding: 24px 28px;
}
.comments-title { font-size: 18px; font-weight: 800; margin: 0 0 16px; }
.comment-list { list-style: none; margin: 0; padding: 0; }
.comment-body {
	display: flex;
	gap: 12px;
	padding: 16px 0;
	border-bottom: 1px solid var(--ktdb-line);
}
.comment-meta img { border-radius: 50%; }
.comment-author-info { flex: 1; }
.comment-author .fn { font-weight: 700; font-style: normal; }
.comment-metadata { font-size: 12.5px; color: var(--ktdb-ink-soft); }
.comment-content { margin-top: 6px; }
.comment-reply-link,
.reply a {
	font-size: 12.5px;
	font-weight: 700;
	color: var(--ktdb-primary-dark);
}
.comment-respond { margin-top: 20px; }
.comment-form-comment textarea,
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"] {
	width: 100%;
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-sm);
	padding: 10px 14px;
	font-family: inherit;
	margin-bottom: 12px;
}
#submit,
.comment-form input#submit {
	background: var(--ktdb-primary);
	color: #fff;
	border: 0;
	padding: 10px 22px;
	border-radius: var(--ktdb-radius-sm);
	font-weight: 700;
	cursor: pointer;
}
#submit:hover { background: var(--ktdb-primary-dark); }
.comment-navigation { display: flex; justify-content: space-between; margin-bottom: 12px; }
.no-comments { color: var(--ktdb-ink-soft); }

/* ============ Sidebar widgets ============ */
.widget {
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius);
	padding: 18px 20px;
}
.widget-title {
	font-size: 15px;
	font-weight: 800;
	margin: 0 0 12px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--ktdb-primary-light);
}
.widget ul { list-style: none; margin: 0; padding: 0; }
.widget ul li { padding: 6px 0; border-bottom: 1px solid var(--ktdb-line); font-size: 14px; }
.widget ul li:last-child { border-bottom: 0; }
.widget_search .search-form { display: flex; gap: 8px; }
.widget_search .search-field {
	flex: 1;
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-sm);
	padding: 9px 12px;
}
.widget_search .search-submit {
	background: var(--ktdb-primary);
	color: #fff;
	border: 0;
	border-radius: var(--ktdb-radius-sm);
	padding: 0 16px;
	font-weight: 700;
	cursor: pointer;
}

/* ============ Footer ============ */
.site-info { background: var(--ktdb-ink); color: #cfd2da; margin-top: 48px; }
.site-info .inside-site-info { max-width: var(--ktdb-container); margin: 0 auto; padding: 22px 20px; }
.copyright-bar { display: flex; justify-content: center; font-size: 13px; }
.copyright { color: #9aa0ac; }

/*
 * Footer widgets -- restructured to a single centered column (kituhay.com
 * pattern): logo/contact block on top, then each widget's link list laid
 * out as a horizontal "Link | Link | Link" row instead of a bullet list.
 * Only the CSS layout changes here -- widget content/text/links (managed
 * in Appearance > Widgets) are untouched.
 */
#footer-widgets { background: #14161b; color: #cfd2da; }
.inside-footer-widgets {
	max-width: 720px;
	margin: 0 auto;
	padding: 40px 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 22px;
}
.inside-footer-widgets [class^="footer-widget-"] { width: 100%; }
.inside-footer-widgets .widget {
	background: transparent;
	border: 0;
	padding: 0;
}
.inside-footer-widgets .widget-title {
	color: #fff;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: .04em;
	border-bottom: 0;
	padding-bottom: 0;
	margin-bottom: 10px;
}
.inside-footer-widgets a { color: #cfd2da; }
.inside-footer-widgets a:hover { color: #fff; }

/* Logo + address/phone/email block (footer-widget-1) */
.footer-widget-1 .textwidget p:first-child { margin-bottom: 12px; }
.footer-widget-1 .textwidget img { width: 72px; height: auto; }
.footer-widget-1 .textwidget p:last-child { line-height: 1.9; }

/* "THÔNG TIN" / "KẾT NỐI VỚI KTDB" -- horizontal pipe-separated link row */
.inside-footer-widgets .textwidget ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	row-gap: 6px;
}
.inside-footer-widgets .textwidget ul li:not(:last-child)::after {
	content: "|";
	margin: 0 10px;
	color: #5a5f6b;
}

/* "Tải ứng dụng" -- badges side by side instead of stacked via <br> */
.footer-widget-4 .textwidget p {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 16px;
}
.footer-widget-4 .textwidget p br { display: none; }

/* ============ Back to top ============ */
.generate-back-to-top {
	position: fixed;
	right: 20px; bottom: 20px;
	width: 44px; height: 44px;
	display: flex; align-items: center; justify-content: center;
	background: var(--ktdb-primary);
	color: #fff;
	border-radius: 50%;
	box-shadow: var(--ktdb-shadow-lg);
	z-index: 90;
	transition: opacity .2s ease, transform .2s ease;
}
.generate-back-to-top:hover { transform: translateY(-3px); color: #fff; }
.generate-back-to-top svg { width: 18px; height: 18px; fill: #fff; }

/* ============ Misc small elements ============ */
.btn,
.btn-go-home {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	background: var(--ktdb-primary);
	color: #fff;
	border: 0;
	border-radius: var(--ktdb-radius-sm);
	font-weight: 700;
	cursor: pointer;
}
.btn:hover,
.btn-go-home:hover { background: var(--ktdb-primary-dark); color: #fff; }

.page-title,
.page-header .page-title,
.archive .page-title {
	font-size: clamp(20px, 3vw, 28px);
	font-weight: 800;
	margin: 20px 0 16px;
}

.error-404,
.not-found { text-align: center; padding: 60px 20px; }
.error-404 .page-title { font-size: 64px; margin-bottom: 8px; }

.author-info { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.author-name { font-weight: 700; }
.mobile-bar-items { display: flex; align-items: center; gap: 10px; }
.clearfix::after { content: ""; display: table; clear: both; }
.gen-sidebar-nav { border-bottom: 1px solid var(--ktdb-line); }

/* ============ Responsive ============ */
@media (max-width: 960px) {
	.site-content { flex-direction: column; }
	#right-sidebar,
	#left-sidebar { width: 100%; flex-basis: 100%; }
	#right-sidebar .inside-right-sidebar,
	#left-sidebar .inside-left-sidebar { position: static; flex-direction: row; flex-wrap: wrap; }
	#right-sidebar .widget,
	#left-sidebar .widget { flex: 1 1 260px; }
}

@media (max-width: 600px) {
	.tin-lien-quan .list-post { grid-template-columns: 72px 1fr; }
	.comments-area { padding: 18px 16px; }
	#page { padding: 0 14px; }
}

/* ============ Mobile: menu thành thanh cuộn ngang thay vì wrap ============ */
@media (max-width: 600px) {
	/* Site has old Customizer "Additional CSS" (#wp-custom-css, printed after
	   every enqueued stylesheet -- always wins ties) with a leftover rule
	   `@media(max-width:768px){ nav#site-navigation{margin-top:-70px} }`
	   written for the old side-by-side logo+nav layout. Now that nav sits on
	   its own row below the logo, that negative margin pulls it up and over
	   the logo -- confirmed by measuring real overlapping coordinates.
	   Overriding here (matching its "nav#site-navigation" specificity)
	   instead of editing the Customizer content directly. */
	nav#site-navigation {
		margin-top: 0 !important;
	}

	/* Flex items default to min-width:auto (not 0), so without this the
	   whole flex chain (#site-navigation > .inside-navigation > .main-nav)
	   balloons to fit the nav's full unwrapped content width instead of
	   letting overflow-x:auto on the ul actually clip it at the viewport. */
	#site-navigation,
	#site-navigation .inside-navigation,
	.main-nav {
		min-width: 0;
	}
	.main-nav ul {
		min-width: 0;
		flex-wrap: nowrap;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scroll-snap-type: x proximity;
		justify-content: flex-start;
		padding: 8px 16px;
		gap: 6px;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}
	.main-nav ul::-webkit-scrollbar { display: none; }
	.main-nav ul li { flex: 0 0 auto; scroll-snap-align: start; }
	/* Slightly more compact than the base pill size so more items peek into
	   view at once (still >=44px tall for Google's tap-target minimum). */
	.main-nav ul li a {
		min-height: 44px;
		padding: 9px 13px;
		font-size: 12.5px;
	}
}

/* ============ Mobile: form tạo tên (#SymbolTextGenerator, name-generator-pro) ============ */
@media (max-width: 600px) {
	#SymbolTextGenerator > .container {
		width: 100%;
		margin-left: 0;
		margin-right: 0;
		padding: 15px;
	}
	#SymbolTextGenerator input,
	#SymbolTextGenerator button,
	#SymbolTextGenerator .btn {
		width: 100%;
		max-width: 100%;
	}
	#SymbolTextGenerator .row > [class*="col-"] {
		flex: 0 0 100%;
		max-width: 100%;
		margin-bottom: 8px;
	}
}

/* ============ Comment Widget (trang chủ) ============
 * Ngôn ngữ thị giác tham khảo trực tiếp từ widget thật của kituhay.com
 * (https://comment.kituhay.com/embed.php, xem qua Chrome thực tế):
 * bubble nền xám bo tròn quanh tên+nội dung, avatar tròn nhiều màu.
 */
.ktdb-comment-widget {
	margin-top: 32px;
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: var(--ktdb-radius-lg);
	box-shadow: var(--ktdb-shadow);
	padding: 20px 24px 24px;
}
.ktdb-comment-widget__title {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 16px;
	font-weight: 800;
	margin: 0 0 16px;
	color: var(--ktdb-ink);
}
.ktdb-comment-widget__title svg { color: var(--ktdb-ink-soft); }
.ktdb-comment-widget__dot { color: var(--ktdb-ink-soft); }
.ktdb-comment-widget__count {
	color: var(--ktdb-ink-soft);
	font-weight: 700;
}

.ktdb-comment-empty {
	color: var(--ktdb-ink-soft);
	font-size: 14px;
	padding: 14px 0 4px;
}

/* Avatar tròn nhiều màu, chữ cái đầu tên */
.ktdb-comment-avatar {
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-weight: 800;
	font-size: 14px;
}

.ktdb-comment-list {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
}
.ktdb-comment-item {
	display: flex;
	gap: 10px;
	padding: 10px 0;
}
.ktdb-comment-item__body { flex: 1; min-width: 0; }

/* Reply con: thụt vào bên dưới comment cha, avatar nhỏ hơn 1 chút để phân
   biệt cấp độ, có đường viền trái mảnh làm điểm nối trực quan. */
.ktdb-comment-list--nested {
	list-style: none;
	margin: 6px 0 0;
	padding: 0 0 0 18px;
	border-left: 2px solid var(--ktdb-line);
}
.ktdb-comment-item--reply .ktdb-comment-avatar {
	width: 28px;
	height: 28px;
	font-size: 12px;
}

/* Nhãn "Tác giả" cho comment do admin (moderate_comments) gửi */
.ktdb-comment-item__badge {
	display: inline-block;
	background: var(--ktdb-primary);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	padding: 1px 7px;
	border-radius: 999px;
	margin-left: 4px;
	vertical-align: middle;
}

/* Bubble nền xám bo tròn -- điểm nhận diện chính của widget kituhay.com */
.ktdb-comment-item__bubble {
	display: inline-block;
	max-width: 100%;
	background: var(--ktdb-bg);
	border-radius: 16px;
	padding: 8px 14px;
}
.ktdb-comment-item__author {
	display: block;
	font-weight: 700;
	font-size: 13px;
	color: var(--ktdb-ink);
}
.ktdb-comment-item__content {
	font-size: 14px;
	color: var(--ktdb-ink);
	word-break: break-word;
	white-space: pre-wrap;
}
.ktdb-comment-item__actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin: 4px 0 0 14px;
}
.ktdb-comment-item__date {
	font-size: 12px;
	color: var(--ktdb-ink-soft);
	font-weight: 600;
}

/* Nút "Thích" gọn -- hover/bấm hiện bảng chọn 5 cảm xúc, kiểu Facebook */
.ktdb-reaction-wrap {
	position: relative;
	display: inline-block;
}
.ktdb-reaction-main {
	background: transparent;
	border: 0;
	padding: 0;
	font-size: 12px;
	font-weight: 700;
	color: var(--ktdb-ink-soft);
	cursor: pointer;
	font-family: inherit;
}
.ktdb-reaction-main:hover { color: var(--ktdb-primary-dark); text-decoration: underline; }
.ktdb-reaction-main.is-active { text-decoration: none; cursor: default; }
.ktdb-reaction-main--like  { color: #1877f2; }
.ktdb-reaction-main--love  { color: #e0245e; }
.ktdb-reaction-main--haha,
.ktdb-reaction-main--angry { color: #f7b125; }
.ktdb-reaction-main--sad   { color: #6c7a89; }

.ktdb-reaction-picker {
	position: absolute;
	bottom: calc(100% + 8px);
	left: 0;
	display: none;
	align-items: center;
	gap: 2px;
	background: var(--ktdb-surface);
	border: 1px solid var(--ktdb-line);
	border-radius: 999px;
	padding: 6px 8px;
	box-shadow: var(--ktdb-shadow-lg);
	z-index: 20;
	white-space: nowrap;
}
/* Desktop: hiện khi hover. Bấm (is-open, xử lý ở JS) hỗ trợ thêm cho di động. */
.ktdb-reaction-wrap:not(.is-reacted):hover .ktdb-reaction-picker,
.ktdb-reaction-wrap.is-open .ktdb-reaction-picker {
	display: flex;
}
.ktdb-reaction-pick {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: transparent;
	border: 0;
	border-radius: 50%;
	font-size: 22px;
	line-height: 1;
	padding: 0;
	cursor: pointer;
	transition: transform .12s ease, background .12s ease;
}
.ktdb-reaction-pick:hover {
	background: var(--ktdb-bg);
	transform: scale(1.3) translateY(-4px);
}

.ktdb-reaction-total {
	font-size: 12px;
	color: var(--ktdb-ink-soft);
	font-weight: 600;
	white-space: nowrap;
}

.ktdb-reply-trigger {
	background: transparent;
	border: 0;
	padding: 0;
	font-size: 12px;
	font-weight: 700;
	color: var(--ktdb-ink-soft);
	cursor: pointer;
	font-family: inherit;
}
.ktdb-reply-trigger:hover { color: var(--ktdb-primary-dark); text-decoration: underline; }

.ktdb-reply-indicator {
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--ktdb-primary-light);
	color: var(--ktdb-primary-dark);
	font-size: 13px;
	padding: 7px 14px;
	border-radius: var(--ktdb-radius-sm);
	margin-bottom: 8px;
}
.ktdb-reply-indicator__author { font-weight: 800; }
#ktdb-reply-cancel {
	margin-left: auto;
	background: transparent;
	border: 0;
	color: var(--ktdb-primary-dark);
	font-weight: 700;
	font-size: 12.5px;
	text-decoration: underline;
	cursor: pointer;
	font-family: inherit;
}

/* Form: hàng gọn, avatar + input, giống thanh nhập 1 dòng của kituhay.com,
   nhưng vẫn có field Tên hiển thị riêng theo đúng yêu cầu (họ dùng Facebook
   Login nên không cần field tên -- site này không bắt đăng nhập). */
.ktdb-comment-form-wrap { margin: 0; }
.ktdb-comment-form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 8px;
}
.ktdb-comment-form .comment-form-author {
	flex: 1 1 140px;
	margin: 0;
}
.ktdb-comment-form .comment-form-comment {
	flex: 3 1 260px;
	margin: 0;
}
.ktdb-comment-form .comment-form-author input,
.ktdb-comment-form .comment-form-comment textarea {
	width: 100%;
	box-sizing: border-box;
	background: var(--ktdb-bg);
	border: 1px solid var(--ktdb-line);
	border-radius: 18px;
	padding: 9px 16px;
	font-family: inherit;
	font-size: 13.5px;
	resize: none;
}
.ktdb-comment-form .comment-form-comment textarea { border-radius: 14px; }
.ktdb-comment-form label { display: none; }
.ktdb-comment-form .form-submit {
	flex: 0 0 auto;
	margin: 0;
}
.ktdb-comment-submit {
	background: var(--ktdb-primary);
	color: #fff;
	border: 0;
	padding: 9px 20px;
	border-radius: 18px;
	font-weight: 700;
	font-size: 13.5px;
	cursor: pointer;
}
.ktdb-comment-submit:hover { background: var(--ktdb-primary-dark); }

@media (max-width: 600px) {
	.ktdb-comment-widget { padding: 16px 16px 20px; }
	.ktdb-comment-form { flex-direction: column; }
	.ktdb-comment-form .form-submit { align-self: flex-end; }
}
