/* ==========================================================================
   Tools Hub — front-end styles (dark UI inspired by file-tool dashboards)
   ========================================================================== */

.th-wrap {
	--th-bg: #0f1722;
	--th-card: #1b2532;
	--th-card-hover: #233044;
	--th-border: #2b384a;
	--th-text: #e6edf5;
	--th-muted: #9fb0c3;
	--th-accent: #ff6a3d;
	--th-accent-2: #4f8cff;
	--th-radius: 12px;

	max-width: 1280px;
	margin: 0 auto;
	padding: 24px 18px 64px;
	color: var(--th-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.6;
}

.th-wrap *,
.th-wrap *::before,
.th-wrap *::after { box-sizing: border-box; }

/* ---------- Hero & search ---------- */

.th-hero { text-align: center; padding: 18px 0 28px; }
.th-hero__title { font-size: clamp(1.7rem, 4vw, 2.6rem); margin: 0 0 10px; font-weight: 800; letter-spacing: -.02em; }
.th-hero__sub { color: var(--th-muted); max-width: 680px; margin: 0 auto 22px; font-size: 1.02rem; }

.th-search { max-width: 520px; margin: 0 auto; }
.th-search input {
	width: 100%;
	padding: 14px 18px;
	border-radius: 999px;
	border: 1px solid var(--th-border);
	background: var(--th-card);
	color: var(--th-text);
	font-size: 1rem;
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}
.th-search input:focus { border-color: var(--th-accent-2); box-shadow: 0 0 0 3px rgba(79,140,255,.25); }

/* ---------- Sections & grid ---------- */

.th-section { margin-top: 38px; }
.th-section__title {
	font-size: 1.25rem;
	font-weight: 700;
	margin: 0 0 16px;
	text-align: center;
	color: var(--th-text);
}

.th-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 14px;
}

.th-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	text-align: center;
	min-height: 132px;
	padding: 18px 12px;
	border-radius: var(--th-radius);
	background: var(--th-card);
	border: 1px solid var(--th-border);
	color: var(--th-text) !important;
	text-decoration: none !important;
	transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.th-card:hover {
	background: var(--th-card-hover);
	border-color: var(--th-accent);
	transform: translateY(-3px);
}
.th-card__icon { color: var(--th-accent); display: flex; }
.th-card:hover .th-card__icon { color: #fff; }
.th-card__name { font-size: .92rem; font-weight: 600; }

.th-empty { text-align: center; color: var(--th-muted); margin-top: 40px; }

/* ---------- Tool page ---------- */

.th-breadcrumb { font-size: .9rem; color: var(--th-muted); margin-bottom: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.th-breadcrumb a { color: var(--th-accent-2); text-decoration: none; }
.th-breadcrumb a:hover { text-decoration: underline; }
.th-breadcrumb__current { color: var(--th-text); }

.th-tool-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.th-tool-head__icon { color: var(--th-accent); flex: 0 0 auto; }
.th-tool-head__title { margin: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.th-tool-head__desc { margin: 4px 0 0; color: var(--th-muted); }

/* ---------- App / tool UI ---------- */

.th-app {
	background: var(--th-card);
	border: 1px solid var(--th-border);
	border-radius: 16px;
	padding: 24px;
	margin-bottom: 14px;
}

.th-drop {
	border: 2px dashed var(--th-border);
	border-radius: 14px;
	padding: 40px 20px;
	text-align: center;
	cursor: pointer;
	transition: border-color .15s, background .15s;
	color: var(--th-muted);
}
.th-drop:hover, .th-drop.is-over { border-color: var(--th-accent); background: rgba(255,106,61,.06); color: var(--th-text); }
.th-drop strong { color: var(--th-accent); }
.th-drop__hint { font-size: .85rem; margin-top: 6px; }

.th-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin: 16px 0; }
.th-field { display: flex; flex-direction: column; gap: 6px; }
.th-field label { font-size: .82rem; color: var(--th-muted); font-weight: 600; }
.th-field input[type=number],
.th-field input[type=text],
.th-field select,
.th-app textarea,
.th-app input[type=text],
.th-app input[type=number] {
	background: #0f1722;
	border: 1px solid var(--th-border);
	color: var(--th-text);
	border-radius: 8px;
	padding: 10px 12px;
	font-size: .95rem;
	outline: none;
}
.th-app textarea { width: 100%; min-height: 160px; resize: vertical; font-family: inherit; }
.th-app textarea.th-mono, .th-app .th-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.th-app input[type=range] { width: 220px; accent-color: var(--th-accent); }

.th-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--th-accent);
	color: #fff;
	border: none;
	border-radius: 10px;
	padding: 12px 22px;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	transition: filter .15s, transform .1s;
}
.th-btn:hover { filter: brightness(1.08); }
.th-btn:active { transform: translateY(1px); }
.th-btn:disabled { opacity: .5; cursor: not-allowed; }
.th-btn--ghost { background: transparent; border: 1px solid var(--th-border); color: var(--th-text); }
.th-btn--small { padding: 8px 14px; font-size: .88rem; }

.th-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

.th-result { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--th-border); }
.th-result img, .th-preview img { max-width: 100%; border-radius: 10px; border: 1px solid var(--th-border); }
.th-output {
	background: #0f1722; border: 1px solid var(--th-border); border-radius: 8px;
	padding: 12px; word-break: break-all; white-space: pre-wrap;
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88rem;
	max-height: 320px; overflow: auto;
}
.th-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px,1fr)); gap: 12px; }
.th-stat { background: #0f1722; border: 1px solid var(--th-border); border-radius: 10px; padding: 14px; text-align: center; }
.th-stat__num { font-size: 1.5rem; font-weight: 800; color: var(--th-accent); }
.th-stat__label { font-size: .78rem; color: var(--th-muted); margin-top: 4px; }

.th-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.th-thumb { position: relative; width: 90px; }
.th-thumb img { width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--th-border); }
.th-thumb button { position: absolute; top: -6px; right: -6px; background: #e23; color:#fff; border:none; border-radius:50%; width:20px; height:20px; cursor:pointer; line-height:1; }

.th-note { color: var(--th-muted); font-size: .9rem; }
.th-error { color: #ff6b6b; font-size: .92rem; margin-top: 10px; }
.th-success { color: #51cf66; }
.th-swatch { display:inline-block; width: 60px; height: 60px; border-radius: 10px; border: 1px solid var(--th-border); vertical-align: middle; }
.th-canvas-wrap { position: relative; display: inline-block; max-width: 100%; }
.th-canvas-wrap canvas { max-width: 100%; border-radius: 10px; cursor: crosshair; border: 1px solid var(--th-border); }

.th-privacy { text-align: center; color: var(--th-muted); font-size: .9rem; margin: 6px 0 30px; }

/* ---------- Article & table ---------- */

.th-article { max-width: 820px; margin: 30px auto 0; }
.th-article h2 { font-size: 1.5rem; margin: 34px 0 14px; }
.th-article h3 { font-size: 1.15rem; margin: 22px 0 10px; }
.th-article p, .th-article li { color: var(--th-text); }
.th-article ol, .th-article ul { padding-left: 22px; }
.th-article li { margin: 6px 0; }
.th-article code { background: #0f1722; padding: 2px 6px; border-radius: 5px; font-size: .9em; }

.th-table-wrap { overflow-x: auto; }
.th-table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: .95rem; }
.th-table th, .th-table td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--th-border); }
.th-table thead th { background: var(--th-card); color: var(--th-text); font-weight: 700; }
.th-table tbody tr:nth-child(odd) td { background: rgba(255,255,255,.02); }

.th-related { margin-top: 50px; }

/* ---------- Ad zones ---------- */
.th-ad { margin: 26px auto; max-width: 970px; text-align: center; clear: both; }
.th-ad__label { display: block; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: #6b7a8d; margin-bottom: 5px; }
.th-ad ins { display: block; }
.th-ad--placeholder { border: 1px dashed var(--th-border); border-radius: 10px; padding: 30px 12px; color: #6b7a8d; background: rgba(255,255,255,.02); }
.th-ad--placeholder span { font-size: .85rem; }

/* ---------- Home SEO content block ---------- */
.th-home-about { max-width: 820px; margin: 50px auto 0; }
.th-home-about h2 { font-size: 1.6rem; margin: 0 0 14px; }
.th-home-about h3 { font-size: 1.2rem; margin: 24px 0 10px; }
.th-home-about p { color: var(--th-text); }
.th-home-about ul { padding-left: 20px; }
.th-home-about li { margin: 7px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
	.th-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
	.th-card { min-height: 112px; }
	.th-app { padding: 16px; }
}
