/* =========================================================
   HTML Minifier Tool – Frontend Styles
   ========================================================= */

.hmt-wrapper {
	--hmt-bg: #0f1419;
	--hmt-surface: #1a2332;
	--hmt-border: #2d3a4f;
	--hmt-text: #e6edf3;
	--hmt-muted: #8b9cb3;
	--hmt-primary: #3b82f6;
	--hmt-primary-hover: #2563eb;
	--hmt-success: #22c55e;
	--hmt-danger: #ef4444;
	--hmt-radius: 10px;
	--hmt-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
	--hmt-mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;

	font-family: var(--hmt-font);
	color: var(--hmt-text);
	background: var(--hmt-bg);
	border-radius: 16px;
	padding: 24px;
	margin: 1.5rem 0;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
	line-height: 1.5;
	box-sizing: border-box;
}

.hmt-wrapper *,
.hmt-wrapper *::before,
.hmt-wrapper *::after {
	box-sizing: border-box;
}

/* Light theme override */
.hmt-theme-light {
	--hmt-bg: #f8fafc;
	--hmt-surface: #ffffff;
	--hmt-border: #e2e8f0;
	--hmt-text: #1e293b;
	--hmt-muted: #64748b;
	--hmt-primary: #2563eb;
	--hmt-primary-hover: #1d4ed8;
}

/* Header */
.hmt-header {
	text-align: center;
	margin-bottom: 28px;
}

.hmt-title {
	font-size: 1.75rem;
	font-weight: 700;
	margin: 0 0 8px;
	color: var(--hmt-text);
	letter-spacing: -0.02em;
}

.hmt-subtitle {
	font-size: 0.95rem;
	color: var(--hmt-muted);
	margin: 0;
	max-width: 640px;
	margin-inline: auto;
}

/* URL Section */
.hmt-url-section {
	background: var(--hmt-surface);
	border: 1px solid var(--hmt-border);
	border-radius: var(--hmt-radius);
	padding: 16px 18px;
	margin-bottom: 20px;
}

.hmt-label {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	margin-bottom: 10px;
	color: var(--hmt-text);
}

.hmt-url-row {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: stretch;
}

.hmt-url-input {
	flex: 1 1 220px;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid var(--hmt-border);
	border-radius: 8px;
	background: var(--hmt-bg);
	color: var(--hmt-text);
	font-size: 0.95rem;
	font-family: var(--hmt-mono);
	outline: none;
	transition: border-color 0.15s;
}

.hmt-url-input:focus {
	border-color: var(--hmt-primary);
	box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.hmt-url-hint {
	font-size: 0.78rem;
	color: var(--hmt-muted);
	margin: 10px 0 0;
}

/* Toolbar */
.hmt-toolbar {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	margin-bottom: 16px;
}

.hmt-toolbar-left,
.hmt-toolbar-right {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.hmt-indent-label {
	font-size: 0.85rem;
	color: var(--hmt-muted);
	display: flex;
	align-items: center;
	gap: 8px;
}

.hmt-select {
	padding: 7px 10px;
	border: 1px solid var(--hmt-border);
	border-radius: 6px;
	background: var(--hmt-surface);
	color: var(--hmt-text);
	font-size: 0.85rem;
	cursor: pointer;
}

/* Buttons */
.hmt-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 9px 16px;
	border: none;
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.15s, transform 0.1s, color 0.15s, border-color 0.15s;
	white-space: nowrap;
}

.hmt-btn:active {
	transform: scale(0.97);
}

.hmt-btn-primary {
	background: var(--hmt-primary);
	color: #fff;
}

.hmt-btn-primary:hover {
	background: var(--hmt-primary-hover);
}

.hmt-btn-secondary {
	background: var(--hmt-surface);
	color: var(--hmt-text);
	border: 1px solid var(--hmt-border);
}

.hmt-btn-secondary:hover {
	background: var(--hmt-border);
}

/* Toolbar action buttons (Minify / Beautify / Unminify) */
.hmt-action-btn {
	background: var(--hmt-surface);
	color: var(--hmt-text);
	border: 1px solid var(--hmt-border);
}

.hmt-action-btn:hover {
	background: var(--hmt-border);
}

.hmt-action-btn.is-active {
	background: var(--hmt-primary);
	color: #fff;
	border-color: var(--hmt-primary);
}

.hmt-action-btn.is-active:hover {
	background: var(--hmt-primary-hover);
	border-color: var(--hmt-primary-hover);
}

.hmt-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.hmt-icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	border: none;
	border-radius: 6px;
	background: transparent;
	color: var(--hmt-muted);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
}

.hmt-icon-btn:hover {
	background: var(--hmt-border);
	color: var(--hmt-text);
}

/* Editors */
.hmt-editors {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin-bottom: 16px;
}

.hmt-editor-panel {
	display: flex;
	flex-direction: column;
	background: var(--hmt-surface);
	border: 1px solid var(--hmt-border);
	border-radius: var(--hmt-radius);
	overflow: hidden;
	min-height: 280px;
}

.hmt-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	background: rgba(0, 0, 0, 0.15);
	border-bottom: 1px solid var(--hmt-border);
}

.hmt-theme-light .hmt-panel-header {
	background: #f1f5f9;
}

.hmt-panel-title {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--hmt-muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.hmt-panel-actions {
	display: flex;
	gap: 2px;
}

.hmt-textarea {
	flex: 1;
	width: 100%;
	min-height: 280px;
	padding: 14px;
	border: none;
	background: transparent;
	color: var(--hmt-text);
	font-family: var(--hmt-mono);
	font-size: 13px;
	line-height: 1.55;
	resize: vertical;
	outline: none;
}

/* CodeMirror overrides */
.hmt-wrapper .CodeMirror {
	height: auto;
	min-height: 280px;
	font-family: var(--hmt-mono);
	font-size: 13px;
	line-height: 1.55;
	background: transparent !important;
	color: var(--hmt-text);
	border: none;
}

.hmt-wrapper .CodeMirror-scroll {
	min-height: 280px;
}

.hmt-wrapper .CodeMirror-gutters {
	background: transparent;
	border-right: 1px solid var(--hmt-border);
}

.hmt-wrapper .CodeMirror-linenumber {
	color: var(--hmt-muted);
}

/* Stats */
.hmt-stats {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 16px;
	padding: 14px 18px;
	background: var(--hmt-surface);
	border: 1px solid var(--hmt-border);
	border-radius: var(--hmt-radius);
}

.hmt-stat {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 100px;
}

.hmt-stat-label {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--hmt-muted);
}

.hmt-stat-value {
	font-size: 1.1rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--hmt-text);
}

.hmt-stat-saved .hmt-stat-value {
	color: var(--hmt-success);
}

/* Status messages */
.hmt-status {
	min-height: 24px;
	font-size: 0.9rem;
	margin-bottom: 8px;
	padding: 0 4px;
}

.hmt-status.is-error {
	color: var(--hmt-danger);
}

.hmt-status.is-success {
	color: var(--hmt-success);
}

.hmt-status.is-info {
	color: var(--hmt-muted);
}

/* Responsive */
@media (max-width: 860px) {
	.hmt-editors {
		grid-template-columns: 1fr;
	}

	.hmt-wrapper {
		padding: 16px;
	}

	.hmt-title {
		font-size: 1.4rem;
	}

	.hmt-url-row {
		flex-direction: column;
	}

	.hmt-url-row .hmt-btn {
		width: 100%;
		justify-content: center;
	}
}

@media (max-width: 480px) {
	.hmt-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.hmt-toolbar-left,
	.hmt-toolbar-right {
		width: 100%;
		justify-content: stretch;
	}

	.hmt-toolbar-left .hmt-btn {
		flex: 1;
		justify-content: center;
	}
}