/**
 * Readability Analyzer - Input Section
 *
 * Textarea, audience selector, analyze button, Focus Mode toggle,
 * and live score preview.
 *
 * @package AgenticWP
 */

/* ============================================
   Input Section
   ============================================ */

.readability-input-section {
	position: relative;
	padding: 0 0 48px;
	margin-top: -24px;
}

.readability-input-card {
	position: relative;
	z-index: 1;
	background: linear-gradient(
		135deg,
		rgba(255, 255, 255, 0.9),
		rgba(255, 255, 255, 0.7)
	);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 20px;
	border: 1px solid rgba(255, 255, 255, 0.8);
	box-shadow:
		0 8px 32px rgba(0, 0, 0, 0.08),
		0 2px 8px rgba(0, 0, 0, 0.04);
	padding: 2rem;
	max-width: 800px;
	margin: 0 auto;
}

/* ============================================
   Audience Selector
   ============================================ */

.audience-selector {
	display: flex;
	align-items: center;
	gap: 1rem;
	margin-bottom: 1.5rem;
	flex-wrap: wrap;
}

.audience-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--ink);
}

.audience-label svg {
	color: var(--muted);
}

.audience-select-wrapper {
	position: relative;
	display: flex;
	align-items: center;
}

.audience-select {
	appearance: none;
	padding: 0.5rem 2.5rem 0.5rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--ink);
	background: rgba(255, 255, 255, 0.8);
	border: 1px solid var(--line);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.audience-select:hover {
	border-color: #d1d5db;
}

.audience-select:focus {
	outline: none;
	border-color: var(--readability-accent);
	box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.select-arrow {
	position: absolute;
	right: 0.75rem;
	pointer-events: none;
	color: var(--muted);
}

/* ============================================
   Textarea Input
   ============================================ */

.input-area {
	margin-bottom: 1.5rem;
}

.content-textarea {
	width: 100%;
	min-height: 200px;
	padding: 1rem;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--ink);
	background: rgba(255, 255, 255, 0.8);
	border: 2px solid var(--line);
	border-radius: 12px;
	resize: vertical;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.content-textarea::placeholder {
	color: var(--muted);
}

.content-textarea:hover {
	border-color: #d1d5db;
}

.content-textarea:focus {
	outline: none;
	border-color: var(--readability-accent);
	box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
}

/* ============================================
   Input Meta (Word/Character Count & Hint)
   ============================================ */

.input-meta {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 0.75rem;
	gap: 1rem;
	flex-wrap: wrap;
}

.word-count {
	font-size: 0.875rem;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.word-current,
.char-current {
	font-weight: 600;
	color: var(--ink);
}

.char-divider {
	margin: 0 0.5rem;
	opacity: 0.5;
}

.content-hint {
	font-size: 0.8125rem;
	color: var(--muted);
}

/* ============================================
   Input Actions
   ============================================ */

.input-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
}

.action-group-left,
.action-group-right {
	display: flex;
	gap: 0.5rem;
}

.action-group-center {
	flex: 1;
	display: flex;
	justify-content: center;
}

/* Button icon style */
.btn-icon {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
}

.btn-icon svg {
	flex-shrink: 0;
}

/* Secondary button styles */
.btn-secondary {
	padding: 0.5rem 0.875rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--muted);
	background: rgba(255, 255, 255, 0.6);
	border: 1px solid var(--line);
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
	color: var(--ink);
	background: rgba(255, 255, 255, 0.9);
	border-color: #d1d5db;
}

.btn-secondary:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.2);
}

.btn-secondary:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Analyze button */
.analyze-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.875rem 2rem;
	font-size: 1rem;
	font-weight: 600;
	color: #fff;
	background: var(--gradient-green);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
	min-width: 200px;
}

.analyze-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(22, 163, 74, 0.3);
}

.analyze-btn:focus {
	outline: none;
	box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.3);
}

.analyze-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.analyze-btn .btn-loading {
	display: none;
	align-items: center;
	gap: 0.5rem;
}

.analyze-btn.loading .btn-text {
	display: none;
}

.analyze-btn.loading .btn-loading {
	display: inline-flex;
}

.analyze-btn .spinner {
	animation: spin 1s linear infinite;
}

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

/* Focus mode toggle */
.focus-mode-toggle {
	position: relative;
}

.focus-mode-toggle .icon-focus-off {
	display: none;
}

.focus-mode-toggle[aria-pressed="true"] .icon-focus-on {
	display: none;
}

.focus-mode-toggle[aria-pressed="true"] .icon-focus-off {
	display: block;
}

.focus-mode-toggle[aria-pressed="true"] {
	color: var(--readability-accent);
	background: rgba(22, 163, 74, 0.1);
	border-color: var(--readability-accent);
}

/* ============================================
   Error & Warning States
   ============================================ */

.input-error,
.input-warning {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1rem;
	padding: 0.75rem 1rem;
	font-size: 0.9375rem;
	border-radius: 8px;
}

.input-error {
	color: var(--tool-error);
	background: var(--tool-error-bg);
}

.input-warning {
	color: #92400e;
	background: #fef3c7;
}

.input-warning--info {
	color: #1e40af;
	background: #dbeafe;
}

.input-error[hidden],
.input-warning[hidden] {
	display: none;
}

.input-error svg,
.input-warning svg {
	flex-shrink: 0;
}

/* ============================================
   Live Score Preview
   ============================================ */

.live-score {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--line);
}

.live-score[hidden] {
	display: none;
}

.live-score-indicator {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.live-score-label {
	font-size: 0.9375rem;
	color: var(--muted);
}

.live-score-value {
	font-size: 1.5rem;
	font-weight: 700;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
	transition: color 0.3s ease;
}

.live-score-grade {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--muted);
	padding: 0.25rem 0.5rem;
	background: var(--tool-bg-subtle);
	border-radius: 4px;
}

/* ============================================
   No-JS Fallback
   ============================================ */

.no-js-message {
	margin-top: 1.5rem;
	padding: 1rem;
	text-align: center;
	color: var(--muted);
	background: var(--tool-bg-subtle);
	border-radius: 8px;
}

.no-js-message p {
	margin: 0;
}

/* ============================================
   Progress Indicator (for large documents)
   ============================================ */

.analysis-progress {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	margin-top: 1.5rem;
	padding-top: 1.5rem;
	border-top: 1px solid var(--line);
}

.analysis-progress[hidden] {
	display: none;
}

.progress-track {
	width: 100%;
	max-width: 300px;
	height: 6px;
	background: var(--tool-bg-subtle);
	border-radius: 3px;
	overflow: hidden;
}

.progress-bar {
	height: 100%;
	background: var(--gradient-green);
	border-radius: 3px;
	transition: width 0.3s ease;
}

.progress-text {
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

/* Toast styles consolidated in shared/components.css */

/* ============================================
   Focus Mode State
   ============================================ */

body.focus-mode .readability-results-section,
body.focus-mode .readability-annotated-section,
body.focus-mode .readability-benchmarks-section {
	display: none !important;
}
