/*
 * AIPro 2026: legal template (66:1456), cookie banner and settings (66:1677, 66:1691), 404 (67:1531), search (67:1720).
 */

/* ---------- Legal pages ---------- */
.legal-meta { padding: 18px 0; border-bottom: 1px solid var(--color-border); background: var(--color-soft-blue); font-size: 14px; }
.legal-meta-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.legal-meta p { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 0; color: var(--color-text-secondary); }
.legal-meta strong { color: var(--color-brand-navy); font-weight: 600; }
.legal-meta-actions { gap: 20px; }
.legal-print { padding: 0; border: 0; background: none; color: var(--color-brand-blue); font-weight: 600; }
.legal-print:hover { text-decoration: underline; }
.legal-thai { color: var(--color-muted-grey); font-weight: 600; cursor: not-allowed; }
.legal-body { padding: 64px 0 96px; }
.legal-layout { display: grid; grid-template-columns: 280px minmax(0, 760px); gap: 80px; align-items: start; }
.legal-aside { position: sticky; top: 112px; display: flex; flex-direction: column; gap: 24px; }
.admin-bar .legal-aside { top: 144px; }
.legal-toc { position: static; }
.legal-toc ol { display: flex; flex-direction: column; margin: 0; padding: 10px 0 0; list-style: none; }
.legal-toc a { display: flex; gap: 10px; padding: 8px 0 8px 14px; border-left: 2px solid var(--color-border); color: var(--color-text-secondary); font-size: 14px; font-weight: 500; line-height: 20px; }
.legal-toc .legal-toc-num { flex-shrink: 0; font-size: 13px; font-weight: 600; }
.legal-toc a:hover, .legal-toc a.is-active { border-color: var(--color-brand-blue); color: var(--color-brand-blue); font-weight: 600; }
.legal-related { display: flex; flex-direction: column; gap: 10px; }
.legal-main { display: flex; flex-direction: column; gap: 40px; min-width: 0; }
.legal-summary li { font-size: 16px; }
.legal-prose { counter-reset: legal; font-size: 16px; line-height: 27px; }
.legal-prose > * { margin-bottom: 14px; }
.legal-prose h2 { counter-increment: legal; margin: 26px 0 14px; font-size: 22px; line-height: 28px; letter-spacing: 0; }
.legal-prose > h2:first-child { margin-top: 0; }
.legal-prose h2::before { content: counter(legal) "."; margin-right: 12px; color: var(--color-brand-blue); }
.legal-prose ul li::marker { color: var(--color-brand-blue); }
.legal-prose table { overflow: hidden; border-radius: 12px; border-style: hidden; box-shadow: 0 0 0 1px var(--color-border); font-size: 14px; }
.legal-prose th, .legal-prose td { padding: 12px 18px; border-color: var(--color-border); }
.legal-prose th { color: var(--color-text-secondary); font-weight: 600; }
.legal-prose .wp-block-table { margin-inline: 0; }
.legal-prose .wp-block-table thead { border-bottom: 1px solid var(--color-border); }
.legal-contact { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; border: 1px solid var(--color-border); border-radius: 14px; }
.legal-contact p { margin: 0; color: var(--color-text-secondary); font-size: 14px; }
.legal-contact .legal-contact-title { margin-bottom: 4px; color: var(--color-brand-navy); font-size: 15px; font-weight: 700; }
.placeholder-note { padding: 14px 18px; border: 1px dashed var(--color-brand-blue); border-radius: 12px; background: rgba(8, 127, 245, .05); color: var(--color-text-primary); font-size: 14px; }
.legal-notice { display: flex; gap: 12px; margin: 0; padding: 16px 20px; border: 1px solid rgba(181, 71, 8, .3); border-radius: 12px; background: var(--color-warning-bg, #FFF6E5); color: var(--color-warning-text, #B54708); font-size: 14px; font-weight: 500; line-height: 23px; }
.legal-notice .icon { flex-shrink: 0; margin-top: 1px; }
.legal-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 12px; }
.legal-card { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--color-border); border-radius: 12px; color: var(--color-brand-navy); transition: border-color .2s ease; }
.legal-card:hover { border-color: var(--color-brand-blue); }
.legal-card-icon { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: var(--color-soft-blue); color: var(--color-brand-blue); }
.legal-card-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.legal-card-text strong { font-size: 16px; font-weight: 600; line-height: 24px; }
.legal-card-text span { color: var(--color-text-secondary); font-size: 13px; line-height: 20px; }
.legal-card-arrow { color: var(--color-brand-blue); font-size: 18px; font-weight: 600; }
@media print {
	.site-header, .site-footer, .legal-aside, .legal-meta-actions, .legal-cards, .cookie-banner, .legal-contact .button { display: none !important; }
	.legal-layout { display: block; }
	.page-hero { padding: 0 0 16px; background: none; }
}

/* ---------- Cookie banner and settings ---------- */
.cookie-banner { position: fixed; left: 24px; bottom: 24px; z-index: 1200; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; width: 440px; max-width: calc(100% - 48px); padding: 22px 24px; border: 1px solid var(--color-border); border-radius: var(--radius-card); background: var(--color-white); box-shadow: 0 16px 40px rgba(7, 30, 59, .14); }
.cookie-banner[hidden] { display: none; }
html { scroll-padding-bottom: var(--cookie-banner-space, 0px); }
.site-footer::after { content: ""; display: block; height: var(--cookie-banner-space, 0px); }
.cookie-banner p { margin: 0; }
.cookie-banner-title { color: var(--color-brand-navy); font-size: 17px; font-weight: 700; }
.cookie-banner-text { color: var(--color-text-secondary); font-size: 14px; line-height: 22px; }
.cookie-banner-links { display: flex; gap: 16px; font-size: 13px; font-weight: 600; }
.cookie-banner-links a { color: var(--color-brand-blue); }
.cookie-banner-links a:hover { text-decoration: underline; }
.cookie-banner-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; padding-top: 4px; }
.cookie-banner-actions .button { width: 100%; padding-inline: 12px; }
.cookie-banner-settings, .footer-legal [data-cookie-settings] { padding: 0; border: 0; background: none; color: inherit; font: inherit; }
.cookie-banner-settings { color: var(--color-text-secondary); font-size: 13px; font-weight: 600; }
.cookie-banner-settings:hover { color: var(--color-brand-blue); }
.cookie-modal { width: 560px; max-width: calc(100% - 32px); padding: 0; overflow: hidden; border: 0; border-radius: var(--radius-panel); box-shadow: 0 24px 60px rgba(7, 30, 59, .18); color: var(--color-text-primary); }
.cookie-modal::backdrop { background: rgba(7, 30, 59, .45); }
.cookie-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px 18px; border-bottom: 1px solid var(--color-border); }
.cookie-modal-head .cookie-modal-title { margin: 0; color: var(--color-brand-navy); font-size: 20px; font-weight: 700; line-height: 28px; }
.cookie-modal-close { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--color-text-secondary); font-size: 16px; }
.cookie-modal-close:hover { background: var(--color-soft-blue); }
.cookie-modal-list { margin: 0; padding: 8px 28px; list-style: none; }
.cookie-modal-list li { display: flex; align-items: center; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--color-border); }
.cookie-modal-list li:last-child { border-bottom: 0; }
.cookie-modal-text { flex: 1; }
.cookie-modal-text p { margin: 0; color: var(--color-text-secondary); font-size: 13px; line-height: 20px; }
.cookie-modal-text .cookie-modal-name { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; color: var(--color-brand-navy); font-size: 15px; font-weight: 700; }
.cookie-modal-name .pill { padding: 2px 8px; font-size: 11px; }
.switch { position: relative; flex-shrink: 0; width: 44px; height: 24px; }
.switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch input:disabled { cursor: not-allowed; }
.switch-track { position: absolute; inset: 0; border-radius: 12px; background: var(--color-border); transition: background-color .15s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--color-white); box-shadow: 0 1px 2px rgba(7, 30, 59, .2); transition: transform .15s ease; }
.switch input:checked + .switch-track { background: var(--color-brand-blue); }
.switch input:disabled + .switch-track { background: var(--color-muted-grey); }
.switch input:checked + .switch-track::after { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus-ring); }
.cookie-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 18px 28px 22px; background: var(--color-soft-blue); }

/* ---------- 404 ---------- */
.not-found { padding: 112px 0 120px; background: linear-gradient(180deg, var(--color-soft-blue) 0%, var(--color-white) 100%); }
.not-found-inner { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.not-found-code { margin: 0; background: var(--gradient-logo); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 160px; font-weight: 800; line-height: 160px; letter-spacing: -6px; }
.not-found h1 { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.not-found-text { max-width: 620px; margin: 0; color: var(--color-text-secondary); font-size: 18px; line-height: 29px; }
.not-found .button-row { justify-content: center; gap: 12px; padding-top: 8px; }
.not-found-popular { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 24px; }
.not-found-popular ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0; padding: 0; list-style: none; }
.not-found-popular a { display: inline-flex; gap: 6px; padding: 9px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); background: var(--color-white); color: var(--color-brand-navy); font-size: 14px; font-weight: 600; }
.not-found-popular a:hover { border-color: var(--color-brand-blue); color: var(--color-brand-blue); }
.not-found-cards { padding: 24px 0 120px; }
.not-found-cards .mini-label { margin: 0 0 24px; font-size: 14px; line-height: 22px; text-align: center; }
.not-found-cards ul { display: grid; grid-template-columns: repeat(4, minmax(0, 270px)); justify-content: center; gap: 20px; margin: 0; padding: 0; list-style: none; }
.not-found-card { display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 22px; border: 1px solid var(--color-border); border-radius: 14px; color: var(--color-text-secondary); font-size: 14px; line-height: 22px; transition: border-color .2s ease, box-shadow .2s ease; }
.not-found-card:hover { border-color: var(--color-brand-blue); box-shadow: var(--shadow-card, none); }
.not-found-card strong { color: var(--color-brand-navy); font-size: 17px; font-weight: 700; line-height: 26px; white-space: pre; }
.not-found-card-icon { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: var(--color-soft-blue); color: var(--color-brand-blue); }

/* ---------- Search box (404 and search) ---------- */
.search-box { display: flex; align-items: center; gap: 12px; width: 620px; max-width: 100%; height: 56px; padding: 0 8px 0 20px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-white); color: var(--color-text-secondary); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--color-text-primary); font-size: 16px; outline: none; }
.search-box .button { padding: 11px 18px; }
.search-box:focus-within { border-color: var(--color-brand-blue); box-shadow: var(--focus-ring); }
.search-box--active { width: 860px; border: 2px solid var(--color-brand-blue); }

/* ---------- Search results ---------- */
.search-header { padding: 56px 0 0; background: linear-gradient(163deg, var(--color-white) 0%, var(--color-soft-blue) 71%); }
.search-header-inner { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.search-header h1 { margin: 0; font-size: 44px; font-weight: 800; letter-spacing: -1px; }
.search-header h1 .accent { color: var(--color-brand-blue); }
.search-tabs { width: 100%; padding-top: 8px; border-bottom: 1px solid var(--color-border); }
.search-tabs ul { display: flex; gap: 28px; margin: 0; padding: 0; overflow-x: auto; list-style: none; }
.search-tabs a { display: inline-flex; align-items: center; gap: 8px; padding-bottom: 14px; border-bottom: 2px solid transparent; color: var(--color-text-secondary); font-size: 15px; font-weight: 600; white-space: nowrap; }
.search-tabs a.is-active { border-color: var(--color-brand-blue); color: var(--color-brand-blue); font-weight: 700; }
.search-count { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--color-soft-blue); color: var(--color-text-secondary); font-size: 12px; font-weight: 700; }
.search-tabs a.is-active .search-count { background: var(--color-brand-blue); color: var(--color-white); }
.search-body { padding: 32px 0 96px; }
.search-layout { display: grid; grid-template-columns: minmax(0, 860px) 276px; justify-content: space-between; gap: 64px; align-items: start; }
.search-summary { margin: 0; color: var(--color-text-secondary); font-size: 14px; }
.search-list { margin: 0 0 8px; padding: 0; list-style: none; }
.search-item { display: flex; flex-direction: column; gap: 8px; padding: 24px 0; border-bottom: 1px solid var(--color-border); }
.search-item p { margin: 0; }
.search-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--color-text-secondary); font-size: 13px; }
.search-item-meta .type-tag { background: var(--color-soft-blue); letter-spacing: 1px; }
.type-tag--service { background: rgba(7, 30, 59, .08); color: var(--color-brand-navy); }
.search-item h2 { margin: 0; font-size: 20px; line-height: 28px; }
.search-item h2 a:hover { text-decoration: underline; }
.search-item mark { background: none; color: var(--color-brand-blue); }
.search-item-text { color: var(--color-text-secondary); font-size: 15px; line-height: 24px; }
.search-item-text strong { color: var(--color-text-primary); }
.search-results .pager { justify-content: flex-start; padding-top: 28px; }
.search-empty { display: flex; flex-direction: column; gap: 10px; padding: 22px; border: 1px dashed var(--color-border); border-radius: var(--radius-card); }
.search-empty h2 { margin: 0; font-size: 20px; }
.search-empty p { margin: 0; color: var(--color-text-secondary); font-size: 14px; line-height: 22px; }
.search-empty-links { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* ---------- Tablet / mobile ---------- */
@media (max-width: 1024px) {
	.legal-layout { grid-template-columns: 1fr; gap: 40px; }
	.legal-aside { position: static; }
	.legal-aside .legal-toc { display: block; }
	.search-layout { grid-template-columns: 1fr; gap: 40px; }
	.not-found-cards ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
	.legal-body { padding: 40px 0 64px; }
	.legal-contact { flex-direction: column; align-items: flex-start; }
	.legal-cards { grid-template-columns: 1fr; }
	.cookie-banner { left: 0; right: 0; bottom: 0; width: 100%; max-width: none; padding: 20px; border-radius: 16px 16px 0 0; }
	.cookie-modal-actions { flex-direction: column-reverse; }
	.cookie-modal-actions .button { width: 100%; }
	.cookie-modal-head, .cookie-modal-list { padding-inline: 20px; }
	.not-found { padding: 64px 0 80px; }
	.not-found-code { font-size: 96px; line-height: 96px; letter-spacing: -3px; }
	.not-found h1 { font-size: 32px; }
	.not-found-text { font-size: 16px; line-height: 26px; }
	.not-found-cards { padding: 16px 0 72px; }
	.not-found-cards ul { grid-template-columns: 1fr; gap: 12px; }
	.search-box { height: auto; padding: 6px 6px 6px 14px; }
	.search-box .button { padding: 10px 14px; }
	.search-box .button-arrow { display: none; }
	.search-header { padding-top: 36px; }
	.search-header h1 { font-size: 30px; line-height: 37px; }
}
