/**
 * Vestis AI Virtual Try-On — frontend styles
 * Buttons/links: dark default (theme secondary), light hover (theme button-color).
 */

.vestis-vto-block-button-wrap {
	display: block;
	clear: both;
	width: fit-content;
	max-width: 100%;
	margin-top: 0.75em;
}

.vestis-vto-block-button-wrap .vestis-vto-open-btn {
	display: inline-block;
	width: auto;
	max-width: 100%;
	box-sizing: border-box;
	cursor: pointer;
	white-space: nowrap;
}

/* Theme-aligned buttons: dark default, light hover */
.vestis-vto-open-btn,
.vestis-vto-modal .button,
.vestis-vto-modal a.button {
	display: inline-block;
	box-sizing: border-box;
	background-color: var(--wp--preset--color--secondary, #3d1804) !important;
	border: 2px solid var(--wp--preset--color--secondary, #3d1804) !important;
	color: var(--wp--preset--color--base, #fff) !important;
	border-radius: 5px;
	padding: 10px 25px !important;
	font-weight: 600;
	font-size: inherit;
	line-height: 1.4;
	text-decoration: none;
	text-align: center;
	cursor: pointer;
	transition: all 0.3s ease;
}

.vestis-vto-open-btn:hover,
.vestis-vto-open-btn:focus,
.vestis-vto-modal .button:hover,
.vestis-vto-modal .button:focus,
.vestis-vto-modal a.button:hover,
.vestis-vto-modal a.button:focus {
	background-color: var(--wp--preset--color--button-color, #f5b247) !important;
	border-color: var(--wp--preset--color--button-color, #f5b247) !important;
	color: var(--wp--preset--color--secondary, #3d1804) !important;
}

.vestis-vto-modal .button:disabled,
.vestis-vto-modal .vestis-vto-generate:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.vestis-vto-modal .button:disabled:hover,
.vestis-vto-modal .vestis-vto-generate:disabled:hover {
	background-color: var(--wp--preset--color--secondary, #3d1804) !important;
	border-color: var(--wp--preset--color--secondary, #3d1804) !important;
	color: var(--wp--preset--color--base, #fff) !important;
}

/* Share links — theme anchor style */
.vestis-vto-modal .vestis-vto-share a {
	color: var(--wp--preset--color--secondary, #3d1804);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 2px;
	transition: color 0.3s ease;
}

.vestis-vto-modal .vestis-vto-share a:hover,
.vestis-vto-modal .vestis-vto-share a:focus {
	color: var(--wp--preset--color--button-color, #f5b247);
}

@media (max-width: 767px) {
	.vestis-vto-block-button-wrap {
		width: 100%;
	}

	.vestis-vto-block-button-wrap .vestis-vto-open-btn {
		width: 100%;
	}
}

/* Modal */
.vestis-vto-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
}

.vestis-vto-modal[hidden] {
	display: none !important;
}

.vestis-vto-modal.is-open {
	display: flex !important;
}

body.vestis-vto-modal-open {
	overflow: hidden;
}

.vestis-vto-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(4px);
}

.vestis-vto-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 860px;
	max-height: 92vh;
	overflow-y: auto;
	background: var(--wp--preset--color--base, #faf9f7);
	border-radius: 12px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
	animation: vestisVtoFadeIn 0.35s ease;
}

@keyframes vestisVtoFadeIn {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.vestis-vto-modal__close {
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	z-index: 2;
	width: 36px;
	height: 36px;
	border: 2px solid var(--wp--preset--color--secondary, #3d1804);
	background: var(--wp--preset--color--secondary, #3d1804);
	color: var(--wp--preset--color--base, #fff);
	border-radius: 50%;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: all 0.3s ease;
}

.vestis-vto-modal__close:hover,
.vestis-vto-modal__close:focus {
	background: var(--wp--preset--color--button-color, #f5b247);
	border-color: var(--wp--preset--color--button-color, #f5b247);
	color: var(--wp--preset--color--secondary, #3d1804);
}

.vestis-vto-modal__header {
	padding: 1.5rem 1.5rem 0.5rem;
	text-align: center;
}

.vestis-vto-modal__header h2 {
	margin: 0 0 0.25rem;
	font-size: 1.35rem;
	font-weight: 600;
}

.vestis-vto-modal__subtitle {
	margin: 0;
	color: #666;
	font-size: 0.9rem;
}

.vestis-vto-modal__body {
	padding: 1rem 1.5rem;
}

.vestis-vto-dropzone {
	border: 2px dashed #ccc;
	border-radius: 8px;
	padding: 2rem 1rem;
	text-align: center;
	transition: border-color 0.2s, background 0.2s;
}

.vestis-vto-dropzone.is-dragover {
	border-color: #1a1a1a;
	background: rgba(0, 0, 0, 0.03);
}

.vestis-vto-dropzone__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-top: 1rem;
}

.vestis-vto-preview {
	margin-top: 1rem;
	text-align: center;
}

.vestis-vto-preview img {
	max-width: 100%;
	max-height: 420px;
	border-radius: 8px;
	object-fit: contain;
}

.vestis-vto-loader {
	text-align: center;
	padding: 2rem;
}

.vestis-vto-loader__hint {
	margin-top: 0.5rem;
	font-size: 0.85rem;
	color: #6b6b6b;
}

.vestis-vto-progress {
	width: 100%;
	max-width: 280px;
	height: 4px;
	margin: 1rem auto 0;
	background: #e8e4df;
	border-radius: 2px;
	overflow: hidden;
}

.vestis-vto-progress__bar {
	height: 100%;
	width: 0;
	background: linear-gradient(90deg, #1a1a1a, #6b5b4f);
	border-radius: 2px;
	transition: width 0.4s ease;
}

.vestis-vto-loader__spinner {
	width: 48px;
	height: 48px;
	margin: 0 auto 1rem;
	border: 3px solid #e5e5e5;
	border-top-color: #1a1a1a;
	border-radius: 50%;
	animation: vestisVtoSpin 0.8s linear infinite;
}

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

.vestis-vto-result-note {
	margin: 0 0 0.75rem;
	padding: 0.65rem 0.85rem;
	font-size: 0.85rem;
	line-height: 1.45;
	color: #5a4a2a;
	background: #fff8e6;
	border: 1px solid #ecd89a;
	border-radius: 6px;
}

.vestis-vto-result-note[hidden] {
	display: none !important;
}

.vestis-vto-compare--side-by-side {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1rem;
	align-items: stretch;
}

.vestis-vto-compare__panel {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.vestis-vto-compare__label {
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--wp--preset--color--secondary, #3d1804);
}

.vestis-vto-compare__img {
	display: block;
	width: 100%;
	min-height: 280px;
	max-height: min(52vh, 520px);
	border-radius: 8px;
	object-fit: contain;
	background: #f5f5f5;
	border: 2px solid var(--wp--preset--color--primary, #e9e0d9);
}

@media (max-width: 640px) {
	.vestis-vto-compare--side-by-side {
		grid-template-columns: 1fr;
	}

	.vestis-vto-compare__img {
		min-height: 220px;
		max-height: min(45vh, 400px);
	}
}

.vestis-vto-result-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-top: 1rem;
}

.vestis-vto-share {
	display: flex;
	gap: 0.75rem;
	width: 100%;
	justify-content: center;
}

.vestis-vto-modal__footer {
	padding: 0 1.5rem 1.5rem;
	text-align: center;
}

.vestis-vto-generate {
	width: 100%;
}

/* Desktop / mobile camera capture */
.vestis-vto-camera {
	margin-top: 1rem;
	text-align: center;
}

.vestis-vto-camera[hidden] {
	display: none !important;
}

.vestis-vto-camera__video {
	display: block;
	width: 100%;
	max-width: 100%;
	max-height: 320px;
	margin: 0 auto 1rem;
	border-radius: 8px;
	background: #111;
	object-fit: cover;
}

.vestis-vto-camera__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
}

.vestis-vto-camera canvas {
	display: none;
}

@media (max-width: 480px) {
	.vestis-vto-modal__dialog {
		max-height: 95vh;
		border-radius: 8px 8px 0 0;
	}

	.vestis-vto-block-button-wrap .vestis-vto-open-btn {
		width: 100%;
	}
}

/* Garment gallery picker */
.vestis-vto-garment-picker {
	margin-bottom: 1rem;
	padding: 0.75rem;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.03);
	border: 1px solid #e8e8e8;
}

.vestis-vto-garment-picker__label {
	margin: 0 0 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #666;
}

.vestis-vto-garment-picker__strip {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.vestis-vto-garment-thumb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	width: 56px;
	height: 56px;
	border: 2px solid transparent;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	cursor: pointer;
	flex: 0 0 auto;
}

.vestis-vto-garment-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.vestis-vto-garment-thumb.is-selected {
	border-color: var(--wp--preset--color--secondary, #3d1804);
	box-shadow: 0 0 0 1px var(--wp--preset--color--secondary, #3d1804);
}

.vestis-vto-modal .screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	word-wrap: normal !important;
}
