/**
 * YouTube Description Generator — Frontend styles
 * Copyright (c) 2026 TagGeniusAI
 *
 * All rules are scoped under .ydg-generator to avoid leaking into theme
 * styles or being overridden by them.
 */

.ydg-generator {
	--ydg-primary: #FF0000;
	--ydg-button: #FF0000;
	--ydg-radius: 8px;
	--ydg-border: #e2e2e2;
	--ydg-bg: #ffffff;
	--ydg-text: #1a1a1a;
	--ydg-muted: #6b7280;

	box-sizing: border-box;
	max-width: 720px;
	width: 100%;
	margin: 0 auto;
	padding: 24px;
	background: var(--ydg-bg);
	border: 1px solid var(--ydg-border);
	border-radius: var(--ydg-radius);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--ydg-text);
}

.ydg-generator *,
.ydg-generator *::before,
.ydg-generator *::after {
	box-sizing: border-box;
}

.ydg-header {
	margin-bottom: 20px;
}

.ydg-title {
	margin: 0 0 4px;
	font-size: 20px;
	font-weight: 700;
	color: var(--ydg-text);
}

.ydg-subtitle {
	margin: 0;
	font-size: 14px;
	color: var(--ydg-muted);
}

.ydg-field {
	margin-bottom: 16px;
	flex: 1 1 200px;
}

.ydg-field label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ydg-text);
}

.ydg-required {
	color: var(--ydg-primary);
}

.ydg-optional {
	font-weight: 400;
	color: var(--ydg-muted);
}

.ydg-input,
.ydg-textarea,
.ydg-select {
	width: 100%;
	padding: 10px 12px;
	font-size: 14px;
	border: 1px solid var(--ydg-border);
	border-radius: calc(var(--ydg-radius) * 0.6);
	background: #fff;
	color: var(--ydg-text);
	line-height: 1.4;
	font-family: inherit;
}

.ydg-input:focus,
.ydg-textarea:focus,
.ydg-select:focus {
	outline: 2px solid var(--ydg-primary);
	outline-offset: 1px;
	border-color: var(--ydg-primary);
}

.ydg-textarea {
	resize: vertical;
}

.ydg-hint {
	margin: 6px 0 0;
	font-size: 12px;
	color: var(--ydg-muted);
}

.ydg-field-row {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 16px;
}

.ydg-field-row .ydg-field {
	margin-bottom: 0;
}

.ydg-checkbox-row {
	align-items: center;
}

.ydg-checkbox-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
}

.ydg-checkbox-label input {
	width: 16px;
	height: 16px;
}

.ydg-form-actions {
	margin-top: 20px;
}

.ydg-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 20px;
	font-size: 14px;
	font-weight: 600;
	border: none;
	border-radius: var(--ydg-radius);
	cursor: pointer;
	transition: opacity 0.15s ease, transform 0.05s ease;
	font-family: inherit;
}

.ydg-button:active {
	transform: translateY(1px);
}

.ydg-button:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

.ydg-button-primary {
	background: var(--ydg-button);
	color: #fff;
	width: 100%;
}

.ydg-button-primary:hover:not(:disabled) {
	opacity: 0.92;
}

.ydg-button-secondary {
	background: #f3f4f6;
	color: var(--ydg-text);
}

.ydg-button-secondary:hover:not(:disabled) {
	background: #e5e7eb;
}

.ydg-button-tertiary {
	background: transparent;
	color: var(--ydg-muted);
	text-decoration: underline;
}

.ydg-error {
	margin-top: 12px;
	padding: 10px 12px;
	background: #fef2f2;
	color: #b91c1c;
	border-radius: calc(var(--ydg-radius) * 0.6);
	font-size: 13px;
}

.ydg-result {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--ydg-border);
}

.ydg-result-title {
	margin: 0 0 10px;
	font-size: 15px;
	font-weight: 700;
}

.ydg-result-textarea {
	width: 100%;
	min-height: 220px;
	padding: 12px;
	font-size: 14px;
	line-height: 1.6;
	border: 1px solid var(--ydg-border);
	border-radius: calc(var(--ydg-radius) * 0.6);
	font-family: inherit;
	color: var(--ydg-text);
	resize: vertical;
}

.ydg-result-meta {
	display: flex;
	gap: 20px;
	margin-top: 8px;
	font-size: 12px;
	color: var(--ydg-muted);
}

.ydg-result-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}

.ydg-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 16px;
	font-size: 14px;
	color: var(--ydg-muted);
}

.ydg-spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--ydg-border);
	border-top-color: var(--ydg-primary);
	border-radius: 50%;
	animation: ydg-spin 0.7s linear infinite;
}

@keyframes ydg-spin {
	to {
		transform: rotate(360deg);
	}
}

.ydg-branding {
	margin-top: 20px;
	padding-top: 14px;
	border-top: 1px solid var(--ydg-border);
	font-size: 11px;
	color: var(--ydg-muted);
	text-align: center;
}

/*
 * Bugfix: elements toggled with the native `hidden` HTML attribute
 * (loading indicator, result box, error message) must stay hidden even
 * though some of them also carry their own `display` value (e.g.
 * .ydg-loading uses display:flex once visible). A same-specificity class
 * rule can otherwise beat the browser's default `[hidden]{display:none}`
 * rule and cause the element to be visible on page load. This explicit,
 * higher-specificity override guarantees `hidden` always wins.
 */
.ydg-generator [hidden] {
	display: none !important;
}

.ydg-branding a {
	color: var(--ydg-muted);
	text-decoration: underline;
}

/* Responsive breakpoints */
@media (max-width: 480px) {
	.ydg-generator {
		padding: 16px;
	}

	.ydg-field-row {
		flex-direction: column;
		gap: 12px;
	}

	.ydg-result-actions {
		flex-direction: column;
	}

	.ydg-result-actions .ydg-button {
		width: 100%;
	}
}
