/**
 * Preferences Drawer Styles
 *
 * Styles for the slide-out preferences panel widget
 * with language, currency, and measuring unit options.
 *
 * To trigger the drawer, add class "preferences-drawer-trigger" to any button or element.
 */

:root {
	--color-primary: #002349;
}

/* ============================================
   Backdrop Overlay
   ============================================ */

.pref-backdrop {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background-color: rgba(0, 0, 0, 0.5);
	z-index: 9998;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.pref-backdrop.active {
	opacity: 1;
	visibility: visible;
}

/* ============================================
   Drawer Panel
   ============================================ */

.pref-panel {
	position: fixed;
	top: 0;
	right: 0;
	width: 400px;
	max-width: 90vw;
	height: 100vh;
	background-color: var(--color-primary);
	color: #ffffff;
	z-index: 9999;
	/* +30px extra para que la box-shadow (~24px) no asome estando escondido */
	transform: translateX(calc(100% + 30px));
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	overflow-y: auto;
	box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.pref-panel.active {
	transform: translateX(0);
}

/* ============================================
   Drawer Header
   ============================================ */

.pref-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 24px 24px 20px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pref-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: 1px;
	color: #ffffff;
	text-transform: uppercase;
}

.pref-close {
	background: transparent;
	border: none;
	color: #ffffff;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease;
	width: 32px;
	height: 32px;
	border-radius: 4px;
}

.pref-close:hover {
	background-color: rgba(255, 255, 255, 0.1);
}

.pref-close svg {
	display: block;
}

/* ============================================
   Drawer Content
   ============================================ */

.pref-content {
	padding: 0;
}

/* ============================================
   Preference Items
   ============================================ */

.pref-item {
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pref-item-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.pref-item-header:hover {
	background-color: rgba(255, 255, 255, 0.03);
}

.pref-item-label {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.5px;
	color: #ffffff;
	text-transform: uppercase;
}

.pref-value-wrap {
	display: flex;
	align-items: center;
	gap: 12px;
}

.pref-value {
	font-size: 14px;
	color: #D4A574;
	font-weight: 500;
}

.pref-toggle {
	background: transparent;
	border: 1px solid rgba(255, 255, 255, 0.2);
	color: #ffffff;
	width: 24px;
	height: 24px;
	border-radius: 2px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.2s ease;
	padding: 0;
}

.pref-toggle:hover {
	background-color: rgba(255, 255, 255, 0.1);
	border-color: rgba(255, 255, 255, 0.3);
}

.pref-toggle svg {
	transition: transform 0.3s ease;
}

.pref-item.expanded .pref-toggle svg {
	transform: rotate(45deg);
}

/* ============================================
   Preference Options
   ============================================ */

.pref-options {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
	background-color: rgba(0, 0, 0, 0.2);
}

.pref-item.expanded .pref-options {
	max-height: 300px;
}

.pref-option {
	display: flex;
	justify-content: space-between;
	align-items: center;
	width: 100%;
	padding: 14px 24px 14px 48px;
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.7);
	font-size: 14px;
	text-align: left;
	cursor: pointer;
	transition: all 0.2s ease;
	position: relative;
}

.pref-option:hover {
	background-color: rgba(255, 255, 255, 0.05);
	color: #ffffff;
}

.pref-option.selected {
	color: #ffffff;
	background-color: rgba(212, 165, 116, 0.1);
}

.pref-option-label {
	flex: 1;
}

.pref-option-check {
	opacity: 0;
	color: #D4A574;
	font-size: 16px;
	font-weight: bold;
	transition: opacity 0.2s ease;
}

.pref-option.selected .pref-option-check {
	opacity: 1;
}

/* ============================================
   Body Lock (prevent scrolling when drawer open)
   ============================================ */

body.preferences-drawer-open {
	overflow: hidden;
}

/* ============================================
   Elementor Preview Styles
   ============================================ */

.preferences-drawer-widget-preview {
	padding: 20px;
	background: #f5f5f5;
	border-radius: 4px;
	text-align: center;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
	.pref-panel {
		width: 100%;
		max-width: 100vw;
	}

	.pref-header {
		padding: 20px 16px;
	}

	.pref-title {
		font-size: 14px;
	}

	.pref-item-header {
		padding: 16px;
	}

	.pref-option {
		padding: 12px 16px 12px 32px;
	}
}

/* ============================================
   Animations
   ============================================ */

@keyframes drawerSlideIn {
	from {
		transform: translateX(100%);
	}
	to {
		transform: translateX(0);
	}
}

@keyframes backdropFadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

/* Preference-applied currency styling */
[data-price-usd][data-price-mxn] .price-other {
	font-size: 0.8em !important;
	color: #666 !important;
	font-weight: 400 !important;
}
