/**
 * WooCommerce 360 Product Viewer - Frontend Styles
 * Responsive, RTL-ready, modern design.
 *
 * @package WC360_Viewer
 */

:root {
	--wc360-primary: #2271b1;
	--wc360-btn-color: #1e293b;
	--wc360-btn-bg: #ffffff;
	--wc360-glass-bg: rgba(255, 255, 255, 0.95);
	--wc360-glass-border: rgba(0, 0, 0, 0.1);
	--wc360-glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}

body.wc360-modal-open {
	overflow: hidden;
}

/* ==========================================================================
   Main Viewer Container
   ========================================================================== */
.wc360-wrapper {
	position: relative;
	display: block;
	max-width: 100%;
	margin: 0 auto 1.5em;
	overflow: hidden;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
	border: 1px solid rgba(0, 0, 0, 0.08);
	box-shadow: 0 4px 18px rgba(0, 0, 0, 0.04);
}

.wc360-wrapper:focus {
	outline: none;
}

.wc360-stage {
	position: relative;
	width: 100%;
	height: var(--wc360-height-desktop, 480px);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: grab;
	overflow: hidden;
	padding-bottom: 70px; /* Space for the floating controls so image is never covered */
	box-sizing: border-box;
}

.wc360-dragging .wc360-stage {
	cursor: grabbing;
}

.wc360-pan-wrapper {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	transform-origin: center center;
	transition: transform 0.05s ease-out;
	will-change: transform;
}

.wc360-stage img.wc360-current-image {
	max-width: 92% !important;
	max-height: 82% !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain !important;
	pointer-events: none;
	display: block;
	user-select: none;
	-webkit-user-drag: none;
	margin: auto !important;
}

/* Zoomed State */
.wc360-zoomed .wc360-stage {
	cursor: grab;
}

.wc360-zoom-badge {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 25;
	background: rgba(20, 20, 20, 0.82);
	color: #fff;
	padding: 5px 12px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	box-shadow: 0 2px 8px rgba(0,0,0,0.2);
	display: flex;
	align-items: center;
	gap: 4px;
	transition: transform 0.2s, background-color 0.2s;
}

.wc360-zoom-badge:hover {
	transform: scale(1.05);
	background: var(--wc360-primary);
}

body.rtl .wc360-zoom-badge,
html[dir="rtl"] .wc360-zoom-badge {
	left: auto;
	right: 14px;
}

/* ==========================================================================
   Floating Side Navigation Arrows (‹ and ›)
   ========================================================================== */
.wc360-nav-btn {
	all: unset !important;
	box-sizing: border-box !important;
	position: absolute !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	z-index: 22 !important;
	width: 42px !important;
	height: 42px !important;
	min-width: 42px !important;
	max-width: 42px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.92) !important;
	backdrop-filter: blur(10px) !important;
	-webkit-backdrop-filter: blur(10px) !important;
	color: #1e293b !important;
	border: 1px solid rgba(0, 0, 0, 0.1) !important;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
	opacity: 0.88 !important;
}

.wc360-nav-btn:hover {
	opacity: 1 !important;
	background: #ffffff !important;
	color: var(--wc360-primary) !important;
	border-color: var(--wc360-primary) !important;
	transform: translateY(-50%) scale(1.1) !important;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18) !important;
}

.wc360-nav-btn:active {
	transform: translateY(-50%) scale(0.95) !important;
}

.wc360-nav-prev {
	left: 16px !important;
}

.wc360-nav-next {
	right: 16px !important;
}

.wc360-nav-btn svg {
	width: 22px !important;
	height: 22px !important;
	display: block !important;
	fill: currentColor !important;
	pointer-events: none !important;
}

.wc360-theme-dark .wc360-nav-btn {
	background: rgba(30, 41, 59, 0.88) !important;
	color: #ffffff !important;
	border-color: rgba(255, 255, 255, 0.15) !important;
}

/* ==========================================================================
   Loading Spinner
   ========================================================================== */
.wc360-loader {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 25;
	background: rgba(255, 255, 255, 0.96);
	padding: 12px 22px;
	border-radius: 28px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
	display: flex;
	align-items: center;
	gap: 10px;
	pointer-events: none;
	border: 1px solid rgba(0,0,0,0.06);
}

.wc360-spinner {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(0, 0, 0, 0.1);
	border-top-color: var(--wc360-primary);
	border-radius: 50%;
	animation: wc360-spin 0.8s linear infinite;
}

.wc360-loader-text {
	font-size: 13px;
	font-weight: 600;
	color: #333;
}

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

/* ==========================================================================
   Hint Overlay (Drag to Rotate)
   ========================================================================== */
.wc360-hint-overlay {
	position: absolute;
	bottom: 75px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 15;
	background: rgba(18, 20, 24, 0.82);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: #fff;
	padding: 8px 18px;
	border-radius: 30px;
	font-size: 13px;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 8px;
	pointer-events: none;
	animation: wc360-pulse 2.2s ease-in-out infinite;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
	white-space: nowrap;
}

.wc360-hint-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

@keyframes wc360-pulse {
	0%, 100% { opacity: 0.95; transform: translateX(-50%) scale(1); }
	50% { opacity: 0.8; transform: translateX(-50%) scale(0.97); }
}

/* ==========================================================================
   Controls Bar & High-Contrast Solid Buttons
   ========================================================================== */
.wc360-controls {
	position: absolute;
	bottom: 16px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 25;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 7px 16px;
	border-radius: 40px;
	background: var(--wc360-glass-bg);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	border: 1px solid var(--wc360-glass-border);
	box-shadow: var(--wc360-glass-shadow);
	transition: opacity 0.3s ease, transform 0.3s ease;
	width: auto;
	max-width: 92%;
	box-sizing: border-box;
}

/* Dark Theme */
.wc360-theme-dark .wc360-controls {
	background: rgba(24, 27, 33, 0.94);
	border: 1px solid rgba(255, 255, 255, 0.15);
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Light Theme */
.wc360-theme-light .wc360-controls {
	background: #ffffff;
	border: 1px solid #dcdfe4;
	box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* High-Contrast Control Buttons - strict reset against theme interference */
.wc360-controls button.wc360-btn,
.wc360-wrapper button.wc360-btn,
button.wc360-btn {
	all: unset !important;
	box-sizing: border-box !important;
	width: 36px !important;
	height: 36px !important;
	min-width: 36px !important;
	max-width: 36px !important;
	border-radius: 50% !important;
	background: #ffffff !important;
	color: #1e293b !important;
	border: 1px solid #d1d5db !important;
	box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	padding: 0 !important;
	margin: 0 !important;
	transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
	line-height: 1 !important;
	flex-shrink: 0 !important;
}

.wc360-controls button.wc360-btn:hover,
.wc360-wrapper button.wc360-btn:hover,
button.wc360-btn:hover {
	background: var(--wc360-primary) !important;
	color: #ffffff !important;
	border-color: var(--wc360-primary) !important;
	transform: translateY(-2px) scale(1.08) !important;
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.35) !important;
}

.wc360-controls button.wc360-btn:active,
.wc360-wrapper button.wc360-btn:active,
button.wc360-btn:active {
	transform: scale(0.94) !important;
}

.wc360-theme-dark .wc360-controls button.wc360-btn {
	background: #334155 !important;
	color: #f8fafc !important;
	border: 1px solid #475569 !important;
}

.wc360-theme-dark .wc360-controls button.wc360-btn:hover {
	background: var(--wc360-primary) !important;
	color: #ffffff !important;
}

/* Icons inside control buttons */
.wc360-controls button.wc360-btn svg,
.wc360-wrapper button.wc360-btn svg {
	width: 18px !important;
	height: 18px !important;
	display: block !important;
	fill: currentColor !important;
	color: inherit !important;
	pointer-events: none !important;
}

.wc360-controls button.wc360-btn svg path {
	fill: currentColor !important;
}

.wc360-icon-wrapper,
.wc360-mode-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* Optional Scrubber Track */
.wc360-scrubber-track {
	position: relative;
	width: 120px;
	height: 8px;
	background: #e2e8f0;
	border-radius: 4px;
	margin: 0 6px;
	cursor: pointer;
	flex-shrink: 1;
}

.wc360-theme-dark .wc360-scrubber-track {
	background: #475569;
}

.wc360-scrubber-fill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	background: var(--wc360-primary);
	border-radius: 4px;
	width: 0%;
	pointer-events: none;
}

.wc360-scrubber-thumb {
	position: absolute;
	top: 50%;
	left: 0%;
	transform: translate(-50%, -50%);
	width: 16px;
	height: 16px;
	background: #ffffff;
	border: 3px solid var(--wc360-primary);
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0,0,0,0.25);
	pointer-events: none;
	transition: transform 0.12s ease;
}

.wc360-scrubber-track:hover .wc360-scrubber-thumb {
	transform: translate(-50%, -50%) scale(1.25);
}

/* ==========================================================================
   Full Screen Modes
   ========================================================================== */
.wc360-wrapper:fullscreen,
.wc360-wrapper:-webkit-full-screen,
.wc360-wrapper.wc360-fullscreen,
.wc360-wrapper.wc360-fallback-fullscreen {
	position: fixed !important;
	top: 0 !important;
	left: 0 !important;
	width: 100vw !important;
	height: 100vh !important;
	max-width: 100vw !important;
	z-index: 999999 !important;
	background-color: #ffffff !important;
	margin: 0 !important;
	border-radius: 0 !important;
}

.wc360-wrapper:fullscreen .wc360-stage,
.wc360-wrapper:-webkit-full-screen .wc360-stage,
.wc360-wrapper.wc360-fullscreen .wc360-stage,
.wc360-wrapper.wc360-fallback-fullscreen .wc360-stage {
	height: 100vh !important;
	padding-bottom: 80px !important;
}

/* ==========================================================================
   Modal / Popup Container
   ========================================================================== */
.wc360-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(12, 14, 18, 0.86);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	box-sizing: border-box;
}

.wc360-variation-unavailable {
	display: none !important;
}

.wc360-modal-content {
	position: relative;
	width: 960px;
	max-width: 95vw;
	min-height: 520px;
	height: 80vh;
	max-height: 86vh;
	background: #ffffff;
	border-radius: 20px;
	box-shadow: 0 25px 70px rgba(0, 0, 0, 0.45);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}

.wc360-modal-close {
	all: unset !important;
	box-sizing: border-box !important;
	position: absolute !important;
	top: 14px !important;
	right: 14px !important;
	z-index: 50 !important;
	background: #ffffff !important;
	border: 1px solid rgba(0, 0, 0, 0.14) !important;
	border-radius: 50% !important;
	width: 38px !important;
	height: 38px !important;
	font-size: 24px !important;
	line-height: 1 !important;
	color: #1e293b !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
	transition: background-color 0.2s, transform 0.2s !important;
}

.wc360-modal-close:hover {
	background: #f1f5f9 !important;
	color: #000000 !important;
	transform: scale(1.08) !important;
}

.wc360-modal-inner {
	width: 100%;
	height: 100%;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}

.wc360-modal-inner .wc360-wrapper,
.wc360-is-modal {
	width: 100% !important;
	height: 100% !important;
	min-height: 480px !important;
	flex: 1 1 auto !important;
	display: flex !important;
	flex-direction: column !important;
	margin-bottom: 0 !important;
	border: none !important;
	box-shadow: none !important;
}

.wc360-is-modal .wc360-stage {
	height: 100% !important;
	flex: 1 1 auto !important;
	min-height: 420px !important;
	padding-bottom: 75px !important; /* Leaves clear space for the floating controls */
}

/* ==========================================================================
   Product Gallery Slide & Thumbnail Integration
   ========================================================================== */
.wc360-gallery-slide-item,
.wc360-carousel-item {
	position: relative !important;
}

.wc360-gallery-slide-item figure.woocommerce-product-gallery__image,
.wc360-gallery-image {
	position: relative !important;
	display: block !important;
	margin: 0 !important;
	width: 100% !important;
}

.wc360-gallery-slide-item figure.woocommerce-product-gallery__image > a,
.wc360-gallery-image > a {
	display: block !important;
	position: relative !important;
	width: 100% !important;
	cursor: pointer !important;
}

.wc360-gallery-slide-item figure.woocommerce-product-gallery__image img,
.wc360-gallery-image img {
	display: block !important;
	width: 100% !important;
	height: auto !important;
	max-width: 100% !important;
}

.wc360-gallery-slide-badge {
	position: absolute !important;
	top: 50% !important;
	left: 50% !important;
	transform: translate(-50%, -50%) !important;
	z-index: 10 !important;
	background: rgba(18, 20, 24, 0.85) !important;
	backdrop-filter: blur(10px) !important;
	-webkit-backdrop-filter: blur(10px) !important;
	color: #ffffff !important;
	padding: 10px 22px !important;
	border-radius: 36px !important;
	font-size: 14px !important;
	font-weight: 700 !important;
	display: inline-flex !important;
	align-items: center !important;
	gap: 10px !important;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35) !important;
	transition: all 0.25s ease !important;
	pointer-events: none !important;
	border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
	white-space: nowrap !important;
}

.wc360-gallery-slide-item:hover .wc360-gallery-slide-badge,
.wc360-gallery-image:hover .wc360-gallery-slide-badge {
	background: var(--wc360-primary) !important;
	transform: translate(-50%, -50%) scale(1.08) !important;
	box-shadow: 0 10px 28px rgba(34, 113, 177, 0.45) !important;
	border-color: #ffffff !important;
}

.wc360-gallery-slide-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.wc360-gallery-slide-icon svg {
	width: 20px;
	height: 20px;
	stroke: #ffffff;
}

/* 360 Thumbnail in gallery strip */
.wc360-thumb-item {
	position: relative !important;
}

.wc360-thumb-item::after {
	content: "360°";
	position: absolute;
	bottom: 4px;
	right: 4px;
	z-index: 5;
	background: rgba(18, 20, 24, 0.85);
	color: #ffffff;
	font-size: 11px;
	font-weight: 800;
	padding: 2px 6px;
	border-radius: 12px;
	line-height: 1.2;
	pointer-events: none;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
	border: 1px solid rgba(255, 255, 255, 0.3);
}

body.rtl .wc360-thumb-item::after,
html[dir="rtl"] .wc360-thumb-item::after {
	right: auto;
	left: 4px;
}

/* ==========================================================================
   WoodMart Action Button Integration & Pseudo Icon Suppression
   ========================================================================== */
.wc360-woodmart-btn .wd-action-icon::before,
.wc360-woodmart-btn .wd-action-icon::after {
	display: none !important;
	content: none !important;
}

.wc360-woodmart-btn.wd-action-btn > a {
	width: auto !important;
	min-width: 44px !important;
	height: 44px !important;
	padding: 0 16px 0 12px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 8px !important;
	border-radius: 30px !important;
	background-color: #ffffff !important;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12) !important;
	overflow: visible !important;
	text-decoration: none !important;
	transition: all 0.25s ease !important;
}

body.rtl .wc360-woodmart-btn.wd-action-btn > a,
html[dir="rtl"] .wc360-woodmart-btn.wd-action-btn > a {
	padding: 0 12px 0 16px !important;
}

.wc360-woodmart-btn.wd-action-btn > a:hover {
	background-color: #f8fafc !important;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16) !important;
	transform: translateY(-2px);
}

.wc360-woodmart-btn .wd-action-icon {
	width: 22px !important;
	height: 22px !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: #1e293b !important;
	flex-shrink: 0 !important;
}

.wc360-woodmart-btn .wd-action-icon svg {
	width: 20px !important;
	height: 20px !important;
	display: block !important;
	stroke: #1e293b !important;
}

.wc360-woodmart-btn .wd-action-text {
	display: inline-block !important;
	max-width: none !important;
	width: auto !important;
	opacity: 1 !important;
	visibility: visible !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	color: #1e293b !important;
	white-space: nowrap !important;
	line-height: 1 !important;
	overflow: visible !important;
}

/* ==========================================================================
   RTL Adjustments
   ========================================================================== */
body.rtl .wc360-modal-close,
html[dir="rtl"] .wc360-modal-close {
	right: auto !important;
	left: 14px !important;
}

/* ==========================================================================
   Responsive Rules
   ========================================================================== */
@media (max-width: 768px) {
	.wc360-modal-overlay {
		padding: 10px !important;
	}

	.wc360-modal-content {
		width: 100% !important;
		max-width: 100vw !important;
		min-height: 400px !important;
		height: 82vh !important;
		max-height: 88vh !important;
		border-radius: 16px !important;
	}

	.wc360-modal-inner {
		height: 100% !important;
		display: flex !important;
		flex-direction: column !important;
	}

	.wc360-is-modal {
		display: flex !important;
		height: 100% !important;
		min-height: 380px !important;
		flex: 1 1 auto !important;
	}

	.wc360-is-modal .wc360-stage {
		height: 100% !important;
		min-height: 320px !important;
		padding-bottom: 65px !important;
	}

	.wc360-stage {
		height: var(--wc360-height-mobile, 340px);
		padding-bottom: 60px;
	}

	.wc360-stage img.wc360-current-image {
		max-width: 90% !important;
		max-height: 75% !important;
	}

	.wc360-hide-on-mobile:not(.wc360-is-modal) {
		display: none !important;
	}

	.wc360-nav-btn {
		width: 34px !important;
		height: 34px !important;
		min-width: 34px !important;
		max-width: 34px !important;
	}

	.wc360-nav-btn svg {
		width: 18px !important;
		height: 18px !important;
	}

	.wc360-nav-prev {
		left: 8px !important;
	}

	.wc360-nav-next {
		right: 8px !important;
	}

	.wc360-controls {
		bottom: 10px !important;
		padding: 6px 12px !important;
		gap: 6px !important;
	}

	.wc360-scrubber-track {
		width: 75px !important;
	}

	.wc360-controls button.wc360-btn,
	.wc360-wrapper button.wc360-btn,
	button.wc360-btn {
		width: 32px !important;
		height: 32px !important;
		min-width: 32px !important;
		max-width: 32px !important;
	}

	.wc360-controls button.wc360-btn svg,
	.wc360-wrapper button.wc360-btn svg {
		width: 16px !important;
		height: 16px !important;
	}

	.wc360-hint-overlay {
		font-size: 11px;
		padding: 6px 12px;
		bottom: 65px;
	}
}
