/**
 * Word Count Tool - Input Section
 *
 * Mode toggle tabs, textarea input, URL input, and action buttons.
 *
 * @package AgenticWP
 */

/* ============================================
   Interface Section
   ============================================ */

.word-count-interface-section {
	position: relative;
	padding: 0 0 48px;
	margin-top: -24px;
}

.word-count-interface-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;
}

/* ============================================
   Mode Toggle (Tabs)
   ============================================ */

.mode-toggle {
	display: flex;
	gap: 0.25rem;
	padding: 0.25rem;
	background: var(--tool-bg-subtle);
	border-radius: 10px;
	margin-bottom: 1.5rem;
}

.mode-toggle__btn {
	flex: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.625rem 1rem;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--muted);
	background: transparent;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.mode-toggle__btn svg {
	flex-shrink: 0;
}

.mode-toggle__btn:hover:not(.mode-toggle__btn--active) {
	color: var(--ink);
	background: rgba(255, 255, 255, 0.5);
}

.mode-toggle__btn--active {
	color: var(--ink);
	background: #fff;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mode-toggle__btn:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.mode-toggle__btn--active:focus {
	box-shadow:
		0 2px 8px rgba(0, 0, 0, 0.08),
		0 0 0 3px rgba(20, 184, 166, 0.2);
}

/* ============================================
   Input Panels
   ============================================ */

.input-panel {
	display: none;
}

.input-panel--active {
	display: block;
}

.input-panel[hidden] {
	display: none;
}

/* ============================================
   Text Input Area
   ============================================ */

.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(--word-count-accent);
	box-shadow: 0 0 0 4px rgba(20, 184, 166, 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);
}

/* ============================================
   URL Input Area
   ============================================ */

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

.url-input-label {
	display: block;
	font-size: 0.9375rem;
	font-weight: 500;
	color: var(--ink);
	margin-bottom: 0.75rem;
}

.url-input-wrapper {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	position: relative;
}

.url-input-icon {
	position: absolute;
	left: 1rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--muted);
	pointer-events: none;
}

.url-input {
	flex: 1;
	padding: 0.75rem 1rem 0.75rem 3rem;
	font-size: 1rem;
	color: var(--ink);
	background: rgba(255, 255, 255, 0.8);
	border: 2px solid var(--line);
	border-radius: 10px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.url-input::placeholder {
	color: var(--muted);
}

.url-input:hover {
	border-color: #d1d5db;
}

.url-input:focus {
	outline: none;
	border-color: var(--word-count-accent);
	box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.15);
}

.url-hint {
	font-size: 0.8125rem;
	color: var(--muted);
	margin: 0.5rem 0 0;
}

/* Analyze URL Button */
.analyze-url-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
	font-size: 0.9375rem;
	font-weight: 600;
	color: #fff;
	background: var(--gradient-teal);
	border: none;
	border-radius: 10px;
	cursor: pointer;
	white-space: nowrap;
	transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.analyze-url-btn:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(20, 184, 166, 0.3);
}

.analyze-url-btn:focus {
	outline: none;
	box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.3);
}

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

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

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

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

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

/* ============================================
   Extracted Content Preview
   ============================================ */

.extracted-content {
	margin-top: 1.5rem;
	padding: 1rem;
	background: var(--tool-bg-subtle);
	border-radius: 10px;
	border: 1px solid var(--tool-border);
}

.extracted-content[hidden] {
	display: none;
}

.extracted-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

.extracted-title {
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ink);
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.extracted-preview {
	font-size: 0.875rem;
	color: var(--muted);
	line-height: 1.6;
	max-height: 150px;
	overflow-y: auto;
}

/* ============================================
   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;
}

/* ============================================
   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;
}

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

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

.btn-icon .btn-text {
	line-height: 1;
}

/* 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(20, 184, 166, 0.2);
}

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

/* Small button variant */
.btn-sm {
	padding: 0.375rem 0.75rem;
	font-size: 0.8125rem;
}

/* Ghost button variant */
.btn-ghost {
	padding: 0.5rem 0.875rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--muted);
	background: transparent;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-ghost:hover:not(:disabled) {
	color: var(--ink);
	background: rgba(0, 0, 0, 0.05);
}

.btn-ghost:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.btn-ghost[hidden] {
	display: none;
}

/* Primary button (for export) */
.btn-primary {
	padding: 0.5rem 1rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: #fff;
	background: var(--gradient-teal);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.btn-primary:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.3);
}

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

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

/* ============================================
   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;
}

/* ============================================
   Keyframes
   ============================================ */

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