/* sqlize-only layout (loaded from header.tpl when $SITE is sqlize; phpize never gets it).
   Editor toolbar: templates/sql-form.tpl ({if $SITE eq 'sqlize'} branch). Not minified by CI: keep it small. */

.block:has(> .sq-toolbar) { container-type: inline-size; }

.sq-toolbar {
	--sq-accent: #0069e6;
	--sq-danger: #e60000;
	--sq-soft: rgba(0, 105, 230, 0.08);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	padding: 2px 0 8px;
}
[data-theme="github_dark"] .sq-toolbar {
	--sq-accent: #6cb6ff;
	--sq-danger: #ff7b72;
	--sq-soft: rgba(108, 182, 255, 0.12);
}

.sq-server { display: flex; align-items: center; gap: 6px; flex: 1 1 240px; min-width: 0; }
.sq-server-label { font-weight: 600; font-size: 14px; }
/* #sql_version: style.css styles the id (light colours) for phpize; the id here wins over it */
#sql_version.sq-select {
	flex: 1;
	min-width: 0;
	max-width: 300px;
	height: 34px;
	padding: 0 6px;
	font-size: 14px;
	color: var(--text-color);
	background: var(--container-color);
	border: 1px solid var(--button-border-block-color);
	border-radius: 6px;
	cursor: pointer;
}
.sq-select optgroup { font-style: normal; font-weight: 600; }
.sq-select option { font-weight: normal; }

.sq-main-actions { display: flex; gap: 6px; }
.sq-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 34px;
	padding: 0 14px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	border: none;
	border-radius: 6px;
	cursor: pointer;
}
.sq-btn:hover { filter: brightness(1.08); }
.sq-btn:disabled { opacity: 0.6; cursor: progress; }
.sq-run { background: #0069e6; padding-left: 12px; }
[data-theme="github_dark"] .sq-run { background: #f0f0f0; color: #141414; }
[data-theme="github_dark"] .sq-run kbd { border-color: rgba(0, 0, 0, 0.3); }
/* Save and Share: outlined, so Run is the one filled button */
.sq-save, .sq-share {
	color: var(--text-color);
	background: transparent;
	border: 1px solid var(--button-border-block-color);
	font-weight: 500;
}
.sq-save:hover, .sq-share:hover { filter: none; background: var(--sq-soft); border-color: var(--sq-accent); }
.sq-run kbd {
	font: inherit;
	font-size: 11px;
	font-weight: normal;
	opacity: 0.85;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 3px;
	padding: 0 4px;
	margin-left: 2px;
}

.sq-tools { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; }
.sq-tool {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	height: 32px;
	padding: 0 8px;
	font: inherit;
	font-size: 13px;
	color: var(--sq-accent);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 6px;
	cursor: pointer;
	white-space: nowrap;
}
.sq-tool:hover { background: var(--sq-soft); border-color: var(--sq-accent); }
.sq-tool-danger { color: var(--sq-danger); }
.sq-tool-danger:hover { background: rgba(230, 0, 0, 0.07); border-color: var(--sq-danger); }
.sq-btn:focus-visible, .sq-tool:focus-visible, .sq-select:focus-visible {
	outline: 2px solid var(--sq-accent);
	outline-offset: 2px;
}

/* Run / Save / Share bar under the editor */
.sq-actions-bar { padding: 8px 0 0; }

/* Result toolbar (sql-form.tpl): title, Preserve toggle, Copy/Clear like the editor tools */
.sq-result-toolbar { min-height: 34px; }
.sq-result-title { font-weight: 600; font-size: 14px; }
.sq-preserve { position: relative; }
.sq-preserve input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.sq-preserve:has(input:checked) { background: var(--sq-soft); border-color: var(--sq-accent); }
.sq-preserve:has(input:checked) svg path { fill: currentColor; }
.sq-preserve:has(input:focus-visible) { outline: 2px solid var(--sq-accent); outline-offset: 2px; }

/* A narrow editor column (two columns on a small laptop): tools show icons only, the title is the tooltip */
@container (max-width: 760px) {
	.sq-tool span { display: none; }
	.sq-tool { padding: 0 6px; }
}

/* The licence notice stays (it covers Run too: every run stores the snippet), as one quiet line */
.block .data-use-notice.sq-notice {
	margin: 8px 0 0;
	padding: 0;
	border: none;
	background: none;
	color: #8a8f98;
	font-size: 12px;
	line-height: 1.4;
}
.block .data-use-notice.sq-notice a { font-weight: normal; color: inherit; }

@media (max-width: 860px) {
	.sq-server { flex-basis: 100%; }
	#sql_version.sq-select { max-width: none; height: 40px; }
	.sq-btn { height: 40px; }
	.sq-tool { height: 40px; min-width: 40px; justify-content: center; }
}

/* ---- Compact header (site-link.tpl, sqlize branch) ---- */
.sq-header {
	--sq-accent: var(--accent-color, #0069e6);
	--sq-soft: rgba(0, 105, 230, 0.1);
	padding: 8px 16px;
	gap: 8px 16px;
}
[data-theme="github_dark"] .sq-header { --sq-soft: rgba(108, 182, 255, 0.14); }
.sq-header .header-title { display: flex; align-items: baseline; gap: 14px; font-size: 1.15rem; }
.sq-header .header-title a.sister-site { font-weight: 500; }
.sq-header-links { display: flex; align-items: center; gap: 18px; font-size: 15px; }
.sq-header-links > a:hover, .sq-account summary:hover { color: var(--sq-accent); }
.sq-tokens {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 12px;
	border-radius: 999px;
	background: var(--sq-soft);
	font-weight: 600;
	white-space: nowrap;
}
.header a.sq-tokens, .header a.sq-tokens:visited { color: var(--sq-accent); }
.header a.sq-tokens.sq-tokens-empty { color: #c62828; background: rgba(198, 40, 40, 0.1); }
[data-theme="github_dark"] .header a.sq-tokens.sq-tokens-empty { color: #ff7b72; }
/* Under 1,000 tokens (plan §7.3) */
.header a.sq-tokens.sq-tokens-low { color: #9a6700; background: rgba(212, 167, 44, 0.15); }
[data-theme="github_dark"] .header a.sq-tokens.sq-tokens-low { color: #e3b341; }

.sq-icon-link { display: inline-flex; align-items: center; gap: 5px; }
.sq-icon-link svg { flex-shrink: 0; }
.sq-account { position: relative; }
.sq-account summary {
	list-style: none;
	cursor: pointer;
	color: var(--header-text-color);
}
.sq-account summary::-webkit-details-marker { display: none; }
/* Chevron sized to match the 18px icons; points up while the menu is open */
.sq-account summary::after {
	content: "";
	width: 7px;
	height: 7px;
	margin: -4px 2px 0 3px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s;
}
.sq-account[open] summary::after { margin-top: 4px; transform: rotate(-135deg); }
.sq-account-menu {
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	min-width: 170px;
	padding: 4px 0;
	background: var(--container-color);
	border: 1px solid var(--header-border-color);
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
	z-index: 1000;
}
.header .sq-account-menu a { display: block; padding: 7px 14px; color: var(--text-color); }
.header .sq-account-menu a:hover { background: var(--button-hover-color); }
.sq-signin { font-weight: 600; }

/* ShareThis sticky bar (sqlize.tpl): a small horizontal row in the bottom-right corner instead of
   a vertical strip on the right edge, so the page needs no reserved margin. ShareThis injects its
   own styles (some !important), hence the !important here. It hides the bar at max-width 1024px. */
@media (min-width: 1025px) {
	.st-sticky-share-buttons.st-right {
		top: auto !important;
		bottom: 16px !important;
		right: 16px !important;
		left: auto !important;
		display: flex !important;
		flex-direction: row;
		gap: 4px;
		width: auto !important;
	}
	.st-sticky-share-buttons.st-right .st-btn {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		position: relative !important;
		left: auto !important;
		width: 36px !important;
		min-width: 36px !important;
		height: 36px !important;
		margin: 0 !important;
		padding: 0 !important;
		border-radius: 6px !important;
		transition: transform 0.15s !important;
	}
	.st-sticky-share-buttons.st-right .st-btn:hover { transform: translateY(-2px); width: 36px !important; }
	.st-sticky-share-buttons.st-right .st-btn img { position: static !important; margin: 0 !important; }
	.st-sticky-share-buttons.st-right .st-label,
	.st-sticky-share-buttons.st-right .st-total,
	.st-sticky-share-buttons.st-right .st-toggle { display: none !important; }
}

/* ---- Pricing, Terms, Refunds (templates/pricing.tpl, terms.tpl, refunds.tpl) ---- */
.lg-page {
	--lg-accent: #0069e6;
	--lg-border: var(--button-border-block-color, #d0d7de);
	--lg-muted: #6e7781;
	--lg-soft: rgba(0, 105, 230, 0.07);
	max-width: 980px;
	margin: 0 auto;
	padding: 24px 16px 40px;
	line-height: 1.6;
}
[data-theme="github_dark"] .lg-page { --lg-accent: #6cb6ff; --lg-muted: #8b949e; --lg-soft: rgba(108, 182, 255, 0.1); }
.lg-doc { max-width: 760px; }
.lg-page h1 { margin: 0 0 8px; }
.lg-doc h2 { margin: 28px 0 8px; font-size: 19px; }
.lg-page h3 { margin: 18px 0 4px; font-size: 16px; }
.lg-updated { color: var(--lg-muted); font-size: 14px; margin-top: 0; }
.lg-lead { font-size: 16px; max-width: 720px; }
.lg-hero { text-align: center; margin-bottom: 28px; }
.lg-hero .lg-lead { margin: 0 auto; }

.lg-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.lg-pack {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 22px 20px 20px;
	background: var(--container-color);
	border: 1px solid var(--lg-border);
	border-radius: 12px;
}
.lg-pack-featured { border: 2px solid var(--lg-accent); box-shadow: 0 6px 24px rgba(0, 105, 230, 0.12); }
.lg-pack-tag {
	position: absolute;
	top: -11px;
	left: 50%;
	transform: translateX(-50%);
	padding: 1px 10px;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: var(--lg-accent);
	border-radius: 999px;
	white-space: nowrap;
}
[data-theme="github_dark"] .lg-pack-tag { color: #0d1117; }
.lg-page .lg-pack-name { margin: 0; font-size: 18px; }
.lg-pack-price { margin: 10px 0 2px; font-size: 36px; font-weight: 700; line-height: 1.1; }
.lg-pack-price span { font-size: 14px; font-weight: 500; color: var(--lg-muted); }
.lg-pack-tokens { font-size: 16px; font-weight: 600; color: var(--lg-accent); }
.lg-pack-facts { flex: 1; margin: 14px 0 18px; padding: 0; list-style: none; font-size: 14px; }
.lg-pack-facts li { padding: 4px 0 4px 22px; position: relative; }
.lg-pack-facts li::before {
	content: "";
	position: absolute;
	left: 3px;
	top: 9px;
	width: 9px;
	height: 5px;
	border-left: 2px solid var(--lg-accent);
	border-bottom: 2px solid var(--lg-accent);
	transform: rotate(-45deg);
}
.lg-buy {
	height: 40px;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	color: #fff;
	background: #0069e6;
	border: none;
	border-radius: 8px;
	cursor: pointer;
}
.lg-buy:hover:not(:disabled) { filter: brightness(1.08); }
.lg-buy:disabled { opacity: 0.55; cursor: not-allowed; }
[data-theme="github_dark"] .lg-buy { color: #141414; background: #f0f0f0; }
.lg-buy:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; }
/* Localized prices (Paddle.PricePreview, js/paddle-checkout.js): body.prices-localized once they arrive */
.lg-note-local, .prices-localized .lg-usd, .prices-localized .lg-note-usd { display: none; }
.prices-localized .lg-note-local { display: inline; }
/* Checkout progress (js/paddle-checkout.js) */
.lg-status { margin: 16px 0 0; padding: 10px 14px; text-align: center; font-size: 14px; border: 1px solid var(--lg-border); border-radius: 8px; }
.lg-status.checkout-status-done { border-color: #2e9d57; }
.lg-status.checkout-status-late { border-color: #d08a00; }
.lg-note { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--lg-muted); }
.lg-section { margin-top: 36px; }
.lg-section h2 { font-size: 20px; margin-bottom: 6px; }
.lg-links { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--lg-border); font-size: 14px; color: var(--lg-muted); }

/* My AI usage (templates/ai-usage.tpl) */
.us-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.us-card { padding: 14px 16px; border: 1px solid var(--lg-border); border-radius: 10px; }
.us-card-main { border-color: var(--lg-accent); }
.us-label { font-size: 13px; color: var(--lg-muted); }
.us-value { font-size: 24px; font-weight: 700; }
.us-value small { font-size: 14px; font-weight: 400; color: var(--lg-muted); }
.us-sub { font-size: 13px; color: var(--lg-muted); }
.us-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.us-buy .lg-buy, .us-signin { padding: 0 16px; }
.us-link { font-size: 14px; color: var(--lg-accent); margin-left: 4px; }
.us-table-wrap { overflow-x: auto; }
.us-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.us-table th, .us-table td { padding: 6px 10px; border-bottom: 1px solid var(--lg-border); text-align: left; vertical-align: top; }
.us-table th { font-size: 13px; font-weight: 600; color: var(--lg-muted); }
.us-table .us-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.us-date { white-space: nowrap; color: var(--lg-muted); }
.us-plus { color: #1a7f37; }
[data-theme="github_dark"] .us-plus { color: #56d364; }
.us-model, .us-id { font-size: 12px; color: var(--lg-muted); font-family: monospace; }
.us-status { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--lg-border); }
.us-status-paid { color: #1a7f37; border-color: #1a7f37; }
.us-status-refunded { color: #9a6700; border-color: #9a6700; }
.us-empty, .us-note { color: var(--lg-muted); font-size: 14px; }
.us-empty a, .us-note a { color: var(--lg-accent); }
.us-pages { display: flex; gap: 16px; justify-content: center; margin-top: 12px; font-size: 14px; }
.us-pages a { color: var(--lg-accent); }
@media (max-width: 640px) {
	.us-cards { grid-template-columns: 1fr; }
	.us-id { display: none; }
}
