/* MultiToolsBox Tools: styles for tool interfaces, home sections and forms.
   Works with the MultiToolsBox theme and with block themes such as Twenty Twenty-Five. */
:root {
	--mtb-navy: #0b2a6f;
	--mtb-blue: #1d4ed8;
	--mtb-blue-dark: #1e40af;
	--mtb-blue-100: #dbeafe;
	--mtb-blue-50: #eff6ff;
	--mtb-ink: #0f172a;
	--mtb-muted: #52607a;
	--mtb-line: #d6e0f2;
	--mtb-soft: #f3f7ff;
	--mtb-bad: #b42318;
	--mtb-good: #067647;
	--mtb-radius: 14px;
}

.mtb-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mtb-tool [hidden], .mtb-catalog [hidden], .mtb-hero [hidden], .mtb-contact [hidden], .mtb-latest [hidden] { display: none !important; }
.mtb-muted { color: var(--mtb-muted); }
.mtb-bad { color: var(--mtb-bad); }
.mtb-icon { display: block; flex: none; }

/* ---------- Buttons and form controls ---------- */
.mtb-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 44px; padding: 0 18px; border: 1.5px solid var(--mtb-blue); border-radius: 10px;
	background: var(--mtb-blue); color: #fff; font: inherit; font-size: 0.95rem; font-weight: 650; line-height: 1.2;
	cursor: pointer; text-decoration: none; transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.mtb-btn:hover { background: var(--mtb-blue-dark); border-color: var(--mtb-blue-dark); color: #fff; }
.mtb-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.mtb-btn-outline { background: #fff; color: var(--mtb-blue); }
.mtb-btn-outline:hover { background: var(--mtb-blue-50); color: var(--mtb-blue-dark); border-color: var(--mtb-blue-dark); }
.mtb-btn-ghost { background: transparent; color: var(--mtb-ink); border-color: var(--mtb-line); }
.mtb-btn-ghost:hover { background: var(--mtb-soft); color: var(--mtb-ink); border-color: #b8c8e6; }
.mtb-btn-small { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }
.mtb-btn:focus-visible, .mtb-textarea:focus-visible, .mtb-input:focus-visible, .mtb-select:focus-visible, .mtb-range:focus-visible,
.mtb-output:focus-visible, .mtb-search-input:focus-visible, .mtb-tool-link:focus-visible, .mtb-check input:focus-visible {
	outline: 3px solid #93b4ff; outline-offset: 2px;
}

.mtb-label { display: block; margin: 0 0 6px; font-size: 0.92rem; font-weight: 650; color: var(--mtb-ink); }
.mtb-textarea, .mtb-input, .mtb-select, .mtb-output {
	width: 100%; box-sizing: border-box; padding: 11px 14px; border: 1.5px solid var(--mtb-line); border-radius: 12px;
	background: #fff; color: var(--mtb-ink); font: inherit; font-size: 1rem; line-height: 1.5;
}
.mtb-textarea { min-height: 160px; resize: vertical; }
.mtb-input-short { max-width: 140px; }
.mtb-select { appearance: auto; min-height: 46px; }
.mtb-color { width: 56px; height: 44px; padding: 3px; border: 1.5px solid var(--mtb-line); border-radius: 10px; background: #fff; cursor: pointer; }
.mtb-range { width: 100%; accent-color: var(--mtb-blue); }
.mtb-field { margin: 0 0 16px; }
.mtb-fieldset { margin: 0 0 8px; padding: 0; border: 0; }
.mtb-check { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 0.97rem; cursor: pointer; }
.mtb-check input { width: 20px; height: 20px; accent-color: var(--mtb-blue); }
.mtb-note { min-height: 1.2em; margin: 6px 0 0; font-size: 0.9rem; }
.mtb-subhead { margin: 24px 0 8px; font-size: 1.05rem; }
.mtb-privacy-note { margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--mtb-line); font-size: 0.88rem; color: var(--mtb-muted); }

/* ---------- Tool container ---------- */
.mtb-tool {
	box-sizing: border-box; margin: 24px 0 36px; padding: clamp(16px, 3vw, 28px);
	background: #fff; border: 1px solid var(--mtb-line); border-radius: 18px;
	box-shadow: 0 8px 30px rgba(11, 42, 111, 0.07); color: var(--mtb-ink);
}
.mtb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }

/* ---------- Stats ---------- */
.mtb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-top: 20px; }
.mtb-stat { display: flex; flex-direction: column; gap: 2px; padding: 14px; background: var(--mtb-soft); border-radius: 12px; }
.mtb-stat-value { font-size: 1.55rem; font-weight: 750; line-height: 1.15; color: var(--mtb-navy); font-variant-numeric: tabular-nums; }
.mtb-stat-label { font-size: 0.84rem; color: var(--mtb-muted); }
.mtb-keywords { list-style: none; margin: 0; padding: 0; }
.mtb-keywords li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 2px; border-bottom: 1px solid var(--mtb-line); font-size: 0.95rem; }
.mtb-keywords li span:last-child { color: var(--mtb-muted); font-variant-numeric: tabular-nums; }

/* ---------- Character limit ---------- */
.mtb-limit { margin-top: 18px; }
.mtb-limit-row { display: flex; flex-wrap: wrap; gap: 10px; }
.mtb-limit-row .mtb-select { flex: 1 1 240px; width: auto; }
.mtb-limit-bar { height: 10px; margin-top: 12px; background: var(--mtb-blue-100); border-radius: 999px; overflow: hidden; }
.mtb-limit-fill { height: 100%; width: 0; background: var(--mtb-blue); border-radius: 999px; transition: width 0.15s; }
.mtb-limit-fill.is-near { background: #d97706; }
.mtb-limit-fill.is-over { background: #dc2626; }
.mtb-limit-msg { margin: 8px 0 0; font-size: 0.92rem; font-weight: 600; }

/* ---------- Case converter ---------- */
.mtb-case-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.mtb-case-buttons .mtb-btn { min-height: 40px; padding: 0 14px; font-size: 0.9rem; }

/* ---------- Password generator ---------- */
.mtb-output-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.mtb-output { flex: 1 1 260px; width: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; letter-spacing: 0.02em; background: var(--mtb-soft); }
.mtb-meter { margin: 14px 0 20px; }
.mtb-meter-track { height: 10px; background: var(--mtb-blue-100); border-radius: 999px; overflow: hidden; }
.mtb-meter-fill { height: 100%; width: 0; border-radius: 999px; background: var(--mtb-blue); transition: width 0.2s, background-color 0.2s; }
.mtb-meter-fill.is-weak { background: #dc2626; }
.mtb-meter-fill.is-fair { background: #d97706; }
.mtb-meter-fill.is-good { background: #2563eb; }
.mtb-meter-fill.is-strong { background: #16a34a; }
.mtb-meter-label { display: block; margin-top: 6px; font-size: 0.9rem; font-weight: 600; color: var(--mtb-muted); }

/* ---------- QR generator ---------- */
.mtb-qr { display: grid; gap: 24px; }
.mtb-qr-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 16px; margin-top: 8px; }
.mtb-qr-canvas-wrap { display: flex; align-items: center; justify-content: center; min-height: 240px; padding: 16px; background: var(--mtb-soft); border: 1px dashed #b8c8e6; border-radius: var(--mtb-radius); }
.mtb-qr-canvas-wrap canvas { display: block; width: 100%; max-width: 340px; height: auto; background: #fff; }
.mtb-qr-canvas-wrap canvas.is-empty { display: none; }
.mtb-qr-canvas-wrap:has(canvas.is-empty)::before { content: "Your QR code will appear here"; color: var(--mtb-muted); font-size: 0.95rem; }
.mtb-qr-status { margin: 12px 0 0; font-size: 0.9rem; }
.mtb-qr-privacy { grid-column: 1 / -1; margin-top: 0; }
@media (min-width: 840px) {
	.mtb-qr { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); align-items: start; }
	.mtb-qr-preview { position: sticky; top: 90px; }
}

/* ---------- Image compressor ---------- */
.mtb-drop {
	position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 20px; text-align: center;
	background: var(--mtb-blue-50); border: 2px dashed #8fb0f5; border-radius: 16px; cursor: pointer; transition: background-color 0.15s, border-color 0.15s;
}
.mtb-drop:hover, .mtb-drop.is-over { background: var(--mtb-blue-100); border-color: var(--mtb-blue); }
.mtb-drop:focus-within { outline: 3px solid #93b4ff; outline-offset: 2px; }
.mtb-file { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.mtb-drop-icon { color: var(--mtb-blue); }
.mtb-drop-title { font-weight: 700; font-size: 1.05rem; color: var(--mtb-ink); }
.mtb-drop-sub { font-size: 0.88rem; color: var(--mtb-muted); }
.mtb-compress-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 20px; margin-top: 20px; }
.mtb-img-list { list-style: none; margin: 12px 0 0; padding: 0; }
.mtb-img-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--mtb-line); }
.mtb-img-thumb { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; background: var(--mtb-soft); }
.mtb-img-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mtb-img-info { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.mtb-img-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.mtb-img-meta { font-size: 0.86rem; }
.mtb-img-btns { display: flex; gap: 8px; }
.mtb-img-summary { margin: 14px 0 0; font-weight: 700; color: var(--mtb-navy); }
@media (max-width: 560px) {
	.mtb-img-row { grid-template-columns: 56px minmax(0, 1fr); }
	.mtb-img-btns { grid-column: 1 / -1; }
}

/* ---------- Contact form and notices ---------- */
.mtb-contact { max-width: 640px; margin: 24px 0; }
.mtb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.mtb-notice { max-width: 640px; margin: 16px 0; padding: 14px 16px; border-radius: 12px; border: 1px solid; font-size: 0.97rem; }
.mtb-notice-ok { background: #ecfdf3; border-color: #a6e9c3; color: #05603a; }
.mtb-notice-bad { background: #fef3f2; border-color: #fecdca; color: #912018; }

/* ---------- Ads (rendered only when AdSense is configured) ---------- */
.mtb-ad { margin: 28px 0; min-height: 100px; text-align: center; overflow: hidden; }

/* ---------- Tool cards and catalog ---------- */
.mtb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.mtb-tool-card { margin: 0; background: #fff; border: 1px solid var(--mtb-line); border-radius: var(--mtb-radius); transition: border-color 0.15s, box-shadow 0.15s; }
.mtb-tool-card:hover { border-color: var(--mtb-blue); box-shadow: 0 8px 24px rgba(29, 78, 216, 0.12); }
.mtb-tool-link { display: flex; flex-direction: column; gap: 6px; height: 100%; box-sizing: border-box; padding: 20px; color: inherit; text-decoration: none; border-radius: var(--mtb-radius); }
.mtb-tool-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 12px; background: var(--mtb-blue-50); color: var(--mtb-blue); }
.mtb-tool-title { font-size: 1.08rem; font-weight: 700; color: var(--mtb-ink); }
.mtb-tool-desc { font-size: 0.93rem; line-height: 1.5; color: var(--mtb-muted); }
.mtb-cat { margin: 0 0 40px; }
.mtb-cat-title { margin: 0 0 4px; font-size: 1.5rem; letter-spacing: -0.01em; }
.mtb-cat-desc { margin: 0 0 16px; color: var(--mtb-muted); }
.mtb-noresults { padding: 24px; text-align: center; color: var(--mtb-muted); background: var(--mtb-soft); border-radius: var(--mtb-radius); }
.mtb-related { margin-top: 48px; }
.mtb-related-title { margin: 0 0 16px; font-size: 1.35rem; }

/* Search boxes */
.mtb-search { position: relative; display: flex; align-items: center; margin: 0 0 28px; }
.mtb-search-input { width: 100%; box-sizing: border-box; min-height: 52px; padding: 0 16px 0 46px; border: 1.5px solid var(--mtb-line); border-radius: 14px; background: #fff; color: var(--mtb-ink); font: inherit; font-size: 1.02rem; }
.mtb-search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); display: flex; color: var(--mtb-blue); pointer-events: none; }
.mtb-search-count { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 0.85rem; color: var(--mtb-muted); background: inherit; }

/* ---------- Home page ---------- */
.mtb-hero { margin: 0; padding: clamp(44px, 8vw, 92px) 0 clamp(40px, 7vw, 80px); background: linear-gradient(160deg, #0b2a6f 0%, #1d4ed8 100%); color: #fff; }
.mtb-hero-inner, .mtb-features-inner, .mtb-latest-inner { max-width: 1120px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
.mtb-hero-title { max-width: 18ch; margin: 0 0 16px; font-size: clamp(2.1rem, 5.4vw, 3.5rem); line-height: 1.06; font-weight: 800; letter-spacing: -0.03em; color: #fff; }
.mtb-hero-sub { max-width: 58ch; margin: 0 0 30px; font-size: clamp(1.02rem, 2vw, 1.18rem); line-height: 1.6; color: #dbe7ff; }
.mtb-hero-search { position: relative; display: flex; align-items: center; max-width: 680px; }
.mtb-hero-search .mtb-search-input { min-height: 60px; padding-left: 52px; border: 0; border-radius: 16px; font-size: 1.08rem; box-shadow: 0 14px 40px rgba(2, 12, 45, 0.35); }
.mtb-hero-search .mtb-search-icon { left: 18px; }
.mtb-hero-search .mtb-search-count { background: #fff; }
.mtb-chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; padding: 0; list-style: none; }
.mtb-chips a { display: inline-block; padding: 8px 16px; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 999px; color: #fff; font-size: 0.93rem; font-weight: 600; text-decoration: none; }
.mtb-chips a:hover { background: rgba(255, 255, 255, 0.16); border-color: #fff; color: #fff; }
.mtb-chips a:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.mtb-home-body { max-width: 1120px; margin: 0 auto; padding: 56px 20px 24px; box-sizing: border-box; }
.mtb-features { padding: 56px 0; background: var(--mtb-soft); }
.mtb-features-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; }
.mtb-feature h3 { margin: 12px 0 6px; font-size: 1.12rem; }
.mtb-feature p { margin: 0; color: var(--mtb-muted); line-height: 1.6; }
.mtb-feature-icon { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 12px; background: #fff; border: 1px solid var(--mtb-line); color: var(--mtb-blue); }
.mtb-latest { padding: 56px 0; }
.mtb-latest .mtb-cat-title { margin-bottom: 16px; }

@media (prefers-reduced-motion: reduce) {
	.mtb-btn, .mtb-tool-card, .mtb-drop, .mtb-limit-fill, .mtb-meter-fill { transition: none; }
}
