/* ============================================
   VTO - MOBILE-FIRST RESPONSIVE DESIGN
   Optimized for smooth mobile experience
   ============================================ */

/* ============================================
   VTO - CORE CONTAINER
   ============================================ */
.vto-container {
	display: flex;
	flex-direction: column;
	gap: 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #1a1a1a;
	max-width: 100%;
	margin: 0 auto;
	padding: 0;
}

/* ============================================
   VTO - CANVAS AREA (Mobile-First)
   ============================================ */
.vto-canvas-wrap { 
	background: #f5f5f5;
	display: flex; 
	justify-content: center; 
	align-items: center; 
	padding: 8px;
	border-radius: 8px;
	margin-bottom: 8px;
	width: 100%;
	overflow: hidden;
	position: relative;
	box-shadow: 0 2px 8px rgba(0,0,0,0.06);
	/* Mobile: Limit height to prevent scrolling */
	max-height: 60vh;
	min-height: 300px;
}

#vto-canvas { 
	display: block;
	border-radius: 6px;
	touch-action: none; 
	background: #fff;
	/* Mobile-first: responsive sizing */
	max-width: 100%;
	max-height: 55vh;
	width: auto;
	height: auto;
	-webkit-transform: translateZ(0);
	transform: translateZ(0);
	image-rendering: -webkit-optimize-contrast;
	image-rendering: crisp-edges;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Loading spinner */
.vto-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	background: rgba(255,255,255,0.95);
	padding: 20px 28px;
	border-radius: 12px;
	box-shadow: 0 4px 16px rgba(0,0,0,0.15);
	z-index: 10;
}

.vto-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #f0f0f0;
	border-top-color: #007bff;
	border-radius: 50%;
	animation: vto-spin 0.8s linear infinite;
}

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

.vto-loading p {
	margin: 0;
	font-size: 13px;
	color: #666;
	font-weight: 500;
}

/* ============================================
   VTO - CONTROLS & BUTTONS (Mobile-Optimized)
   ============================================ */
.vto-controls { 
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}

.vto-btn { 
	padding: 12px 16px;
	border: none;
	background: #007bff;
	color: white;
	border-radius: 6px;
	cursor: pointer;
	font-weight: 600;
	font-size: 14px;
	min-height: 44px; /* Touch-friendly */
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	white-space: nowrap;
	flex: 1 1 auto;
	text-align: center;
}

.vto-btn:hover { 
	background: #0056b3;
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.vto-btn:active {
	transform: translateY(0);
	box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.vto-btn-secondary {
	background: #6c757d;
}

.vto-btn-secondary:hover {
	background: #5a6268;
}

.vto-btn-primary {
	background: #007bff;
}

.vto-btn-text {
	background: transparent;
	color: #007bff;
	box-shadow: none;
	font-weight: 500;
}

.vto-btn-text:hover {
	background: #f0f0f0;
	color: #0056b3;
}

.vto-btn-retry {
	background: #28a745 !important;
	animation: vto-pulse 2s ease-in-out infinite;
}

.vto-btn-retry:hover {
	background: #218838 !important;
}

@keyframes vto-pulse {
	0%, 100% { transform: scale(1); }
	50% { transform: scale(1.02); }
}

/* ============================================
   VTO - CAROUSEL (Mobile-Optimized)
   ============================================ */
.vto-carousel-wrap {
	margin-top: 16px;
}

.vto-carousel-title {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 12px 0;
	color: #1a1a1a;
}

.vto-carousel { 
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 10px;
	border: 1px solid #e8e8e8;
	border-radius: 8px;
	background: #fafafa;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: #ccc #f0f0f0;
}

.vto-carousel::-webkit-scrollbar {
	height: 6px;
}

.vto-carousel::-webkit-scrollbar-track {
	background: #f0f0f0;
	border-radius: 3px;
}

.vto-carousel::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 3px;
}

.vto-carousel::-webkit-scrollbar-thumb:hover {
	background: #999;
}

.vto-frame-thumb { 
	border: 2px solid transparent;
	background: #fff;
	padding: 4px;
	cursor: pointer;
	border-radius: 6px;
	flex: 0 0 auto;
	min-width: 70px;
	min-height: 70px;
	transition: all 0.2s ease;
}

.vto-frame-thumb:hover,
.vto-frame-thumb:active {
	border-color: #007bff;
	transform: scale(1.05);
	box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.vto-frame-thumb img { 
	width: 70px;
	height: auto;
	display: block;
	border-radius: 3px;
}

/* ============================================
   VTO - MESSAGES
   ============================================ */
.vto-warning {
	color: #dc3545;
	min-height: 18px;
	margin: 10px 0;
	font-weight: 500;
	font-size: 13px;
	text-align: center;
	padding: 8px;
	background: #ffe8e8;
	border-radius: 6px;
}

.vto-gesture-tip {
	padding: 10px 14px;
	background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
	border: 1px solid #90caf9;
	border-radius: 6px;
	font-size: 12px;
	text-align: center;
	margin: 10px 0;
	color: #0d47a1;
	font-weight: 500;
}

/* ============================================
   VTO - MODAL OVERLAY (Mobile-First)
   ============================================ */
.vto-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	z-index: 99999;
	display: flex;
	align-items: flex-end; /* Mobile: slide from bottom */
	justify-content: center;
	padding: 0;
	overflow-y: auto;
	animation: vto-fade-in 0.2s ease;
}

@keyframes vto-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.vto-modal {
	background: #fff;
	border-radius: 16px 16px 0 0; /* Mobile: rounded top only */
	padding: 16px;
	width: 100%;
	max-width: 100%;
	max-height: 95vh;
	overflow-y: auto;
	position: relative;
	animation: vto-slide-up 0.3s ease;
	box-shadow: 0 -4px 30px rgba(0,0,0,0.3);
}

@keyframes vto-slide-up {
	from { 
		opacity: 0;
		transform: translateY(100%);
	}
	to { 
		opacity: 1;
		transform: translateY(0);
	}
}

.vto-close {
	position: absolute;
	top: 12px;
	right: 12px;
	font-size: 28px;
	background: none;
	border: none;
	cursor: pointer;
	color: #999;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: all 0.2s ease;
	line-height: 1;
	padding: 0;
	z-index: 10;
}

.vto-close:hover {
	background: #f0f0f0;
	color: #333;
}

.vto-modal-title {
	margin: 0 0 16px 0;
	font-size: 20px;
	font-weight: 700;
	color: #1a1a1a;
	text-align: center;
	padding-right: 40px; /* Space for close button */
}

/* ============================================
   VTO - MODEL GALLERY (Mobile-First)
   ============================================ */
.vto-model-gallery {
	text-align: center;
	padding: 16px 0;
}

.vto-gallery-title {
	font-size: 18px;
	font-weight: 600;
	color: #1a1a1a;
	margin: 0 0 20px 0;
	line-height: 1.4;
}

.vto-models-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr); /* Mobile: 2 columns */
	gap: 12px;
	margin-bottom: 20px;
}

.vto-model-btn {
	background: #fff;
	border: 3px solid #e8e8e8;
	border-radius: 10px;
	padding: 0;
	cursor: pointer;
	overflow: hidden;
	transition: all 0.3s ease;
	aspect-ratio: 1;
	min-height: 120px; /* Mobile: ensure touch-friendly size */
}

.vto-model-btn:hover,
.vto-model-btn:active {
	border-color: #007bff;
	transform: scale(1.05);
	box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.vto-model-btn img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.vto-divider {
	text-align: center;
	position: relative;
	margin: 24px 0;
}

.vto-divider::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 1px;
	background: #e0e0e0;
}

.vto-divider span {
	background: #fff;
	padding: 0 12px;
	position: relative;
	color: #999;
	font-size: 13px;
	font-weight: 500;
}

.vto-upload-btn {
	max-width: 100%;
	width: 100%;
	display: block;
	font-size: 15px;
}

/* ============================================
   VTO - PHOTO OPTIONS (Mobile-First)
   ============================================ */
.vto-photo-options {
	text-align: center;
	padding: 16px 0;
}

.vto-options-title {
	font-size: 18px;
	font-weight: 600;
	color: #1a1a1a;
	margin: 0 0 10px 0;
	line-height: 1.4;
}

.vto-instructions {
	font-size: 13px;
	color: #666;
	margin: 0 0 20px 0;
	line-height: 1.5;
}

.vto-buttons-row {
	display: flex;
	flex-direction: column; /* Mobile: stack vertically */
	gap: 10px;
	margin-bottom: 12px;
}

.vto-buttons-row .vto-btn {
	width: 100%;
	min-width: auto;
}

/* ============================================
   VTO - CONTINUE PROMPT
   ============================================ */
.vto-continue-prompt {
	text-align: center;
	padding: 24px 16px;
	background: #f8f9fa;
	border-radius: 10px;
}

.vto-continue-prompt p {
	font-size: 15px;
	color: #333;
	margin: 0 0 16px 0;
	font-weight: 500;
}

/* ============================================
   VTO - CAMERA VIEW (Mobile-Optimized)
   ============================================ */
.vto-camera-container {
	text-align: center;
	padding: 16px 0;
}

.vto-camera-video {
	width: 100%;
	max-width: 100%;
	border-radius: 10px;
	margin-bottom: 16px;
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	transform: scaleX(-1); /* Mirror for selfie mode */
	/* Mobile: Limit height to prevent scrolling */
	max-height: 50vh;
	object-fit: cover;
}

.vto-camera-controls {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.vto-capture-btn {
	font-size: 16px;
	width: 100%;
}

/* ============================================
   VTO - APP HOST
   ============================================ */
.vto-app-host {
	margin-top: 16px;
	animation: vto-fade-in 0.3s ease;
}

.vto-prompt {
	background: #f8f9fa;
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 16px;
}

/* ============================================
   VTO - LAUNCHER BUTTON
   ============================================ */
.vto-launcher-btn {
	display: inline-block;
	padding: 12px 24px;
	background: #007bff;
	color: white;
	border: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 4px rgba(0,0,0,0.1);
	margin: 10px 0;
	width: 100%; /* Mobile: full width */
	max-width: 100%;
	min-height: 48px; /* Touch-friendly */
}

.vto-launcher-btn:hover,
.vto-launcher-btn:active {
	background: #0056b3;
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ============================================
   RESPONSIVE - TABLET & DESKTOP
   ============================================ */
@media (min-width: 600px) {
	.vto-modal {
		border-radius: 16px; /* Desktop: rounded all corners */
		max-width: 600px;
		margin: auto;
	}
	
	.vto-modal-overlay {
		align-items: center; /* Desktop: center modal */
		padding: 20px;
	}
	
	.vto-modal-title {
		font-size: 22px;
	}
	
	.vto-models-grid {
		grid-template-columns: repeat(3, 1fr);
	}
	
	.vto-buttons-row {
		flex-direction: row;
	}
	
	.vto-buttons-row .vto-btn {
		flex: 1;
	}
	
	.vto-launcher-btn {
		width: auto;
		max-width: 300px;
	}
	
	#vto-canvas {
		max-height: 65vh;
	}
	
	.vto-canvas-wrap {
		max-height: 70vh;
		padding: 12px;
	}
	
	.vto-camera-video {
		max-height: 60vh;
	}
}

@media (min-width: 768px) {
	.vto-container {
		flex-direction: row;
		gap: 16px;
		max-width: 1200px;
		padding: 0 16px;
	}
	
	.vto-left {
		flex: 1 1 520px;
	}
	
	.vto-right {
		flex: 0 0 320px;
		max-width: 360px;
	}
	
	.vto-controls {
		flex-direction: row;
	}
	
	.vto-controls .vto-btn {
		flex: 1 1 auto;
		min-width: 140px;
	}
	
	.vto-frame-thumb img {
		width: 90px;
	}
	
	.vto-frame-thumb {
		min-width: 90px;
		min-height: 90px;
	}
}

@media (min-width: 1024px) {
	.vto-modal {
		padding: 32px;
		max-width: 1000px;
	}
	
	.vto-modal-title {
		font-size: 24px;
	}
	
	.vto-models-grid {
		grid-template-columns: repeat(4, 1fr);
		max-width: 600px;
		margin-left: auto;
		margin-right: auto;
	}
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.vto-btn:focus,
.vto-frame-thumb:focus,
.vto-model-btn:focus,
.vto-launcher-btn:focus {
	outline: 3px solid #007bff;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.vto-modal,
	.vto-modal-overlay,
	.vto-app-host,
	.vto-btn,
	.vto-frame-thumb,
	.vto-model-btn,
	.vto-launcher-btn {
		animation: none !important;
		transition: none !important;
	}
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
	.vto-modal-overlay {
		display: none;
	}
}
