/**
 * WP Converter Toolkit - Modern Scoped Tailwind CSS Stylesheet
 * Responsive, mobile-friendly, clean and lightweight styles scoped to prevent theme conflicts.
 */

/* Root variables & Scoped Base */
.wpc-wrapper {
	--wpc-primary: #4f46e5;
	--wpc-primary-hover: #4338ca;
	--wpc-primary-light: #eef2ff;
	--wpc-primary-border: #c7d2fe;
	--wpc-secondary: #0ea5e9;
	--wpc-success: #10b981;
	--wpc-warning: #f59e0b;
	--wpc-danger: #ef4444;
	--wpc-bg-surface: #ffffff;
	--wpc-bg-subtle: #f8fafc;
	--wpc-text-main: #1e293b;
	--wpc-text-muted: #64748b;
	--wpc-border: #e2e8f0;
	--wpc-border-focus: #6366f1;
	--wpc-radius-lg: 1rem;
	--wpc-radius-md: 0.75rem;
	--wpc-radius-sm: 0.5rem;
	--wpc-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	--wpc-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--wpc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
	color: var(--wpc-text-main);
	line-height: 1.5;
	margin: 1.5rem auto;
	max-width: 1200px;
	box-sizing: border-box;
}

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

/* Header & Banner */
.wpc-header {
	text-align: center;
	margin-bottom: 2rem;
	padding: 0 1rem;
}

.wpc-header-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.35rem 0.85rem;
	background-color: var(--wpc-primary-light);
	color: var(--wpc-primary);
	border: 1px solid var(--wpc-primary-border);
	font-size: 0.8125rem;
	font-weight: 600;
	border-radius: 9999px;
	margin-bottom: 0.75rem;
}

.wpc-title {
	font-size: 1.875rem;
	font-weight: 800;
	letter-spacing: -0.025em;
	color: #0f172a;
	margin: 0 0 0.5rem 0;
	line-height: 1.25;
}

@media (min-width: 768px) {
	.wpc-title {
		font-size: 2.25rem;
	}
}

.wpc-subtitle {
	font-size: 1rem;
	color: var(--wpc-text-muted);
	max-width: 680px;
	margin: 0 auto;
	line-height: 1.5;
}

/* Suite Tab Navigation */
.wpc-tabs-container {
	display: flex;
	justify-content: center;
	margin-bottom: 1.5rem;
	padding: 0 0.5rem;
}

.wpc-tab-nav {
	display: inline-flex;
	background: #f1f5f9;
	padding: 0.375rem;
	border-radius: 9999px;
	border: 1px solid var(--wpc-border);
	max-width: 100%;
	overflow-x: auto;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wpc-tab-nav-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.625rem 1.25rem;
	border: none;
	background: transparent;
	color: var(--wpc-text-muted);
	font-size: 0.875rem;
	font-weight: 600;
	border-radius: 9999px;
	cursor: pointer;
	transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
	white-space: nowrap;
}

.wpc-tab-nav-btn:hover {
	color: var(--wpc-text-main);
}

.wpc-tab-nav-btn.wpc-tab-active {
	background: var(--wpc-bg-surface);
	color: var(--wpc-primary);
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.wpc-tab-nav-btn svg {
	width: 1.125rem;
	height: 1.125rem;
}

/* Tab Panels */
.wpc-tab-panel {
	display: none;
	animation: wpcFadeIn 0.25s ease-in-out;
}

.wpc-tab-panel.wpc-tab-panel-active {
	display: block;
}

@keyframes wpcFadeIn {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Dual Editor Card Layout */
.wpc-card {
	background: var(--wpc-bg-surface);
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius-lg);
	box-shadow: var(--wpc-shadow-md);
	overflow: hidden;
}

.wpc-grid-dual {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
	padding: 1.25rem;
}

@media (min-width: 900px) {
	.wpc-grid-dual {
		grid-template-columns: 1fr 1fr;
		gap: 1.25rem;
	}
}

/* Editor Panel */
.wpc-panel {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius-md);
	background: var(--wpc-bg-subtle);
	overflow: hidden;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.wpc-panel:focus-within {
	border-color: var(--wpc-border-focus);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.wpc-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.75rem 1rem;
	background: #ffffff;
	border-bottom: 1px solid var(--wpc-border);
	flex-wrap: wrap;
	gap: 0.5rem;
}

.wpc-panel-title {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 700;
	font-size: 0.875rem;
	color: #334155;
}

.wpc-badge {
	display: inline-block;
	font-size: 0.6875rem;
	font-weight: 700;
	padding: 0.125rem 0.5rem;
	border-radius: 9999px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.wpc-badge-devlys {
	background: #fef3c7;
	color: #b45309;
}

.wpc-badge-unicode {
	background: #dcfce7;
	color: #15803d;
}

.wpc-badge-ocr {
	background: #e0e7ff;
	color: #4338ca;
}

.wpc-panel-actions {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

/* Icon Buttons */
.wpc-btn-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: var(--wpc-radius-sm);
	border: 1px solid transparent;
	background: transparent;
	color: var(--wpc-text-muted);
	cursor: pointer;
	transition: all 0.15s;
}

.wpc-btn-icon:hover {
	background: #f1f5f9;
	color: var(--wpc-text-main);
	border-color: var(--wpc-border);
}

.wpc-btn-icon svg {
	width: 1rem;
	height: 1rem;
}

/* Textarea styling */
.wpc-textarea {
	width: 100%;
	min-height: 280px;
	height: 320px;
	padding: 1rem;
	border: none;
	resize: vertical;
	font-size: 1.0625rem;
	line-height: 1.7;
	color: var(--wpc-text-main);
	background: transparent;
	outline: none;
	font-family: inherit;
	tab-size: 4;
}

.wpc-textarea::placeholder {
	color: #94a3b8;
	font-size: 0.9375rem;
}

/* Metrics & Footer in Panel */
.wpc-panel-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0.5rem 1rem;
	background: #ffffff;
	border-top: 1px solid var(--wpc-border);
	font-size: 0.75rem;
	color: var(--wpc-text-muted);
	flex-wrap: wrap;
	gap: 0.5rem;
}

.wpc-metrics {
	display: flex;
	gap: 0.75rem;
}

.wpc-metrics span strong {
	color: var(--wpc-text-main);
	font-weight: 600;
}

/* Center Toolbar / Action Bar */
.wpc-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	padding: 1rem 1.25rem;
	background: #f8fafc;
	border-top: 1px solid var(--wpc-border);
	gap: 0.75rem;
}

.wpc-toolbar-left,
.wpc-toolbar-right {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	flex-wrap: wrap;
}

/* Buttons */
.wpc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	padding: 0.5625rem 1.125rem;
	font-size: 0.875rem;
	font-weight: 600;
	border-radius: var(--wpc-radius-md);
	border: 1px solid transparent;
	cursor: pointer;
	transition: all 0.15s ease-in-out;
	text-decoration: none;
	line-height: 1.25;
}

.wpc-btn svg {
	width: 1rem;
	height: 1rem;
}

.wpc-btn-primary {
	background-color: var(--wpc-primary);
	color: #ffffff;
	box-shadow: 0 1px 2px 0 rgba(79, 70, 229, 0.3);
}

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

.wpc-btn-primary:active {
	transform: scale(0.98);
}

.wpc-btn-secondary {
	background-color: #ffffff;
	color: var(--wpc-text-main);
	border-color: var(--wpc-border);
	box-shadow: var(--wpc-shadow-sm);
}

.wpc-btn-secondary:hover {
	background-color: #f1f5f9;
	border-color: #cbd5e1;
}

.wpc-btn-ghost {
	background-color: transparent;
	color: var(--wpc-text-muted);
}

.wpc-btn-ghost:hover {
	background-color: #e2e8f0;
	color: var(--wpc-text-main);
}

/* Font Size Control */
.wpc-font-control {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.75rem;
	color: var(--wpc-text-muted);
}

.wpc-font-control input[type="range"] {
	width: 80px;
	height: 4px;
	accent-color: var(--wpc-primary);
	cursor: pointer;
}

/* =========================================================
   Handwriting to Text OCR Component Styling
   ========================================================= */
.wpc-ocr-layout {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
	padding: 1.25rem;
}

@media (min-width: 992px) {
	.wpc-ocr-layout {
		grid-template-columns: 1.1fr 0.9fr;
	}
}

/* Drop Zone */
.wpc-dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 2.5rem 1.5rem;
	border: 2px dashed #cbd5e1;
	border-radius: var(--wpc-radius-md);
	background: #f8fafc;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease-in-out;
	min-height: 280px;
}

.wpc-dropzone:hover,
.wpc-dropzone.wpc-drag-active {
	border-color: var(--wpc-primary);
	background: var(--wpc-primary-light);
}

.wpc-dropzone-icon {
	width: 3.5rem;
	height: 3.5rem;
	color: var(--wpc-primary);
	margin-bottom: 1rem;
	background: #ffffff;
	padding: 0.75rem;
	border-radius: 50%;
	box-shadow: var(--wpc-shadow-sm);
}

.wpc-dropzone-title {
	font-size: 1.0625rem;
	font-weight: 700;
	color: #1e293b;
	margin: 0 0 0.25rem 0;
}

.wpc-dropzone-desc {
	font-size: 0.875rem;
	color: var(--wpc-text-muted);
	margin: 0 0 1rem 0;
}

.wpc-dropzone-shortcuts {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	justify-content: center;
}

.wpc-kbd {
	display: inline-block;
	padding: 0.15rem 0.4rem;
	font-size: 0.75rem;
	font-family: monospace;
	background: #e2e8f0;
	border-radius: 4px;
	color: #475569;
}

/* Preview Canvas Area */
.wpc-preview-area {
	position: relative;
	background: #0f172a;
	border-radius: var(--wpc-radius-md);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 280px;
}

.wpc-canvas-wrapper {
	width: 100%;
	max-height: 380px;
	overflow: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.wpc-preview-canvas {
	max-width: 100%;
	max-height: 340px;
	object-fit: contain;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
	background: #ffffff;
}

/* OCR Image Filter Controls Bar */
.wpc-filter-bar {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 0.625rem 1rem;
	background: #1e293b;
	border-top: 1px solid #334155;
	color: #f1f5f9;
	font-size: 0.8125rem;
}

.wpc-filter-group {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.wpc-filter-control {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
}

.wpc-filter-control input[type="range"] {
	width: 70px;
	height: 4px;
	accent-color: var(--wpc-secondary);
}

.wpc-filter-bar button {
	background: #334155;
	color: #ffffff;
	border: none;
	padding: 0.35rem 0.65rem;
	border-radius: var(--wpc-radius-sm);
	font-size: 0.75rem;
	cursor: pointer;
	transition: background 0.15s;
}

.wpc-filter-bar button:hover {
	background: #475569;
}

/* OCR Settings & Action Bar */
.wpc-ocr-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-top: 1rem;
}

.wpc-lang-select {
	padding: 0.5rem 0.85rem;
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius-md);
	background: #ffffff;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--wpc-text-main);
	outline: none;
	cursor: pointer;
}

.wpc-lang-select:focus {
	border-color: var(--wpc-primary);
}

/* Progress Bar */
.wpc-progress-wrapper {
	margin-top: 1rem;
	background: #f1f5f9;
	border: 1px solid var(--wpc-border);
	border-radius: var(--wpc-radius-md);
	padding: 0.75rem;
}

.wpc-progress-info {
	display: flex;
	justify-content: space-between;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #334155;
	margin-bottom: 0.35rem;
}

.wpc-progress-track {
	width: 100%;
	height: 8px;
	background: #e2e8f0;
	border-radius: 9999px;
	overflow: hidden;
}

.wpc-progress-bar {
	height: 100%;
	width: 0%;
	background: linear-gradient(90deg, #4f46e5, #06b6d4);
	border-radius: 9999px;
	transition: width 0.2s ease-in-out;
}

/* Confidence Badge */
.wpc-confidence-badge {
	display: inline-block;
	padding: 0.2rem 0.5rem;
	font-size: 0.75rem;
	font-weight: 700;
	border-radius: 4px;
}

.wpc-badge-success {
	background: #dcfce7;
	color: #15803d;
}

.wpc-badge-warning {
	background: #fef3c7;
	color: #b45309;
}

/* Camera Modal */
.wpc-camera-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.85);
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.wpc-camera-dialog {
	background: #0f172a;
	border-radius: var(--wpc-radius-lg);
	overflow: hidden;
	width: 100%;
	max-width: 640px;
	display: flex;
	flex-direction: column;
	box-shadow: var(--wpc-shadow-lg);
}

.wpc-camera-video {
	width: 100%;
	max-height: 480px;
	object-fit: cover;
	background: #000000;
}

.wpc-camera-controls {
	display: flex;
	justify-content: space-around;
	align-items: center;
	padding: 1rem;
	background: #1e293b;
}

/* Toast Notice */
.wpc-toast-notice {
	position: fixed;
	bottom: 2rem;
	right: 2rem;
	padding: 0.75rem 1.25rem;
	background: #1e293b;
	color: #ffffff;
	font-size: 0.875rem;
	font-weight: 600;
	border-radius: var(--wpc-radius-md);
	box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
	z-index: 999999;
	opacity: 0;
	transform: translateY(1rem);
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
	pointer-events: none;
}

.wpc-toast-visible {
	opacity: 1;
	transform: translateY(0);
}

.wpc-toast-success {
	background: #065f46;
	border-left: 4px solid #10b981;
}

.wpc-toast-warning {
	background: #78350f;
	border-left: 4px solid #f59e0b;
}

.wpc-toast-error {
	background: #7f1d1d;
	border-left: 4px solid #ef4444;
}

/* Utilities */
.wpc-hidden {
	display: none !important;
}

.wpc-text-muted {
	color: var(--wpc-text-muted);
}
