/**
 * Klean 360 Viewer - Frontend styles.
 *
 * @package Klean_360_Images
 * @since   1.0.0
 */

/* ── Container ─────────────────────────────── */

.klean-360-container {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #fff;
	line-height: 0;
}

/* ── Viewer ────────────────────────────────── */

.klean-360-viewer {
	position: relative;
	width: 100%;
	cursor: grab;
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	touch-action: pan-y;
}

.klean-360-viewer.is-dragging {
	cursor: grabbing;
}

/* ── Canvas ────────────────────────────────── */

.klean-360-canvas {
	position: relative;
	width: 100%;
	transition: opacity 0.2s ease;
}

.klean-360-canvas img {
	display: block;
	width: 100%;
	height: auto;
	pointer-events: none;
	-webkit-user-drag: none;
}

/* ── Loading overlay ───────────────────────── */

.klean-360-loading {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	z-index: 10;
	background: rgba(255, 255, 255, 0.85);
}

.klean-360-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #e0e0e0;
	border-top-color: #333;
	border-radius: 50%;
	animation: klean360spin 0.8s linear infinite;
	margin-bottom: 12px;
}

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

.klean-360-loading-text {
	font-size: 14px;
	line-height: 1.4;
	color: #333;
	margin-bottom: 12px;
}

.klean-360-progress {
	width: 60%;
	max-width: 200px;
	height: 3px;
	background: #e0e0e0;
	border-radius: 2px;
	overflow: hidden;
}

.klean-360-progress-bar {
	width: 0;
	height: 100%;
	background: #333;
	border-radius: 2px;
	transition: width 0.15s ease;
}

/* ── Hint overlay ──────────────────────────── */

.klean-360-hint {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	padding: 8px 16px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
	border-radius: 4px;
	z-index: 5;
	pointer-events: none;
	opacity: 1;
	transition: opacity 0.5s ease;
	white-space: nowrap;
}

.klean-360-hint-hidden {
	opacity: 0;
}

/* Show desktop/mobile hint text conditionally */
.klean-360-hint-mobile {
	display: none;
}

@media (hover: none) and (pointer: coarse) {
	.klean-360-hint-desktop {
		display: none;
	}
	.klean-360-hint-mobile {
		display: inline;
	}
}

/* ── Controls ──────────────────────────────── */

.klean-360-controls {
	position: absolute;
	z-index: 5;
	opacity: 0;
	transition: opacity 0.25s ease;
	pointer-events: none;
}

.klean-360-container:hover .klean-360-controls,
.klean-360-container.is-spinning .klean-360-controls,
.klean-360-container.is-touched .klean-360-controls {
	opacity: 1;
	pointer-events: auto;
}

.klean-360-controls--top-right    { top: 12px; right: 12px; }
.klean-360-controls--top-left     { top: 12px; left: 12px; }
.klean-360-controls--bottom-right { bottom: 12px; right: 12px; }
.klean-360-controls--bottom-left  { bottom: 12px; left: 12px; }

.klean-360-fullscreen-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.9);
	color: #333;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.klean-360-fullscreen-btn:hover {
	background: #333;
	color: #fff;
	border-color: #333;
}

.klean-360-fullscreen-btn svg {
	width: 18px;
	height: 18px;
}

/* ── Modal overlay ─────────────────────────── */

.klean-360-modal-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 999999;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.klean-360-modal-close {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 10;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	color: #333;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.klean-360-modal-close:hover {
	background: #333;
	color: #fff;
	border-color: #333;
}

.klean-360-modal-close svg {
	width: 22px;
	height: 22px;
}

.klean-360-modal-active {
	width: 90vw !important;
	max-width: 1200px;
	max-height: 90vh;
}

.klean-360-modal-active .klean-360-canvas img {
	max-height: 90vh;
	object-fit: contain;
}

.klean-360-modal-active .klean-360-controls {
	display: none;
}

/* ── Responsive ────────────────────────────── */

@media (max-width: 768px) {
	.klean-360-hint {
		font-size: 12px;
		padding: 6px 12px;
		bottom: 12px;
	}

	.klean-360-controls--top-right    { top: 8px; right: 8px; }
	.klean-360-controls--top-left     { top: 8px; left: 8px; }
	.klean-360-controls--bottom-right { bottom: 8px; right: 8px; }
	.klean-360-controls--bottom-left  { bottom: 8px; left: 8px; }

	.klean-360-fullscreen-btn {
		width: 32px;
		height: 32px;
	}
}
