/**
 * Bulk URL Opener — front-end styles.
 * All colors reference CSS custom properties so the admin "theme color"
 * and "button color" settings can override them via an inline <style> tag.
 */

.buo-wrapper {
	--buo-theme-color: #4f46e5;
	--buo-button-color: #4f46e5;
	--buo-bg: #ffffff;
	--buo-surface: #f8f9fc;
	--buo-border: #e3e6ef;
	--buo-text: #1f2333;
	--buo-text-muted: #6b7280;
	--buo-success: #16a34a;
	--buo-danger: #dc2626;
	--buo-radius: 14px;
	--buo-shadow: 0 4px 20px rgba(20, 20, 43, 0.06);

	box-sizing: border-box;
	max-width: 860px;
	margin: 2rem auto;
	padding: 2rem;
	background: var(--buo-bg);
	border: 1px solid var(--buo-border);
	border-radius: var(--buo-radius);
	box-shadow: var(--buo-shadow);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--buo-text);
}

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

.buo-wrapper.buo-theme-dark {
	--buo-bg: #14161f;
	--buo-surface: #1c1f2b;
	--buo-border: #2b2f40;
	--buo-text: #f2f3f7;
	--buo-text-muted: #a2a6b8;
	--buo-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.buo-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.buo-heading {
	margin: 0 0 0.35rem;
	font-size: 1.75rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--buo-text);
}

.buo-subtitle {
	margin: 0;
	color: var(--buo-text-muted);
	font-size: 0.98rem;
}

.buo-theme-toggle {
	flex-shrink: 0;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	border: 1px solid var(--buo-border);
	background: var(--buo-surface);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.1rem;
	transition: transform 0.15s ease, background-color 0.15s ease;
}

.buo-theme-toggle:hover {
	transform: translateY(-1px);
	background: var(--buo-border);
}

.buo-textarea {
	width: 100%;
	min-height: 220px;
	padding: 1rem;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.92rem;
	line-height: 1.5;
	color: var(--buo-text);
	background: var(--buo-surface);
	border: 1px solid var(--buo-border);
	border-radius: 10px;
	resize: vertical;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.buo-textarea:focus {
	outline: none;
	border-color: var(--buo-theme-color);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--buo-theme-color) 20%, transparent);
}

.buo-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin-top: 1rem;
}

.buo-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.6rem 1.1rem;
	font-size: 0.92rem;
	font-weight: 600;
	line-height: 1;
	color: var(--buo-text);
	background: var(--buo-surface);
	border: 1px solid var(--buo-border);
	border-radius: 999px;
	cursor: pointer;
	transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.buo-btn:hover {
	transform: translateY(-1px);
	box-shadow: 0 3px 10px rgba(20, 20, 43, 0.08);
}

.buo-btn:active {
	transform: translateY(0);
}

.buo-btn:focus-visible {
	outline: 2px solid var(--buo-theme-color);
	outline-offset: 2px;
}

.buo-btn-primary {
	color: #fff;
	background: var(--buo-button-color);
	border-color: var(--buo-button-color);
}

.buo-btn-ghost {
	background: transparent;
}

.buo-btn-small {
	padding: 0.45rem 0.85rem;
	font-size: 0.85rem;
}

.buo-btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}

.buo-progress {
	margin-top: 1.25rem;
}

.buo-progress-track {
	width: 100%;
	height: 10px;
	background: var(--buo-surface);
	border: 1px solid var(--buo-border);
	border-radius: 999px;
	overflow: hidden;
}

.buo-progress-fill {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, var(--buo-theme-color), var(--buo-button-color));
	border-radius: inherit;
	transition: width 0.25s ease;
}

.buo-progress-label {
	margin: 0.5rem 0 0;
	font-size: 0.85rem;
	color: var(--buo-text-muted);
}

.buo-popup-warning {
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	background: #fff4e5;
	border: 1px solid #ffd699;
	color: #92400e;
	border-radius: 10px;
	font-size: 0.9rem;
}

.buo-theme-dark .buo-popup-warning {
	background: #3a2c14;
	border-color: #5c4419;
	color: #fbbf24;
}

.buo-stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.75rem;
	margin-top: 1.5rem;
}

.buo-stat {
	padding: 0.9rem 0.5rem;
	text-align: center;
	background: var(--buo-surface);
	border: 1px solid var(--buo-border);
	border-radius: 10px;
}

.buo-stat-value {
	display: block;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.1;
}

.buo-stat-label {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.78rem;
	color: var(--buo-text-muted);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.buo-stat-valid .buo-stat-value {
	color: var(--buo-success);
}

.buo-stat-invalid .buo-stat-value {
	color: var(--buo-danger);
}

.buo-invalid-list {
	margin-top: 1.25rem;
	padding: 1rem;
	background: var(--buo-surface);
	border: 1px solid var(--buo-border);
	border-radius: 10px;
}

.buo-invalid-list h3 {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
}

.buo-invalid-list ul {
	margin: 0;
	padding-left: 1.1rem;
	max-height: 160px;
	overflow-y: auto;
}

.buo-invalid-list li {
	color: var(--buo-danger);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.85rem;
	word-break: break-all;
	margin-bottom: 0.25rem;
}

.buo-export {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem;
	margin-top: 1.25rem;
	padding-top: 1.1rem;
	border-top: 1px dashed var(--buo-border);
}

.buo-export-label {
	font-size: 0.85rem;
	color: var(--buo-text-muted);
	font-weight: 600;
}

.buo-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 782px) {
	.buo-wrapper {
		padding: 1.25rem;
		margin: 1rem;
		border-radius: 12px;
	}

	.buo-heading {
		font-size: 1.4rem;
	}

	.buo-stats {
		grid-template-columns: repeat(2, 1fr);
	}

	.buo-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.buo-btn {
		justify-content: center;
	}
}

@media (prefers-contrast: more) {
	.buo-wrapper {
		--buo-border: currentColor;
	}
}
