/* Modern CSS Reset & Variables */
:root {
	/* Colors */
	--primary: #06b6d4;
	/* cyan */
	--primary-dark: #0891b2;
	--primary-light: #60a5fa;
	--secondary: #10b981;
	/* green */
	--success: #10b981;
	--warning: #f59e0b;
	--error: #ef4444;

	/* Backgrounds */
	--bg-primary: #0a0d14;
	--bg-secondary: #111827;
	--bg-tertiary: #1f2937;
	--bg-surface: #374151;
	--bg-elevated: #4b5563;

	/* Text */
	--text-primary: #f9fafb;
	--text-secondary: #d1d5db;
	--text-muted: #9ca3af;
	--text-accent: #06b6d4;

	/* Borders */
	--border-primary: #374151;
	--border-secondary: #4b5563;
	--border-accent: #06b6d4;

	/* Shadows */
	--shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
	--shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
	--shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
	--shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.2);

	/* Gradients */
	--gradient-primary: linear-gradient(135deg, #60a5fa 0%, #06b6d4 100%);
	--gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #10b981 100%);
	--gradient-secondary-reverse: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
	--gradient-surface: linear-gradient(145deg, #1f293773 0%, #111827cc 100%);

	/* Border Radius */
	--radius-sm: 6px;
	--radius-md: 8px;
	--radius-lg: 12px;
	--radius-xl: 16px;
	--radius-2xl: 24px;

	/* Spacing */
	--space-xs: 0.25rem;
	--space-sm: 0.5rem;
	--space-md: 1rem;
	--space-lg: 1.5rem;
	--space-xl: 2rem;
	--space-2xl: 3rem;

	/* Typography */
	--font-size-xs: 0.65rem;
	--font-size-sm: 0.775rem;
	--font-size-base: .9rem;
	--font-size-lg: 1.025rem;
	--font-size-xl: 1.15rem;
	--font-size-2xl: 1.25rem;
	--font-size-3xl: 1.575rem;
	--font-size-4xl: 2.0rem;

	/* Animation */
	--transition-fast: 0.15s ease-in-out;
	--transition-base: 0.2s ease-in-out;
	--transition-slow: 0.3s ease-in-out;
}

* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	scroll-behavior: smooth;
}

body {
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	font-size: var(--font-size-base);
	line-height: 1.6;
	color: var(--text-primary);
	background: var(--bg-primary);
	overflow-x: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	opacity: 0;
	animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ThpaceGL Canvas Background */
#thpace-canvas {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: -2;
	pointer-events: none;
	display: block;
}

/* Background Pattern */
.background-pattern {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	background:
		radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
		radial-gradient(circle at 75% 75%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
		var(--bg-primary);
	background-size: 800px 800px;
	animation: float 20s ease-in-out infinite;
}

/* Animated Canvas Background */
#animatedBg {
	position: fixed;
	top: 0;
	left: 0;
	width: 100vw;
	height: 100vh;
	z-index: -2;
	background: transparent !important;
	pointer-events: none;
	display: block;
}

/* Background Pattern */
.background-pattern {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: -1;
	background:
		var(--bg-primary);
	background-size: 800px 800px;
	animation: float 20s ease-in-out infinite;
}

@keyframes float {

	0%,
	100% {
		transform: translate(0, 0) rotate(0deg);
	}

	33% {
		transform: translate(30px, -30px) rotate(1deg);
	}

	66% {
		transform: translate(-20px, 20px) rotate(-1deg);
	}
}

/* Animation Keyframes */
@keyframes fadeInUp {
	from {
		opacity: 0;
		transform: translateY(40px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes fadeIn {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

body {
	opacity: 0;
	animation: fadeIn 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.app-header {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.1s;
}

.main-content {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.2s;
}

.input-section {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.3s;
}

.preview-section {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.4s;
}

.preview-container {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.5s;
}

.action-buttons {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.6s;
}

.export-actions {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.7s;
}

.app-footer {
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.8s;
}

/* Layout */
.container {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 var(--space-lg);
}

/* Header */
.app-header {
	background: rgba(17, 24, 39, 0.6);
	backdrop-filter: blur(2px);
	border-bottom: 1px solid var(--border-primary);
	position: sticky;
	top: 0;
	z-index: 100;
	padding: var(--space-sm) 0;
}

.header-content {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.logo-section {
	display: flex;
	align-items: center;
	gap: var(--space-md);
}

.logo {
	width: 48px;
	height: 48px;
	border-radius: var(--radius-lg);
	background: var(--gradient-primary);
	display: flex;
	align-items: center;
	justify-content: center;
	color: white;
	box-shadow: var(--shadow-md);
}

.logo svg {
	width: 24px;
	height: 24px;
}

.app-header h1 {
	font-size: var(--font-size-2xl);
	font-weight: 700;
	color: var(--text-primary);
	margin: 0;
}

.tagline {
	font-size: var(--font-size-sm);
	color: var(--text-muted);
	margin: 0;
}

.header-badge {
	display: flex;
	align-items: right;
	gap: var(--space-sm);
}

.header-badge .badge {
	background: var(--gradient-primary);
	color: white;
	padding: var(--space-sm) var(--space-sm);
	border-radius: var(--radius-sm);
	font-size: var(--font-size-xs);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 2px;
}

/* Main Content */
.main-content {
	padding: var(--space-md) 0;
	min-height: calc(100vh - 170px);
}

.content-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-2xl);
	align-items: start;
}

/* Section Headers */
.section-header {
	margin-bottom: var(--space-xl);
}

.section-header h2 {
	font-size: var(--font-size-xl);
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: var(--space-sm);
	margin-top: var(--space-sm);
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.section-header p {
	color: var(--text-muted);
	font-size: var(--font-size-sm);
}

/* Input Section */
.input-section {
	background: var(--gradient-surface);
	border-radius: var(--radius-xl);
	padding: var(--space-xl);
	border: 1px solid var(--border-primary);
	box-shadow: var(--shadow-lg);
	position: relative;
	overflow: hidden;
}

.input-section::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: var(--gradient-primary);
}

.textarea-container {
	position: relative;
	margin-bottom: var(--space-lg);
}

#input {
	width: 100%;
	min-height: 300px;
	max-height: 500px;
	resize: none;
	background: var(--bg-secondary);
	border: 2px solid var(--border-primary);
	border-radius: var(--radius-lg);
	padding: var(--space-lg);
	color: var(--text-primary);
	font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
	font-size: var(--font-size-sm);
	line-height: 1.6;
	transition: var(--transition-base);
	outline: none;
	box-shadow: var(--shadow-sm);
}

#input:focus {
	border-color: var(--border-accent);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), var(--shadow-md);
}

#input::placeholder {
	color: var(--text-muted);
	opacity: 0.8;
}

.textarea-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: var(--space-sm);
	padding: 0 var(--space-sm);
}

.char-count {
	font-size: var(--font-size-xs);
	color: var(--text-muted);
}

.input-indicators {
	display: flex;
	gap: var(--space-md);
}

.indicator {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	font-size: var(--font-size-xs);
	color: var(--text-muted);
}

.indicator-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--text-muted);
	transition: var(--transition-base);
}

.indicator.active .indicator-dot {
	background: var(--success);
	box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* Buttons */
.action-buttons {
	display: flex;
	gap: var(--space-sm);
	flex-wrap: wrap;
	margin-bottom: var(--space-lg);
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-lg);
	border-radius: var(--radius-md);
	font-size: var(--font-size-sm);
	font-weight: 500;
	text-decoration: none;
	border: none;
	cursor: pointer;
	transition: var(--transition-base);
	position: relative;
	overflow: hidden;
	white-space: nowrap;
}

.btn svg {
	width: 18px;
	height: 18px;
}

.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none !important;
}

.btn-primary {
	background: var(--gradient-primary);
	color: white;
	box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
}

.btn-secondary {
	background: var(--bg-surface);
	color: var(--text-primary);
	border: 1px solid var(--border-secondary);
}

.btn-secondary:hover:not(:disabled) {
	background: var(--bg-elevated);
	border-color: var(--border-accent);
}

.btn-outline {
	background: transparent;
	color: var(--text-accent);
	border: 1px solid var(--border-accent);
}

.btn-outline:hover:not(:disabled) {
	background: rgba(99, 102, 241, 0.1);
}

.btn-ghost {
	background: transparent;
	border: 1px solid #103a4e;
	color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
	background: var(--bg-tertiary);
	color: var(--text-primary);
}

.icon-btn {
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--bg-surface);
	border: 1px solid var(--border-secondary);
	border-radius: var(--radius-md);
	color: var(--text-muted);
	cursor: pointer;
	transition: var(--transition-base);
}

.icon-btn:hover {
	background: var(--bg-elevated);
	color: var(--text-primary);
}

.icon-btn svg {
	width: 16px;
	height: 16px;
}

/* Status Message */
.status-message {
	padding: var(--space-sm) var(--space-md);
	border-radius: var(--radius-md);
	font-size: var(--font-size-sm);
	font-weight: 500;
	text-align: center;
	opacity: 0;
	transform: translateY(10px);
	transition: var(--transition-base);
}

.status-message.show {
	opacity: 1;
	transform: translateY(0);
}

.status-message.success {
	background: rgba(16, 185, 129, 0.1);
	color: var(--success);
	border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-message.error {
	background: rgba(239, 68, 68, 0.1);
	color: var(--error);
	border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-message.info {
	background: rgba(96, 165, 250, 0.1);
	color: var(--text-accent);
	border: 1px solid rgba(96, 165, 250, 0.2);
}

/* Preview Section */
.preview-container {
	background: var(--gradient-surface);
	border-radius: var(--radius-xl);
	padding: var(--space-xl);
	border: 1px solid var(--border-primary);
	box-shadow: var(--shadow-lg);
	position: relative;
	overflow: hidden;
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.5s;
}

.preview-container::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	background: var(--gradient-secondary);
}

.data-summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: var(--space-md);
	margin-bottom: var(--space-xl);
}

.summary-item {
	text-align: center;
	padding: var(--space-xs);
	background: var(--bg-secondary);
	border-radius: var(--radius-md);
	border: 1px solid var(--border-primary);
}

.summary-value {
	font-size: var(--font-size-xl);
	font-weight: 700;
	color: var(--text-accent);
	display: block;
}

.summary-label {
	font-size: var(--font-size-xs);
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-top: var(--space-xs);
}

/* Individual Navigation */
.individual-navigation {
	background: var(--bg-tertiary);
	border: 1px solid var(--border-primary);
	border-radius: var(--radius-lg);
	padding: var(--space-md);
	margin-bottom: var(--space-xl);
	box-shadow: var(--shadow-sm);
}

.nav-header {
	margin-bottom: var(--space-md);
	display: flex;
	justify-content: center;
	align-items: center;
}

.nav-header h3 {
	color: var(--text-accent);
	font-size: var(--font-size-lg);
	font-weight: 600;
	margin: 0;
}

.nav-buttons {
	display: flex;
	gap: var(--space-md);
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
}

.nav-buttons button {
	background: var(--bg-surface);
	border: 1px solid var(--border-secondary);
	border-radius: var(--radius-md);
	color: var(--text-primary);
	padding: var(--space-sm) var(--space-md);
	font-size: var(--font-size-sm);
	font-weight: 500;
	cursor: pointer;
	transition: all var(--transition-base);
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	white-space: nowrap;
	flex-shrink: 0;
}

#prevIndividual {
	order: -1;
}

#nextIndividual {
	order: 1;
}

.nav-buttons button:hover:not(:disabled) {
	background: var(--bg-elevated);
	border-color: var(--border-accent);
	color: var(--text-accent);
	transform: translateY(-1px);
	box-shadow: var(--shadow-sm);
}

.nav-buttons button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	transform: none;
}

.btn-copy-individual {
	background: var(--gradient-secondary) !important;
	border-color: var(--primary) !important;
	color: white !important;
	font-weight: 600;
	padding: var(--space-sm) var(--space-md) !important;
	order: 0;
	position: relative;
	overflow: hidden;
	animation: shimmer 3s ease-in-out infinite;
}

.btn-copy-individual:before {
	background: linear-gradient(transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
	content: '';
	height: 200%;
	position: absolute;
	right: calc(100% + 20px);
	top: -50%;
	transform: rotate(-70deg);
	transition: 0.8s ease-in-out right;
	width: 60px;
	z-index: 1;
}

.btn-copy-individual:hover:not(:disabled) {
	background: var(--gradient-secondary-reverse) !important;
	border-color: var(--primary-dark) !important;
	box-shadow: var(--shadow-lg), inset 0 8px 20px rgba(255, 255, 255, 0.1);
	transform: translateY(-2px);
	animation: none;
}

.btn-copy-individual:hover:before {
	right: -80%;
}

.btn-copy-individual svg {
	width: 16px;
	height: 16px;
	position: relative;
	z-index: 2;
}

@keyframes shimmer {

	0%,
	90%,
	100% {
		opacity: 1;
	}

	45%,
	55% {
		opacity: 0.9;
		box-shadow: var(--shadow-md), 0 0 10px rgba(6, 182, 212, 0.3);
	}
}

/* Responsive adjustments for navigation */
@media (max-width: 768px) {
	.nav-buttons {
		gap: var(--space-sm);
	}

	.nav-buttons button {
		padding: var(--space-xs) var(--space-sm);
		font-size: var(--font-size-xs);
	}

	.btn-copy-individual {
		padding: var(--space-xs) var(--space-sm) !important;
	}
}

/* Export Actions */
.export-actions {
	display: flex;
	gap: var(--space-md);
	margin-top: var(--space-xl);
	flex-wrap: wrap;
	flex-direction: column-reverse;
}

.export-actions::before {
	content: '📊 Export Options';
	position: absolute;
	top: -21px;
	left: var(--space-md);
	background: var(--bg-secondary);
	padding: 0 var(--space-sm);
	font-size: var(--font-size-xs);
	font-weight: 600;
	color: var(--success);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.export-actions .btn {
	justify-content: center;
	padding: var(--space-md) var(--space-sm);
	font-size: var(--font-size-sm);
	font-weight: 600;
}

.export-actions .btn-primary {
	background: var(--success);
	box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.export-actions .btn-primary:hover:not(:disabled) {
	background: #0d9f75;
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

/* Data Grid */
.data-grid-container {
	background: var(--bg-secondary);
	border-radius: var(--radius-lg);
	border: 1px solid var(--border-primary);
	box-shadow: var(--shadow-sm);
	max-height: 70vh;
	overflow-y: auto;
	padding: var(--space-lg);
}

.data-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: var(--space-md);
}

.field-box {
	background: var(--bg-tertiary);
	border: 1px solid var(--border-primary);
	border-radius: var(--radius-md);
	padding: var(--space-xs);
	transition: var(--transition-base);
}

.field-box:hover {
	border-color: var(--border-accent);
	box-shadow: var(--shadow-sm);
	transform: translateY(-1px);
}

.field-label {
	font-size: var(--font-size-xs);
	font-weight: 600;
	color: var(--text-accent);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: var(--space-xs);
	line-height: 1.3;
	display: block;
}

.field-value {
	font-size: var(--font-size-sm);
	color: var(--text-primary);
	font-weight: 500;
	word-wrap: break-word;
	line-height: 1.4;
	min-height: 1.4em;
}

.field-value.empty-value {
	color: var(--text-muted);
	font-style: italic;
	opacity: 0.7;
}

/* Important fields get different styling */
.field-box.important {
	border-color: var(--border-accent);
	background: linear-gradient(145deg, var(--bg-tertiary), rgba(99, 102, 241, 0.05));
}

.field-box.important .field-label {
	color: var(--primary);
}

/* Yes/No fields */
.field-box.yes-no .field-value {
	font-weight: 700;
	text-align: center;
	padding: var(--space-xs);
	border-radius: var(--radius-sm);
}

.field-box.yes-no .field-value:not(.empty-value) {
	background: var(--bg-surface);
}

/* Responsive adjustments */
@media (max-width: 1200px) {
	.data-grid {
		grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	}
}

@media (max-width: 768px) {
	.export-actions {
		grid-template-columns: 1fr;
		gap: var(--space-md);
	}

	.data-grid {
		grid-template-columns: 1fr 1fr;
		gap: var(--space-sm);
	}

	.data-grid-container {
		padding: var(--space-md);
		max-height: 60vh;
	}

	.field-box {
		padding: var(--space-sm);
	}
}

@media (max-width: 480px) {
	.data-grid {
		grid-template-columns: 1fr;
	}
}

/* Table Controls */
.table-controls {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--space-lg);
	padding: var(--space-sm);
	background: var(--bg-secondary);
	border-radius: var(--radius-md);
	border: 1px solid var(--border-primary);
}

.view-toggles {
	display: flex;
	background: var(--bg-tertiary);
	border-radius: var(--radius-sm);
	padding: var(--space-xs);
}

.toggle-btn {
	padding: var(--space-xs) var(--space-md);
	background: transparent;
	border: none;
	color: var(--text-muted);
	font-size: var(--font-size-sm);
	border-radius: var(--radius-sm);
	cursor: pointer;
	transition: var(--transition-base);
}

.toggle-btn.active {
	background: var(--primary);
	color: white;
}

.table-actions {
	display: flex;
	gap: var(--space-sm);
}

/* Fields Grid Layout (for All Fields view) */
.fields-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: var(--space-lg);
	padding: var(--space-md);
}

.field-category {
	background: var(--bg-tertiary);
	border-radius: var(--radius-lg);
	padding: var(--space-lg);
	border: 1px solid var(--border-primary);
	box-shadow: var(--shadow-sm);
}

.category-title {
	font-size: var(--font-size-lg);
	font-weight: 600;
	color: var(--text-primary);
	margin-bottom: var(--space-lg);
	padding-bottom: var(--space-sm);
	border-bottom: 2px solid var(--border-accent);
	display: flex;
	align-items: center;
	gap: var(--space-sm);
}

.category-fields {
	display: grid;
	gap: var(--space-md);
}

.field-item {
	background: var(--bg-secondary);
	border-radius: var(--radius-md);
	padding: var(--space-md);
	border: 1px solid var(--border-primary);
	transition: var(--transition-base);
}

.field-item:hover {
	border-color: var(--border-accent);
	box-shadow: var(--shadow-sm);
}

.field-label {
	font-size: var(--font-size-xs);
	font-weight: 600;
	color: var(--text-accent);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: var(--space-xs);
	line-height: 1.3;
}

.field-value {
	font-size: var(--font-size-sm);
	color: var(--text-primary);
	font-weight: 500;
	word-wrap: break-word;
	line-height: 1.4;
}

.field-value.empty-value {
	color: var(--text-muted);
	font-style: italic;
	opacity: 0.7;
}

/* Responsive grid adjustments */
@media (max-width: 768px) {
	.fields-grid {
		grid-template-columns: 1fr;
		gap: var(--space-md);
		padding: var(--space-sm);
	}

	.field-category {
		padding: var(--space-md);
	}

	.category-title {
		font-size: var(--font-size-base);
	}
}

/* Table */
.table-container {
	margin-bottom: var(--space-lg);
}

.table-wrapper {
	overflow: auto;
	border-radius: var(--radius-lg);
	border: 1px solid var(--border-primary);
	box-shadow: var(--shadow-sm);
	max-height: 70vh;
	background: var(--bg-secondary);
}

/* Responsive Table Layout */
table {
	width: 100%;
	border-collapse: collapse;
	background: var(--bg-secondary);
	font-size: var(--font-size-sm);
}

/* Stack table on mobile */
@media (max-width: 768px) {
	.table-wrapper {
		max-height: 60vh;
	}

	table,
	thead,
	tbody,
	th,
	td,
	tr {
		display: block;
	}

	thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	tr {
		border: 1px solid var(--border-primary);
		margin-bottom: var(--space-md);
		border-radius: var(--radius-md);
		background: var(--bg-tertiary);
		padding: var(--space-md);
	}

	td {
		border: none;
		border-bottom: 1px solid var(--border-primary);
		position: relative;
		padding: var(--space-sm) var(--space-sm) var(--space-sm) 35%;
		background: var(--bg-secondary);
		margin-bottom: var(--space-xs);
		border-radius: var(--radius-sm);
	}

	td:before {
		content: attr(data-label) ": ";
		position: absolute;
		left: var(--space-sm);
		width: 30%;
		padding-right: var(--space-sm);
		white-space: nowrap;
		font-weight: 600;
		color: var(--text-accent);
		font-size: var(--font-size-xs);
		text-transform: uppercase;
		letter-spacing: 0.5px;
	}

	td:last-child {
		border-bottom: 0;
		margin-bottom: 0;
	}
}

/* Desktop table styles */
@media (min-width: 769px) {
	th {
		background: var(--bg-tertiary);
		color: var(--text-primary);
		font-weight: 600;
		font-size: var(--font-size-xs);
		text-align: left;
		padding: var(--space-md) var(--space-sm);
		border-bottom: 2px solid var(--border-secondary);
		position: sticky;
		top: 0;
		z-index: 10;
		white-space: nowrap;
		text-transform: uppercase;
		letter-spacing: 0.5px;
		max-width: 150px;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	td {
		padding: var(--space-sm);
		border-bottom: 1px solid var(--border-primary);
		color: var(--text-secondary);
		font-size: var(--font-size-sm);
		vertical-align: top;
		max-width: 200px;
		overflow: hidden;
		text-overflow: ellipsis;
		word-wrap: break-word;
	}

	tr:nth-child(even) td {
		background: rgba(55, 65, 81, 0.3);
	}

	tr:hover td {
		background: rgba(99, 102, 241, 0.1);
	}
}

.empty-cell {
	color: var(--text-muted);
	font-style: italic;
	opacity: 0.7;
}

/* Footer */
.app-footer {
	background: var(--bg-secondary);
	border-top: 1px solid var(--border-primary);
	padding: var(--space-sm) 0;
	margin-top: var(--space-2xl);
	opacity: 0;
	animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
	animation-delay: 0.8s;
}

.footer-content {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: var(--font-size-sm);
	color: var(--text-muted);
}

.footer-links {
	display: flex;
	gap: var(--space-lg);
	align-items: center;
}

.version {
	background: var(--gradient-primary);
	padding: var(--space-xs) var(--space-sm);
	border-radius: var(--radius-sm);
	font-size: var(--font-size-xs);
}

/* Utility Classes */
.hidden {
	display: none !important;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
	.content-grid {
		grid-template-columns: 1fr;
		gap: var(--space-xl);
	}

	.preview-section {
		order: -1;
	}
}

@media (max-width: 768px) {
	.container {
		padding: 0 var(--space-md);
	}

	.header-content {
		flex-direction: column;
		gap: var(--space-md);
		text-align: center;
	}

	.action-buttons {
		flex-direction: column;
	}

	.btn {
		justify-content: center;
		width: 100%;
	}

	.table-controls {
		flex-direction: column;
		gap: var(--space-md);
	}

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

	#input {
		min-height: 200px;
	}
}

@media (max-width: 480px) {
	.app-header {
		padding: var(--space-md) 0;
	}

	.main-content {
		padding: var(--space-xs) 0;
	}

	.input-section,
	.preview-container {
		padding: var(--space-lg);
	}

	.data-summary {
		grid-template-columns: 1fr;
	}

	.logo {
		width: 40px;
		height: 40px;
	}

	.logo svg {
		width: 20px;
		height: 20px;
	}

	.app-header h1 {
		font-size: var(--font-size-xl);
	}
}

/* Scrollbar Styling */
::-webkit-scrollbar {
	width: 8px;
	height: 8px;
}

::-webkit-scrollbar-track {
	background: var(--bg-tertiary);
	border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
	background: var(--gradient-secondary-reverse);
	border-radius: var(--radius-md);
	border: 2px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
	background: var(--gradient-secondary);
}

/* Loading Animation */
@keyframes pulse {

	0%,
	100% {
		opacity: 1;
	}

	50% {
		opacity: 0.5;
	}
}

.loading {
	animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Focus Styles */
.btn:focus-visible,
.toggle-btn:focus-visible,
.icon-btn:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}

#input:focus-visible {
	outline: none;
}

/* Print Styles */
@media print {

	.background-pattern,
	.app-header,
	.app-footer,
	.action-buttons,
	.table-controls {
		display: none !important;
	}

	.main-content {
		padding: 0;
	}

	.content-grid {
		grid-template-columns: 1fr;
	}

	.preview-container {
		box-shadow: none;
		border: 1px solid #000;
	}
}
