/*
 * AMAZON STYLE - CSS
 * Enfoque Radical: GRID en lugar de FLEX
 */

.woo-product-gallery-slider {
	/* Mantener los estilos del plugin original */
}

.wpgs-for {
	/* Mantener estructura del slider original */
}

.wpgs-nav {
	/* Mantener estructura de miniaturas original */
}

/* ============================================================
   MODAL OVERLAY
   ============================================================ */

#amazon-modal {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.5);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 99999;
	backdrop-filter: blur(3px);
	gap: 20px;
}

#amazon-modal.active {
	display: flex;
}

/* Flechas de navegación lateral */
.amazon-modal-arrow {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	width: auto;
	height: auto;
	background: transparent;
	border: none;
	border-radius: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	z-index: 100000;
	box-shadow: none;
	padding: 0;
	margin: 0;
}

.amazon-modal-arrow:hover {
	background: transparent;
	transform: translateY(-50%) scale(1.1);
	box-shadow: none;
}

.amazon-modal-arrow .arrow-svg {
	width: 61.2px;
	height: 61.2px;
	filter: brightness(0.6);
	transition: all 0.2s ease;
}

.amazon-modal-arrow:hover .arrow-svg {
	filter: brightness(0.6) !important;
}

.amazon-modal-arrow-left {
	left: 10px;
}

.amazon-modal-arrow-right {
	right: 10px;
}

/* ============================================================
   CONTENEDOR PRINCIPAL - GRID LAYOUT
   ============================================================ */

#amazon-modal-content {
	background: white;
	border-radius: 8px;
	display: grid;
	grid-template-columns: 1fr 204px;
	grid-template-rows: 1fr auto;
	width: calc(100% - 16px);
	max-width: 2174px;
	max-height: 87vh;
	position: relative;
	box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
	overflow: visible;
	padding: 0 !important;
	margin: 0 8px;
	row-gap: 0;
	column-gap: 0;
}

/* Botón cerrar */
#amazon-modal-close {
	position: absolute;
	top: 5px;
	right: 5px;
	background: #fcfcfc;
	 border: 1px solid #000000 !important;
	font-size: 0;
	cursor: pointer;
	color: transparent;
	width: 32.5px;
	height: 32.5px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	padding: 0;
	margin: 0;
	border-radius: 4px;
}

#amazon-modal-close::before,
#amazon-modal-close::after {
	content: '';
	position: absolute;
	background: #000000;
}

#amazon-modal-close::before {
	width: 19.5px;
	height: 2px;
	transform: rotate(45deg);
}

#amazon-modal-close::after {
	width: 19.5px;
	height: 2px;
	transform: rotate(-45deg);
}

#amazon-modal-close:hover::before,
#amazon-modal-close:hover::after {
	background: #111111;
}

/* ============================================================
   WIDGET 1: IMAGEN PRINCIPAL
   ============================================================ */

#amazon-modal-left {
	grid-column: 1;
	grid-row: 1;
	background: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px !important;
	margin: 0 !important;
	border-radius: 8px 0 0 8px;
	overflow: hidden;
	position: relative;
	min-width: 0;
	box-sizing: border-box !important;
	height: 100% !important;
	width: 100% !important;
	min-height: 87vh !important;
	max-height: 87vh !important;
}

#amazon-modal-left.zoomed-active {
	overflow: hidden;
	display: block;
	align-items: unset;
	justify-content: unset;
}

#amazon-modal-main-img {
	max-width: 100% !important;
	max-height: 100% !important;
	width: 100% !important;
	height: 100% !important;
	object-fit: contain !important;
	display: block !important;
	cursor: zoom-in;
	transition: none !important;
	user-select: none;
	-webkit-user-drag: none;
	padding: 0 !important;
	margin: 0 !important;
	border: none !important;
	flex-shrink: 0 !important;
}

#amazon-modal-main-img.zoomed {
	transform: scale(1.8);
	cursor: grab;
	transition: none !important;
	transform-origin: top left;
	width: auto !important;
	height: auto !important;
}

#amazon-modal-main-img.zoomed:active {
	cursor: grabbing;
}

/* Asegurar que el cursor de grab sea visible durante todo el arrastre */
body.dragging #amazon-modal-main-img.zoomed {
	cursor: grabbing !important;
}

/* ============================================================
   WIDGET 2: MINIATURAS
   ============================================================ */

#amazon-modal-right {
	grid-column: 2;
	grid-row: 1;
	width: 204px !important;
	background: #ffffff;
	display: grid;
	grid-template-rows: 1fr auto auto;
	padding: 8px !important;
	margin: 0 !important;
	border-left: 2px solid #e8e8e8;
	border-radius: 0 8px 0 0;
	overflow: hidden;
	gap: 0;
	box-sizing: border-box !important;
	height: 100%;
	min-height: 0;
}

/* ============================================================
   CONTENEDOR DE MINIATURAS - CENTRADO Y FÁCIL EDITABLE
   ============================================================ */

#amazon-modal-thumbs {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	align-content: flex-start;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 14px 8px 0 8px !important;
	margin: 0 !important;
	width: 100%;
	height: 100%;
	box-sizing: border-box !important;
	min-height: 0;
	gap: 20px 20px;
}

#amazon-modal-thumbs::-webkit-scrollbar {
	width: 6px;
}

#amazon-modal-thumbs::-webkit-scrollbar-track {
	background: #f0f0f0;
}

#amazon-modal-thumbs::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 10px;
}

#amazon-modal-thumbs::-webkit-scrollbar-thumb:hover {
	background: #999;
}

#amazon-modal-thumbs img {
	width: 52px !important;
	height: 52px !important;
	object-fit: cover;
	cursor: pointer;
	transition: border 0s ease, background 0s ease, opacity 0s ease;
	background: white;
	padding: 0 !important;
	margin: 0 !important;
	border: 2px solid #b3b3b3 !important;
	border-radius: 4px !important;
	display: block !important;
}

#amazon-modal-thumbs img:hover {
	background: #f0f0f0;
	opacity: 1;
	border: 2px solid #3b3b3b !important;
}

#amazon-modal-thumbs img.active {
	border: 2px solid #3b3b3b !important;
	background: #d3d3d3 !important;
	box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.3);
}

/* Contenedor de botones de navegación */
#amazon-modal-nav {
	display: flex;
	gap: 0;
	flex-direction: row;
	padding: 0 !important;
	margin: 0;
	width: 100%;
	background: #fafafa;
	box-sizing: border-box !important;
	justify-content: center;
}

/* ============================================================
   BOTÓN DE DESCARGA - FÁCIL EDITABLE
   ============================================================ */

#amazon-modal-download {
	/* DIMENSIONES */
	width: 88px !important;
	height: 29px !important;

	/* ESPACIADO */
	margin: 8px !important;
	margin-top: 20px !important;
	padding: 0 !important;

	/* APARIENCIA */
	background: #3B88C3 !important;
	color: white !important;
	border: none !important;
	border-radius: 17px !important;

	/* FUENTE */
	font-size: 25px !important;
	font-weight: bold !important;
	line-height: 36px !important;

	/* INTERACCIÓN */
	cursor: pointer !important;
	transition: all 0.2s ease !important;

	/* POSICIONAMIENTO */
	flex: none !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	align-self: flex-end !important;
}

#amazon-modal-download:hover {
	background: #2870a8 !important;
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

#amazon-modal-download:hover * {
	color: white !important;
	background: transparent !important;
}

/* SVG del botón Download */
.download-svg {
	width: 20px !important;
	height: 20px !important;
	display: block !important;
	margin: 0 !important;
	padding: 0 !important;
	filter: brightness(0) invert(1);
}

.amazon-modal-btn {
	flex: 1;
	height: 45px;
	padding: 0 !important;
	margin: 0 !important;
	background: #f5f5f5;
	border: none !important;
	border-radius: 0 !important;
	cursor: pointer;
	font-size: 18px;
	font-weight: bold;
	transition: all 0.2s ease;
	box-sizing: border-box !important;
	border-right: 1px solid #e8e8e8;
}

.amazon-modal-btn:last-child {
	border-right: none;
}

.amazon-modal-download-btn {
	font-size: 18px !important;
}

.amazon-modal-btn:hover {
	background: #e5e5e5;
	color: #ff9900;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
	#amazon-modal-content {
		grid-template-columns: 1fr;
		grid-template-rows: auto auto;
	}

	#amazon-modal-left {
		grid-column: 1;
		grid-row: 1;
		border-radius: 8px 8px 0 0;
		min-height: 400px;
	}

	#amazon-modal-right {
		grid-column: 1;
		grid-row: 2;
		width: 100% !important;
		border-left: none;
		border-top: 1px solid #ddd;
		border-radius: 0 0 8px 8px;
		grid-template-rows: 1fr 90px;
		grid-template-columns: 1fr;
	}

	#amazon-modal-thumbs {
		grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
		grid-auto-rows: 80px;
		grid-column: 1;
		overflow-x: auto !important;
		overflow-y: hidden !important;
	}

	#amazon-modal-thumbs img {
		width: 84px !important;
		height: 84px !important;
		border: 2px solid #b3b3b3 !important;
	}

	#amazon-modal-controls {
		grid-row: 2;
		flex-direction: row;
		width: 100%;
		padding: 0 !important;
	}

	.amazon-modal-btn {
		width: auto;
		height: 45px;
		flex: 1;
	}
}

@media (max-width: 768px) {
	#amazon-modal-content {
		width: 100%;
		max-height: 100vh;
		border-radius: 0;
	}

	#amazon-modal-left {
		border-radius: 0;
		min-height: 300px;
	}

	#amazon-modal-right {
		border-radius: 0;
		width: 100% !important;
	}

	#amazon-modal-thumbs img {
		width: 64px !important;
		height: 64px !important;
		border: 2px solid #b3b3b3 !important;
	}

	.amazon-modal-btn {
		width: 45px;
		height: 45px;
		font-size: 16px;
	}

	#amazon-modal-close {
		width: 35px;
		height: 35px;
		font-size: 28px;
	}
}
