/**
 * Miscelánea Tickets — Mejoras de CSS v4
 * Responsive design, accesibilidad mejorada, animaciones fluidas
 */

/* ──────────────────────────────────────────────────────────────────────────
   VARIABLES Y TOKENS
   ────────────────────────────────────────────────────────────────────────── */

:root {
	--mt-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	--mt-easing-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
	--mt-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
	--mt-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
	--mt-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
	--mt-focus-ring: 0 0 0 3px rgba(66, 153, 225, 0.5);
	--mt-focus-ring-offset: 2px;
}

/* ──────────────────────────────────────────────────────────────────────────
   ACCESIBILIDAD Y FOCUS
   ────────────────────────────────────────────────────────────────────────── */

/* Skip link — para navegación por teclado */
.mt-skip-link {
	position: absolute;
	top: -40px;
	left: 0;
	background: #000;
	color: #fff;
	padding: 8px 12px;
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
	border-radius: 0 0 4px 0;
	z-index: 10000;
}

.mt-skip-link:focus {
	top: 0;
}

/* Focus visible para navegación por teclado */
.mt-zone-btn:focus-visible,
.mt-seat[role="button"]:focus-visible,
.mt-zone-arc:focus-visible {
	outline: 2px solid #4299e1;
	outline-offset: var(--mt-focus-ring-offset);
	box-shadow: var(--mt-focus-ring);
}

.mt-zone-arc:focus-visible {
	filter: brightness(1.1);
}

/* ──────────────────────────────────────────────────────────────────────────
   RESPUESTA TÁCTIL — MOBILE OPTIMIZED
   ────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
	/* Aumentar tamaño de botones táctiles */
	.mt-zone-btn {
		min-height: 44px; /* WCAG AAA */
		padding: 10px 12px;
		font-size: 13px;
	}

	/* Asientos más grandes en móvil */
	.mt-seat rect {
		rx: 0.3;
	}

	/* Controles de zoom: más accesibles */
	.mt-zoom-controls {
		bottom: 16px;
		right: 16px;
		gap: 6px;
	}

	.mt-zoom-controls button {
		width: 40px;
		height: 40px;
		font-size: 18px;
		border-radius: 8px;
	}

	/* Panel de selección: tamaño óptimo */
	.mt-selection-panel {
		max-height: 50vh;
		border-radius: 16px 16px 0 0;
	}

	/* Leyenda responsiva */
	.mt-legend {
		flex-wrap: wrap;
		gap: 8px;
		padding: 8px;
	}

	.mt-legend-item {
		font-size: 12px;
	}
}

/* ──────────────────────────────────────────────────────────────────────────
   ANIMACIONES Y TRANSICIONES
   ────────────────────────────────────────────────────────────────────────── */

/* Animación de rebote para el contador */
@keyframes mt-bounce {
	0% {
		transform: scale(1);
	}
	50% {
		transform: scale(1.2);
	}
	100% {
		transform: scale(1);
	}
}

.mt-bounce {
	animation: mt-bounce 0.35s var(--mt-easing-bounce);
}

/* Animación de spin para loading */
@keyframes mt-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Transiciones suaves para estado de asientos */
.mt-seat rect {
	transition: fill 0.2s ease, filter 0.2s ease;
}

.mt-seat:hover:not(.mt-seat--dimmed) rect {
	filter: brightness(1.1) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.mt-seat[aria-pressed="true"] rect {
	filter: brightness(0.95);
}

/* Transición suave de zona arc */
.mt-zone-arc {
	transition: fill 0.25s ease, filter 0.25s ease;
}

.mt-zone-arc:hover {
	filter: brightness(1.15);
}

.mt-zone-arc:active {
	filter: brightness(0.9);
}

/* Transición del panel lateral */
.mt-selection-panel {
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* ──────────────────────────────────────────────────────────────────────────
   ESTADOS CARGANDO Y ERRORES
   ────────────────────────────────────────────────────────────────────────── */

.mt-seat--loading,
.mt-seat[aria-busy="true"] {
	opacity: 0.6;
	pointer-events: none;
}

/* Pulsación de TTL urgente */
@keyframes mt-ttl-pulse {
	0%, 100% {
		opacity: 1;
	}
	50% {
		opacity: 0.5;
	}
}

.mt-ttl--urgent {
	animation: mt-ttl-pulse 1s ease-in-out infinite;
}

/* ──────────────────────────────────────────────────────────────────────────
   TOOLTIPS MEJORADO
   ────────────────────────────────────────────────────────────────────────── */

.mt-tooltip {
	background: rgba(0, 0, 0, 0.95);
	color: #fff;
	padding: 8px 12px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	box-shadow: var(--mt-shadow-lg);
	z-index: 1000;
	pointer-events: none;
	animation: fadeIn 0.15s ease;
}

.mt-tooltip strong {
	display: block;
	margin-bottom: 2px;
	font-weight: 600;
	font-size: 13px;
}

.mt-tooltip-zone {
	display: block;
	color: rgba(255, 255, 255, 0.7);
	font-size: 11px;
	margin-bottom: 2px;
}

.mt-tooltip-price {
	display: block;
	color: #ffd700;
	font-weight: 600;
	margin-top: 4px;
}

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

/* ──────────────────────────────────────────────────────────────────────────
   NOTIFICACIONES MEJORADAS
   ────────────────────────────────────────────────────────────────────────── */

.mt-notice {
	animation: slideIn 0.3s ease forwards;
	box-shadow: var(--mt-shadow-lg);
	border-radius: 8px;
	font-size: 14px;
	padding: 12px 16px;
	margin-bottom: 8px;
}

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

.mt-notice--warning {
	background: #fef3c7;
	color: #92400e;
	border-left: 4px solid #f59e0b;
}

.mt-notice--error {
	background: #fee2e2;
	color: #991b1b;
	border-left: 4px solid #ef4444;
}

.mt-notice--success {
	background: #dcfce7;
	color: #15803d;
	border-left: 4px solid #22c55e;
}

/* ──────────────────────────────────────────────────────────────────────────
   MEJORAS EN LISTA DE SELECCIÓN
   ────────────────────────────────────────────────────────────────────────── */

.mt-selected-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px;
	background: rgba(255, 255, 255, 0.5);
	border-radius: 6px;
	transition: background 0.2s ease;
}

.mt-selected-item:hover {
	background: rgba(255, 255, 255, 0.7);
}

.mt-deselect-btn {
	margin-left: auto;
	background: rgba(239, 68, 68, 0.1);
	color: #ef4444;
	border: 1px solid rgba(239, 68, 68, 0.3);
	padding: 4px 8px;
	border-radius: 4px;
	cursor: pointer;
	transition: all 0.2s ease;
	font-weight: 600;
	font-size: 16px;
}

.mt-deselect-btn:hover {
	background: rgba(239, 68, 68, 0.2);
	border-color: rgba(239, 68, 68, 0.5);
}

/* ──────────────────────────────────────────────────────────────────────────
   PERFORMANCE: WILL-CHANGE PARA ANIMACIONES CRÍTICAS
   ────────────────────────────────────────────────────────────────────────── */

.mt-seat-map-canvas {
	will-change: transform;
	backface-visibility: hidden;
	perspective: 1000px;
}

.mt-dragging {
	cursor: grabbing !important;
}

/* ──────────────────────────────────────────────────────────────────────────
   MEJORAS EN ENCABEZADO DE EVENTO
   ────────────────────────────────────────────────────────────────────────── */

.mt-event-header {
	padding: 16px;
	background: linear-gradient(135deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.02));
	border-radius: 8px;
	margin-bottom: 16px;
}

.mt-event-title {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 8px 0;
	color: #1a202c;
}

.mt-event-meta {
	font-size: 13px;
	color: #666;
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.mt-event-meta-sep {
	color: #ccc;
}

/* ──────────────────────────────────────────────────────────────────────────
   SELECTOR DE ZONA: MEJORAS
   ────────────────────────────────────────────────────────────────────────── */

.mt-zone-selector {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 16px;
	padding: 12px;
	background: rgba(255, 255, 255, 0.5);
	border-radius: 8px;
}

.mt-zone-selector-label {
	font-weight: 600;
	font-size: 13px;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.mt-zone-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 12px;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	cursor: pointer;
	font-size: 12px;
	font-weight: 500;
	transition: var(--mt-transition);
	white-space: nowrap;
}

.mt-zone-btn:hover:not(.mt-zone-btn--active) {
	background: #f7fafc;
	border-color: #cbd5e0;
}

.mt-zone-btn--active {
	background: linear-gradient(135deg, var(--zone-color, #C5A028), rgba(197, 160, 40, 0.9));
	color: #fff;
	border-color: var(--zone-color, #C5A028);
	box-shadow: var(--mt-shadow-md);
}

.mt-zone-btn-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--zone-color, #C5A028);
}

.mt-zone-btn-price {
	font-size: 11px;
	opacity: 0.8;
}

/* ──────────────────────────────────────────────────────────────────────────
   VISTA PREVIA EN IMPRESIÓN
   ────────────────────────────────────────────────────────────────────────── */

@media print {
	.mt-zoom-controls,
	.mt-back-btn,
	.mt-notices,
	.mt-selection-panel {
		display: none !important;
	}

	.mt-seat-map-wrapper {
		break-inside: avoid;
	}
}

/* ──────────────────────────────────────────────────────────────────────────
   DARK MODE SUPPORT (OPCIONAL)
   ────────────────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
	:root {
		--mt-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
		--mt-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
		--mt-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
	}

	.mt-event-header {
		background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
	}

	.mt-event-title {
		color: #e2e8f0;
	}

	.mt-event-meta {
		color: #a0aec0;
	}

	.mt-zone-selector {
		background: rgba(255, 255, 255, 0.05);
	}

	.mt-zone-btn {
		background: rgba(30, 41, 59, 0.8);
		border-color: rgba(148, 163, 184, 0.3);
		color: #e2e8f0;
	}

	.mt-zone-btn:hover:not(.mt-zone-btn--active) {
		background: rgba(30, 41, 59, 0.95);
		border-color: rgba(148, 163, 184, 0.5);
	}
}

/* ──────────────────────────────────────────────────────────────────────────
   COMPATIBILIDAD CON NAVEGADORES ANTIGUOS
   ────────────────────────────────────────────────────────────────────────── */

@supports (display: grid) {
	.mt-selected-list {
		display: grid;
		grid-auto-rows: max-content;
	}
}

@supports not (display: grid) {
	.mt-selected-list {
		display: flex;
		flex-direction: column;
	}
}
