/* Modern CSS Reset & Variables */
:root {
	--primary-color: #2563eb;
	--primary-hover: #1d4ed8;
	--secondary-color: #64748b;
	--success-color: #10b981;
	--danger-color: #ef4444;
	--warning-color: #f59e0b;
	--background: #f8fafc;
	--surface: #ffffff;
	--surface-hover: #f1f5f9;
	--text-main: #0f172a;
	--text-muted: #64748b;
	--border-color: #e2e8f0;
	--radius-sm: 0.375rem;
	--radius-md: 0.5rem;
	--radius-lg: 0.75rem;
	--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
	--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
	--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
	--font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
	font-family: var(--font-family);
	background-color: var(--background);
	color: var(--text-main);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}

/* Auth Loading Screen */
.auth-loading {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: var(--background);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 9999;
}

.auth-loading-content {
	text-align: center;
	animation: fadeIn 0.3s ease-out;
}

.auth-loading-icon {
	font-size: 4rem;
	color: var(--primary-color);
	animation: pulse 2s ease-in-out infinite;
}

.auth-loading-content h2 {
	margin: 1rem 0;
	color: var(--text-main);
	font-weight: 600;
	font-size: 1.25rem;
}

.auth-loading-spinner {
	width: 40px;
	height: 40px;
	margin: 1.5rem auto 0;
	border: 4px solid var(--border-color);
	border-top-color: var(--primary-color);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}

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

@keyframes pulse {

	0%,
	100% {
		transform: scale(1);
		opacity: 1;
	}

	50% {
		transform: scale(1.05);
		opacity: 0.8;
	}
}

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

/* Layout */
.navbar {
	background-color: var(--surface);
	border-bottom: 1px solid var(--border-color);
	padding: 1rem 0;
	box-shadow: var(--shadow-sm);
	position: sticky;
	top: 0;
	z-index: 50;
}

.container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

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

.brand {
	font-weight: 700;
	font-size: 1.25rem;
	color: var(--primary-color);
	text-decoration: none;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.brand-container {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.brand-subtitle {
	font-size: 0.875rem;
	color: var(--text-muted);
	font-weight: 400;
	display: none;
}

@media (min-width: 768px) {
	.brand-subtitle {
		display: block;
	}
}

.main-content {
	padding: 2rem 0;
}

.grid {
	display: grid;
	gap: 2rem;
	grid-template-columns: 1fr;
}

@media (min-width: 768px) {
	.grid {
		grid-template-columns: 350px 1fr;
	}
}

/* Cards */
.card {
	background: var(--surface);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-md);
	border: 1px solid var(--border-color);
	overflow: hidden;
	height: 100%;
	display: flex;
	flex-direction: column;
}

.card-header {
	padding: 1.25rem 1.5rem;
	border-bottom: 1px solid var(--border-color);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.card-title {
	font-weight: 600;
	font-size: 1.125rem;
	color: var(--text-main);
	margin: 0;
}

.card-body {
	padding: 1.5rem;
	flex: 1;
	display: flex;
	flex-direction: column;
}

/* Forms */
.form-group {
	margin-bottom: 1.25rem;
}

.form-label {
	display: block;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--text-main);
	margin-bottom: 0.5rem;
}

.form-control {
	width: 100%;
	padding: 0.625rem 0.875rem;
	background-color: var(--surface);
	border: 1px solid var(--border-color);
	border-radius: var(--radius-md);
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--text-main);
	transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-icon-wrapper {
	position: relative;
}

.input-icon-wrapper .material-icons {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--text-muted);
	font-size: 1.25rem;
	pointer-events: none;
}

.input-with-icon {
	padding-left: 2.5rem;
}

.help-text {
	display: block;
	margin-top: 0.375rem;
	font-size: 0.8rem;
	color: var(--text-muted);
}

.divider {
	height: 1px;
	background-color: var(--border-color);
	margin: 1.5rem 0;
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.625rem 1.25rem;
	font-weight: 500;
	font-size: 0.95rem;
	border-radius: var(--radius-md);
	border: none;
	cursor: pointer;
	transition: all 0.2s;
	text-decoration: none;
	width: 100%;
}

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

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

.btn-primary:hover:not(:disabled) {
	background-color: var(--primary-hover);
	box-shadow: var(--shadow-md);
}

.btn-action {
	background-color: var(--warning-color);
	color: white;
}

.btn-action:hover:not(:disabled) {
	filter: brightness(90%);
	box-shadow: var(--shadow-md);
}

.btn-danger {
	background-color: var(--surface);
	color: var(--danger-color);
	border: 1px solid var(--border-color);
}

.btn-danger:hover {
	background-color: #fef2f2;
	border-color: #fecaca;
}

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

.btn-secondary:hover {
	background-color: var(--surface-hover);
}

.btn-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	margin-top: 1rem;
}

/* Output Console */
.console-output {
	background-color: #0f172a;
	color: #e2e8f0;
	font-family: 'Source Code Pro', 'Consolas', monospace;
	font-size: 0.85rem;
	padding: 1rem;
	border-radius: var(--radius-md);
	height: 300px;
	overflow-y: auto;
	white-space: pre-wrap;
	margin-bottom: 1rem;
	border: 1px solid #1e293b;
}

/* Status Indicators */
.loading-container {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.75rem;
	background-color: #eff6ff;
	border-radius: var(--radius-md);
	color: var(--primary-color);
	font-weight: 500;
	margin-top: 1rem;
	border: 1px solid #dbeafe;
}

.spinner {
	width: 1.5rem;
	height: 1.5rem;
	border: 3px solid rgba(37, 99, 235, 0.3);
	border-radius: 50%;
	border-top-color: var(--primary-color);
	animation: spin 1s ease-in-out infinite;
}

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

/* Captures Table */
.captures-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 1rem;
}

.table-container {
	overflow-x: auto;
	border-radius: var(--radius-md);
	border: 1px solid var(--border-color);
}

.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
	text-align: left;
}

.table th,
.table td {
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border-color);
	vertical-align: middle;
}

.table th {
	background-color: #f8fafc;
	font-weight: 600;
	color: var(--text-muted);
	white-space: nowrap;
}

.table tr:last-child td {
	border-bottom: none;
}

.table-thumb {
	width: 60px;
	height: 40px;
	object-fit: cover;
	border-radius: var(--radius-sm);
	cursor: zoom-in;
	background-color: #e2e8f0;
	transition: transform 0.1s;
}

.table-thumb:hover {
	transform: scale(1.1);
}

.btn-icon {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--text-muted);
	padding: 4px;
	border-radius: 4px;
	transition: all 0.2s;
	display: inline-flex;
}

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

.btn-icon.danger:hover {
	color: var(--danger-color);
	background-color: #fee2e2;
}

/* Status Badges - New Styles */
.status-badge {
	display: inline-block;
	padding: 0.25rem 0.75rem;
	border-radius: 6px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	line-height: 1;
	white-space: nowrap;
}

/* Base Badge - Usado en renderStatusBadge */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.25rem 0.75rem;
	border-radius: 6px;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	line-height: 1.5;
	white-space: nowrap;
}

.badge-small {
	padding: 0.125rem 0.5rem;
	font-size: 0.7rem;
}

.badge .material-icons {
	font-size: 1rem;
}

.badge-done {
	background-color: #d1fae5;
	color: #059669;
	border: 1px solid #a7f3d0;
}

.badge-success {
	background-color: #d1fae5;
	color: #059669;
	border: 1px solid #a7f3d0;
}

.badge-running {
	background-color: #dbeafe;
	color: #2563eb;
	border: 1px solid #bfdbfe;
	animation: pulse 2s infinite;
}

.badge-error {
	background-color: #fee2e2;
	color: #dc2626;
	border: 1px solid #fecaca;
}

.badge-unknown {
	background-color: #f1f5f9;
	color: #64748b;
	border: 1px solid #e2e8f0;
}

.badge-xs {
	font-size: 0.7rem;
	padding: 2px 6px;
}

@keyframes pulse {
	0% {
		opacity: 1;
	}

	50% {
		opacity: 0.7;
	}

	100% {
		opacity: 1;
	}
}

/* Modal */
.modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: rgba(0, 0, 0, 0.75);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	opacity: 0;
	visibility: hidden;
	transition: all 0.2s;
	backdrop-filter: blur(4px);
}

.modal-overlay.active {
	opacity: 1;
	visibility: visible;
}

.modal-container {
	background: var(--surface);
	border-radius: var(--radius-lg);
	width: 90%;
	max-width: 900px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
	transform: scale(0.95);
	transition: transform 0.2s;
}

.modal-overlay.active .modal-container {
	transform: scale(1);
}

.modal-header {
	padding: 1rem 1.5rem;
	border-bottom: 1px solid var(--border-color);
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.modal-title {
	font-weight: 600;
	font-size: 1.125rem;
}

.modal-close-icon {
	cursor: pointer;
	color: var(--text-muted);
	font-size: 1.5rem;
}

.modal-body {
	padding: 1.5rem;
	flex: 1;
	overflow: auto;
	display: flex;
	justify-content: center;
	align-items: center;
	background-color: #f8fafc;
}

.modal-footer {
	padding: 1rem 1.5rem;
	border-top: 1px solid var(--border-color);
	display: flex;
	justify-content: flex-end;
	gap: 1rem;
}

/* Toast Notification */
.toast-container {
	position: fixed;
	bottom: 1.5rem;
	right: 1.5rem;
	z-index: 200;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.toast {
	background: var(--surface);
	border-left: 4px solid var(--primary-color);
	padding: 1rem 1.25rem;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-lg);
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-width: 300px;
	animation: slideIn 0.3s ease-out forwards;
}

.toast.success,
.toast.green {
	border-left-color: var(--success-color);
}

.toast.error,
.toast.red {
	border-left-color: var(--danger-color);
}

.toast.warning {
	border-left-color: var(--warning-color);
}

.toast.normal {
	border-left-color: var(--primary-color);
}


@keyframes slideIn {
	from {
		transform: translateX(100%);
		opacity: 0;
	}

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

@keyframes fadeOut {
	to {
		opacity: 0;
		transform: translateY(10px);
	}
}

/* Utilities */
.text-muted {
	color: var(--text-muted);
}

.mt-2 {
	margin-top: 0.5rem;
}

.mb-2 {
	margin-bottom: 0.5rem;
}

.hidden {
	display: none !important;
}

/* ========================================
   MEJORAS VISUALES
   ======================================== */

/* 1. TABLA MODERNA CON HOVER EFFECTS */
.table tbody tr {
	transition: background-color 0.2s ease, transform 0.1s ease;
	cursor: pointer;
}

.table tbody tr:hover {
	background-color: #f8fafc;
	transform: scale(1.001);
	box-shadow: 0 0 0 1px #e2e8f0 inset;
}

.table tbody tr:active {
	transform: scale(0.999);
}

/* Animación fade-in para filas */
@keyframes fadeInRow {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}

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

.table tbody tr {
	animation: fadeInRow 0.3s ease-out backwards;
}

/* Delay escalonado para cada fila */
.table tbody tr:nth-child(1) {
	animation-delay: 0.05s;
}

.table tbody tr:nth-child(2) {
	animation-delay: 0.1s;
}

.table tbody tr:nth-child(3) {
	animation-delay: 0.15s;
}

.table tbody tr:nth-child(4) {
	animation-delay: 0.2s;
}

.table tbody tr:nth-child(5) {
	animation-delay: 0.25s;
}

/* 2. BADGES CON SPINNER ANIMADO */
.badge-running {
	position: relative;
	padding-left: 1.75rem;
}

.badge-running::before {
	content: '';
	position: absolute;
	left: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
	width: 10px;
	height: 10px;
	border: 2px solid currentColor;
	border-radius: 50%;
	border-top-color: transparent;
	animation: spinBadge 0.8s linear infinite;
}

@keyframes spinBadge {
	to {
		transform: translateY(-50%) rotate(360deg);
	}
}

/* Animación pulse mejorada */
@keyframes pulse {

	0%,
	100% {
		opacity: 1;
		transform: scale(1);
	}

	50% {
		opacity: 0.85;
		transform: scale(0.98);
	}
}

/* Badges con mejor contraste */
.badge-success {
	background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
	box-shadow: 0 2px 4px rgba(5, 150, 105, 0.1);
}

.badge-error {
	background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
	box-shadow: 0 2px 4px rgba(220, 38, 38, 0.1);
}

.badge-running {
	background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
	box-shadow: 0 2px 4px rgba(37, 99, 235, 0.15);
}

/* 3. SKELETON LOADERS */
.skeleton {
	background: linear-gradient(90deg,
			#f0f0f0 0%,
			#f8f8f8 50%,
			#f0f0f0 100%);
	background-size: 200% 100%;
	animation: shimmer 1.5s ease-in-out infinite;
	border-radius: var(--radius-sm);
}

@keyframes shimmer {
	0% {
		background-position: 200% 0;
	}

	100% {
		background-position: -200% 0;
	}
}

.skeleton-row {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border-color);
}

.skeleton-thumb {
	width: 60px;
	height: 40px;
	flex-shrink: 0;
}

.skeleton-text {
	height: 12px;
	flex: 1;
}

.skeleton-text-short {
	height: 12px;
	width: 80px;
}

.skeleton-badge {
	width: 70px;
	height: 20px;
}

/* BONUS: Transiciones suaves en botones */
.btn {
	position: relative;
	overflow: hidden;
}

.btn::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.3);
	transform: translate(-50%, -50%);
	transition: width 0.6s, height 0.6s;
}

.btn:active::after {
	width: 300px;
	height: 300px;
}

.btn-icon {
	position: relative;
	overflow: visible;
}

.btn-icon:hover {
	transform: scale(1.1);
}

.btn-icon:active {
	transform: scale(0.95);
}

/* Smooth scroll */
html {
	scroll-behavior: smooth;
}

/* Loading indicator mejorado */
.loading-container {
	animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}

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

/* Console output con efecto de escritura */
.console-output {
	transition: all 0.3s ease;
}

.console-output::-webkit-scrollbar {
	width: 8px;
}

.console-output::-webkit-scrollbar-track {
	background: #1e293b;
	border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb {
	background: #475569;
	border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover {
	background: #64748b;
}

/* ========================================
   DASHBOARD DE ESTADÍSTICAS
   ======================================== */

.stats-dashboard {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 1rem;
	animation: fadeIn 0.5s ease-out;
}

.stat-card {
	background: var(--surface);
	border-radius: var(--radius-lg);
	padding: 1.5rem;
	box-shadow: var(--shadow-md);
	border: 1px solid var(--border-color);
	display: flex;
	gap: 1rem;
	align-items: center;
	transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
	transform: translateY(-4px);
	box-shadow: var(--shadow-lg);
}

.stat-icon {
	font-size: 2.5rem;
}

.stat-content {
	flex: 1;
}

.stat-value {
	font-size: 2rem;
	font-weight: 700;
	color: var(--primary-color);
	line-height: 1;
	margin-bottom: 0.25rem;
}

.stat-label {
	font-size: 0.875rem;
	color: var(--text-muted);
	font-weight: 500;
}

.stat-mini-chart {
	display: flex;
	gap: 4px;
	height: 40px;
	align-items: flex-end;
	margin-bottom: 0.5rem;
}

.mini-bar {
	flex: 1;
	background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-hover) 100%);
	border-radius: 2px;
	height: var(--height, 0%);
	min-height: 4px;
	transition: height 0.6s ease-out;
}

.mini-bar:nth-child(1) {
	background: linear-gradient(180deg, #10b981 0%, #059669 100%);
}

.mini-bar:nth-child(2) {
	background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
}

.mini-bar:nth-child(3) {
	background: linear-gradient(180deg, #64748b 0%, #475569 100%);
}

/* ========================================
   DARK MODE
   ======================================== */

/* Variables para dark mode */
[data-theme="dark"] {
	--primary-color: #3b82f6;
	--primary-hover: #2563eb;
	--secondary-color: #94a3b8;
	--success-color: #10b981;
	--danger-color: #f87171;
	--warning-color: #fbbf24;
	--background: #0f172a;
	--surface: #1e293b;
	--surface-hover: #334155;
	--text-main: #f1f5f9;
	--text-muted: #94a3b8;
	--border-color: #334155;
	--shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
	--shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
	--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

/* Transición suave al cambiar de tema */
body,
.card,
.navbar,
.stat-card,
.form-control,
.btn,
.table,
.modal-container {
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Ajustes específicos para dark mode */
[data-theme="dark"] .console-output {
	background-color: #020617;
	border-color: #1e293b;
}

[data-theme="dark"] .loading-container {
	background-color: #1e3a5f;
	border-color: #1e40af;
}

[data-theme="dark"] .table th {
	background-color: #0f172a;
}

[data-theme="dark"] .table tbody tr:hover {
	background-color: #1e293b;
}

[data-theme="dark"] .skeleton {
	background: linear-gradient(90deg,
			#1e293b 0%,
			#334155 50%,
			#1e293b 100%);
	background-size: 200% 100%;
}

[data-theme="dark"] .modal-body {
	background-color: #0f172a;
}

/* Badge específico para dark mode */
[data-theme="dark"] .badge-success {
	background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
	color: #6ee7b7;
	border-color: #065f46;
}

[data-theme="dark"] .badge-error {
	background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
	color: #fca5a5;
	border-color: #991b1b;
}

[data-theme="dark"] .badge-running {
	background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
	color: #93c5fd;
	border-color: #1e40af;
}

[data-theme="dark"] .badge-unknown {
	background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
	color: #cbd5e1;
	border-color: #475569;
}