/* Cubo 360 Plugin - Estilos adaptados para WordPress */

/* Variables CSS para el plugin */
.cubo-360-container {
	--cubo-primary-color: #2563eb;
	--cubo-primary-hover: #1d4ed8;
	--cubo-secondary-color: #64748b;
	--cubo-text-primary: #1e293b;
	--cubo-text-secondary: #64748b;
	--cubo-modal-bg: rgba(0, 0, 0, 0.95);
	--cubo-border-radius: 12px;
	--cubo-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	--cubo-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
	--cubo-shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ALTERNATIVA 6: Desactivar sortable completamente + JavaScript cursor forzado */
.cubo-drag-handle {
	cursor: grab !important;
}

.cubo-drag-handle:hover {
	cursor: grab !important;
}

/* Cursor normal para elementos del dashboard */
.cubo-dashboard-card,
.cubo-dashboard-stat,
.cubo-dashboard-content,
.cubo-instructions-section {
	cursor: default !important;
}

/* Cursor normal para imágenes del frontend viewer */
.cubo-frame-image,
.cubo-modal-content,
.cubo-frame-info {
	cursor: default !important;
}

/* Contenedor principal del shortcode */
.cubo-360-container {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 2rem 0;
	text-align: center;
}

/* Contenedor del botón */
.cubo-button-container {
	margin-bottom: 1rem;
}

/* Botón para abrir el visor */
.cubo-view-360-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #000000;
	color: white;
	border: none;
	padding: 1rem 2rem;
	font-size: 1rem;
	font-weight: 600;
	border-radius: var(--cubo-border-radius);
	cursor: pointer;
	transition: var(--cubo-transition);
	box-shadow: var(--cubo-shadow);
	font-family: inherit;
	text-decoration: none;
}

.cubo-view-360-btn:hover {
	opacity: 0.8;
}

.cubo-view-360-btn:active {
	opacity: 0.6;
}

/* Modal del visor 360° */
.cubo-modal {
	display: none;
	position: fixed;
	z-index: 100000; /* Muy alto para WordPress */
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	background: var(--cubo-modal-bg);
	backdrop-filter: blur(10px);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.cubo-modal.show {
	opacity: 1;
}

.cubo-modal-content {
	position: relative;
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 2rem;
}

/* Botón cerrar */
.cubo-close-btn {
	position: absolute;
	top: 2rem;
	right: 2rem;
	background: rgba(255, 255, 255, 0.1);
	border: 2px solid rgba(255, 255, 255, 0.2);
	color: white;
	font-size: 2rem;
	width: 3rem;
	height: 3rem;
	border-radius: 50%;
	cursor: pointer;
	transition: var(--cubo-transition);
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
}

.cubo-close-btn:hover {
	background: rgba(255, 255, 255, 0.2);
	transform: rotate(90deg);
}

/* Información del frame */
.cubo-frame-info {
	position: absolute;
	top: 2rem;
	left: 2rem;
	color: white;
	background: rgba(0, 0, 0, 0.7);
	padding: 0.75rem 1.5rem;
	border-radius: var(--cubo-border-radius);
	font-weight: 500;
	z-index: 100001;
}


/* Indicador de carga */
.cubo-loading-indicator {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1rem;
	color: white;
	z-index: 100003;
}

.cubo-loading-indicator[style*='display: none'] {
	display: none !important;
}

.cubo-spinner {
	width: 3rem;
	height: 3rem;
	border: 3px solid rgba(255, 255, 255, 0.2);
	border-top-color: white;
	border-radius: 50%;
	animation: cubo-spin 1s linear infinite;
}

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

/* Contenedor del visor */
.cubo-viewer-container {
	position: relative;
	width: 90%;
	height: 70vh;
	max-height: 600px;
	/* cursor: grab; */
	user-select: none;
	overflow: hidden;
	border-radius: var(--cubo-border-radius);
	background: rgba(0, 0, 0, 0.2);
	/* Optimización de rendimiento */
	transform: translateZ(0);
	will-change: transform;
	/* Forzar aceleración por hardware */
	contain: layout style paint;
}

.cubo-viewer-container:active {
	/* cursor: grabbing; */
}

/* Imágenes del frame */
.cubo-frame-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	visibility: hidden;
	opacity: 0;
	z-index: 1;
	/* Optimización de rendimiento */
	backface-visibility: hidden;
	transform: translateZ(0);
	image-rendering: crisp-edges;
	/* Sin transiciones para máxima velocidad */
	transition: none !important;
	will-change: opacity, visibility;
	contain: layout style paint;
}

.cubo-frame-image.active {
	visibility: visible;
	opacity: 1;
	z-index: 2;
	will-change: auto;
}

/* Canvas para modos directo y simple (frame pool) */
.cubo-canvas {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: var(--cubo-border-radius);
	cursor: grab;
}

.cubo-canvas:active {
	cursor: grabbing;
}

/* Spinner de precarga de frames */
.cubo-preload-spinner {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	z-index: 2;
	transition: opacity 0.4s ease;
}

.cubo-preload-spinner.hidden {
	opacity: 0;
}

.cubo-preload-spinner::after {
	content: '';
	width: 32px;
	height: 32px;
	border: 3px solid rgba(255, 255, 255, 0.25);
	border-top-color: rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	animation: cubo-spin 0.7s linear infinite;
}

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

/* Pre-render invisible para forzar upload de texturas en GPU (modo popup) */
.cubo-gpu-warm {
	visibility: visible !important;
	opacity: 0.001 !important;
	z-index: 0 !important;
	pointer-events: none !important;
}

/* Imágenes con esquinas redondeadas solo en modo directo */
.cubo-direct-viewer .cubo-frame-image {
	border-radius: var(--cubo-border-radius);
	object-fit: cover;
}

/* Controles */
.cubo-controls {
	position: absolute;
	bottom: 2rem;
	left: 50%;
	transform: translateX(-50%);
	width: 90%;
	background: rgba(0, 0, 0, 0.3);
	padding: 1.5rem;
	border-radius: var(--cubo-border-radius);
	color: white;
	z-index: 100001;
}

.cubo-control-info {
	margin-bottom: 1rem;
}

.cubo-control-info p {
	font-size: 0.875rem;
	margin: 0.25rem 0;
	opacity: 0.9;
}

/* Barra de progreso */
.cubo-progress-bar {
	width: 100%;
	height: 6px;
	background: rgba(255, 255, 255, 0.2);
	border-radius: 3px;
	overflow: hidden;
	margin: 1rem 0;
}

.cubo-progress-fill {
	height: 100%;
	background: #000000;
	width: 0%;
	transition: width 0.1s ease;
}

/* Barra de progreso blanca en el modal popup */
.cubo-modal .cubo-progress-fill {
	background: #ffffff;
}

/* Controles de reproducción */
.cubo-playback-controls {
	display: flex;
	gap: 1rem;
	justify-content: center;
	margin-top: 1rem;
}

.cubo-control-btn {
	background: rgba(255, 255, 255, 0.2);
	border: 1px solid rgba(255, 255, 255, 0.4);
	color: white;
	padding: 0.5rem 1rem;
	border-radius: 8px;
	cursor: pointer;
	transition: var(--cubo-transition);
	font-size: 1rem;
	font-family: inherit;
	backdrop-filter: blur(5px);
}

.cubo-control-btn:hover {
	background: rgba(255, 255, 255, 0.3);
	transform: scale(1.05);
}

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

/* Responsive para el plugin */
@media (max-width: 768px) {
	.cubo-view-360-btn {
		padding: 0.875rem 1.5rem;
		font-size: 0.9rem;
	}

	.cubo-viewer-container {
		width: 95%;
		height: 60vh;
	}

	.cubo-controls {
		bottom: 1rem;
		padding: 1rem;
	}

	.cubo-close-btn {
		top: 1rem;
		right: 1rem;
		width: 2.5rem;
		height: 2.5rem;
		font-size: 1.5rem;
	}

	.cubo-frame-info {
		top: 1rem;
		left: 1rem;
		padding: 0.5rem 1rem;
	}
}

/* Compatibilidad con temas de WordPress */
.cubo-360-container * {
	box-sizing: border-box;
}

/* Asegurar que el modal esté por encima de todo en WordPress */
body.admin-bar .cubo-modal {
	z-index: 100000;
}

/* Prevenir conflictos con estilos de tema */
.cubo-modal,
.cubo-modal * {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
		sans-serif;
	line-height: normal;
}

/* Ocultar datos JSON */
.cubo-image-data {
	display: none !important;
}

/* Estilos adicionales para evitar conflictos */
.cubo-360-container a,
.cubo-360-container button {
	text-decoration: none;
	outline: none;
}

.cubo-360-container button:focus {
	outline: 2px solid var(--cubo-primary-color);
	outline-offset: 2px;
}

/* Estilos para modo simple */
.cubo-simple-mode {
	text-align: center;
	margin: 1rem 0;
}

.cubo-simple-viewer {
	position: relative;
	display: inline-block;
	width: 100%;
	aspect-ratio: 16/9;
	border-radius: var(--cubo-border-radius);
	overflow: hidden;
	cursor: grab;
	user-select: none;
	/* Optimización de rendimiento */
	transform: translateZ(0);
	will-change: transform;
	contain: layout style paint;
}

.cubo-simple-viewer:active {
	cursor: grabbing;
}

.cubo-simple-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	visibility: hidden;
	opacity: 0;
	z-index: 1;
	border-radius: var(--cubo-border-radius);
	/* Optimización de rendimiento */
	backface-visibility: hidden;
	transform: translateZ(0);
	/* Sin transiciones para máxima velocidad */
	transition: none !important;
	will-change: auto;
	contain: layout style paint;
}

.cubo-simple-image.active {
	visibility: visible;
	opacity: 1;
	z-index: 2;
}

/* Estilos para modo directo */
.cubo-directo-mode {
	margin: 2rem 0;
	text-align: center;
}

.cubo-frame-info-inline {
	background: rgba(0, 0, 0, 0.8);
	color: white;
	padding: 0.5rem 1rem;
	border-radius: var(--cubo-border-radius);
	margin-bottom: 1rem;
	display: inline-block;
	font-weight: 500;
}

.cubo-direct-viewer {
	position: relative;
	width: 100%;
	height: 400px;
	margin: 0 auto 1rem;
	cursor: grab;
	user-select: none;
	overflow: hidden;
	border-radius: var(--cubo-border-radius);
	background: transparent;
	border: none;
}

.cubo-direct-viewer:active {
	cursor: grabbing;
}

.cubo-controls-inline {
	background: rgba(0, 0, 0, 0.05);
	padding: 1rem;
	border-radius: var(--cubo-border-radius);
	border: 1px solid #e0e0e0;
}

.cubo-controls-inline .cubo-progress-bar {
	margin-bottom: 1rem;
}

.cubo-controls-inline .cubo-playback-controls {
	justify-content: center;
	margin-top: 0;
}

.cubo-controls-inline .cubo-control-btn {
	background: rgba(0, 0, 0, 0.8);
	color: white;
	border: 1px solid rgba(255, 255, 255, 0.2);
}

.cubo-controls-inline .cubo-control-btn:hover {
	background: rgba(0, 0, 0, 0.9);
	transform: scale(1.05);
}

/* Responsive para nuevos modos */
@media (max-width: 768px) {
	.cubo-direct-viewer {
		height: 300px;
	}

	.cubo-simple-image {
	}
}

/* Estilos para iconos SVG profesionales */
.cubo-btn-icon svg,
.cubo-play-icon svg,
.cubo-reset-icon svg {
	display: inline-block;
	vertical-align: middle;
	transition: var(--cubo-transition);
}

/* Estilos de ejemplo para demostración de personalización */
.ejemplo-personalizado {
	border: none !important;
	border-radius: 0 !important;
	padding: 1.5rem !important;
	background: transparent !important;
	box-shadow: none !important;
	margin: 2rem 0 !important;
}

.ejemplo-personalizado .cubo-simple-viewer {
	border-radius: 0 !important;
	overflow: hidden;
	border: none !important;
}

.demo-estilizado {
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	padding: 1.5rem !important;
	margin: 2rem 0 !important;
}

.demo-estilizado .cubo-frame-info-inline {
	background: transparent !important;
	color: #000 !important;
	border: none !important;
	border-radius: 0 !important;
}

.demo-estilizado .cubo-direct-viewer {
	border: none !important;
	border-radius: 0 !important;
}

.demo-estilizado .cubo-controls-inline {
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
}

.demo-estilizado .cubo-control-btn {
	background: transparent !important;
	border: none !important;
	color: #000 !important;
	border-radius: 0 !important;
}

.demo-estilizado .cubo-control-btn:hover {
	background: #000 !important;
	color: #fff !important;
}

.demo-estilizado .cubo-progress-bar {
	border: none !important;
	border-radius: 0 !important;
	background: transparent !important;
	width: 600px !important;
	margin: 1rem auto !important;
}

.demo-estilizado .cubo-progress-fill {
	background: #000 !important;
}

@media (max-width: 768px) {
	.demo-estilizado .cubo-progress-bar {
		width: 50vw !important;
	}
}

.cubo-control-btn:hover svg {
	transform: scale(1.1);
}

.cubo-control-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	min-height: 2.5rem;
}

/* Ejemplo de personalización minimalista para modo popup */
.cubo-popup-personalizado .cubo-view-360-btn {
	background: transparent !important;
	border: 2px solid #000 !important;
	color: #000 !important;
	padding: 1rem 2rem !important;
	font-size: 1rem !important;
	font-weight: 500 !important;
	border-radius: 4px !important;
	box-shadow: none !important;
	transition: all 0.3s ease !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

.cubo-popup-personalizado .cubo-view-360-btn:hover {
	background: #000 !important;
	color: #fff !important;
	transform: none !important;
	box-shadow: none !important;
	opacity: 1 !important;
}

.cubo-popup-personalizado .cubo-modal {
	background: rgba(255, 255, 255, 0.95) !important;
	backdrop-filter: blur(30px) saturate(180%) !important;
}

.cubo-popup-personalizado .cubo-modal-content {
	background: transparent;
}

.cubo-popup-personalizado .cubo-viewer-container {
	border-radius: 0 !important;
	box-shadow: none !important;
	backdrop-filter: none !important;
	background: transparent !important;
	border: none !important;
}

.cubo-popup-personalizado .cubo-controls {
	background: transparent !important;
	backdrop-filter: none !important;
	border: none !important;
	border-radius: 0 !important;
	margin: 20px !important;
	padding: 15px !important;
	box-shadow: none !important;
}

.cubo-popup-personalizado .cubo-control-btn {
	background: transparent !important;
	border: none !important;
	color: #000 !important;
	font-weight: 400 !important;
	border-radius: 0 !important;
	padding: 8px 16px !important;
	font-size: 0.9rem !important;
	transition: all 0.3s ease !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}

.cubo-popup-personalizado .cubo-control-btn:hover {
	background: #000 !important;
	color: #fff !important;
	transform: none !important;
	box-shadow: none !important;
}

.cubo-popup-personalizado .cubo-progress-bar {
	width: 50vw !important;
	margin: 1rem auto !important;
	order: 1 !important;
}

.cubo-popup-personalizado .cubo-controls {
	display: flex !important;
	flex-direction: column !important;
	order: 10 !important;
	position: relative !important;
	bottom: auto !important;
	left: auto !important;
	transform: none !important;
	width: auto !important;
	margin-top: 0 !important;
	padding-top: 0 !important;
}

.cubo-popup-personalizado .cubo-modal-content {
	display: flex !important;
	flex-direction: column !important;
	justify-content: center !important;
	align-items: center !important;
}

.cubo-popup-personalizado .cubo-viewer-container {
	order: 1 !important;
	flex: 1 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	margin-top: 2rem !important;
	padding-top: 1rem !important;
}

.cubo-popup-personalizado .cubo-playback-controls {
	order: 10 !important;
}

.cubo-popup-personalizado .cubo-progress-fill {
	background: #000 !important;
	box-shadow: none !important;
}

.cubo-popup-personalizado .cubo-close-btn {
	background: transparent !important;
	border: none !important;
	color: #000 !important;
	backdrop-filter: none !important;
	transition: all 0.3s ease !important;
	font-weight: normal !important;
	border-radius: 0 !important;
}

.cubo-popup-personalizado .cubo-close-btn:hover {
	background: #000 !important;
	color: #fff !important;
	transform: none !important;
	box-shadow: none !important;
}

.cubo-popup-personalizado .cubo-frame-info {
	background: transparent !important;
	border: none !important;
	border-radius: 0 !important;
	backdrop-filter: none !important;
	font-weight: normal !important;
	color: #000 !important;
}
