/* ─── WC Attribute Filter — Estilos ──────────────────────────── */

/* ─── Panel principal ─────────────────────────────────────────── */
.wcaf-filter-panel {
	font-size: 14px;
	line-height: 1.5;
}

/* Título del panel */
.wcaf-filter-title {
	font-size: 1.1em;
	font-weight: 600;
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid #f0f0f0;
}

.wcaf-panel-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 16px;
}

.wcaf-panel-header .wcaf-filter-title {
	margin: 0;
	border: none;
}

.wcaf-panel-close {
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0 4px;
}

.wcaf-panel-close:hover {
	color: #333;
}

/* ─── Filtros activos ────────────────────────────────────────── */
.wcaf-active-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 16px;
	padding: 10px 12px;
	background: #f8f8f8;
	border-radius: 6px;
}

.wcaf-active-label {
	font-size: 12px;
	font-weight: 600;
	color: #666;
	text-transform: uppercase;
	letter-spacing: .04em;
}

.wcaf-active-tag {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 3px 10px;
	background: #2c5f8a;
	color: #fff;
	border-radius: 20px;
	font-size: 12px;
	text-decoration: none;
	transition: background .15s ease;
}

.wcaf-active-tag:hover {
	background: #1a3f60;
	color: #fff;
}

.wcaf-clear-all {
	margin-left: auto;
	font-size: 12px;
	color: #999;
	text-decoration: underline;
	white-space: nowrap;
}

.wcaf-clear-all:hover {
	color: #333;
}

/* ─── Grupos de atributos ────────────────────────────────────── */
.wcaf-attribute-group {
	margin-bottom: 4px;
	border-bottom: 1px solid #f0f0f0;
}

.wcaf-attribute-group:last-child {
	border-bottom: none;
}

.wcaf-group-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 13px 14px;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: #333;
	text-align: left;
	gap: 8px;
	box-sizing: border-box;
}

.wcaf-group-toggle:hover {
	color: #2c5f8a;
}

.wcaf-group-active-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	background: #2c5f8a;
	color: #fff;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

.wcaf-toggle-icon {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg) translate(-2px, 0);
	transition: transform .2s ease;
	flex-shrink: 0;
	margin-left: auto;
}

.wcaf-group-toggle[aria-expanded="false"] .wcaf-toggle-icon {
	transform: rotate(-45deg) translate(0, -2px);
}

/* ─── Cuerpo del grupo ────────────────────────────────────────── */
.wcaf-group-body {
	padding: 0 14px 14px;
}

/* ─── Buscador interno ────────────────────────────────────────── */
.wcaf-search-wrap {
	margin-bottom: 8px;
}

.wcaf-search-terms {
	width: 100%;
	padding: 6px 10px;
	font-size: 13px;
	border: 1px solid #ddd;
	border-radius: 4px;
	outline: none;
	box-sizing: border-box;
	transition: border-color .15s ease;
}

.wcaf-search-terms:focus {
	border-color: #2c5f8a;
	box-shadow: 0 0 0 2px rgba(44, 95, 138, .12);
}

/* ─── Lista de términos — CHECKBOX / RADIO ───────────────────── */
.wcaf-terms-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wcaf-term-item {
	margin: 0;
}

.wcaf-term-item.wcaf-term-hidden {
	display: none;
}

.wcaf-term-link {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 5px 0;
	text-decoration: none;
	color: #555;
	transition: color .15s ease;
	cursor: pointer;
}

.wcaf-term-link:hover {
	color: #2c5f8a;
}

.wcaf-term-item.wcaf-active .wcaf-term-link {
	color: #2c5f8a;
	font-weight: 500;
}

/* Indicador checkbox */
.wcaf-checkbox-indicator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border: 2px solid #ccc;
	border-radius: 3px;
	flex-shrink: 0;
	transition: background .15s ease, border-color .15s ease;
}

.wcaf-checkbox-indicator.wcaf-checked {
	background: #2c5f8a;
	border-color: #2c5f8a;
}

.wcaf-checkbox-indicator.wcaf-checked::after {
	content: '';
	display: block;
	width: 4px;
	height: 7px;
	border-right: 2px solid #fff;
	border-bottom: 2px solid #fff;
	transform: rotate(45deg) translate(-1px, -1px);
}

/* Indicador radio */
.wcaf-radio-indicator {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border: 2px solid #ccc;
	border-radius: 50%;
	flex-shrink: 0;
	transition: border-color .15s ease;
}

.wcaf-radio-indicator.wcaf-checked {
	border-color: #2c5f8a;
}

.wcaf-radio-indicator.wcaf-checked::after {
	content: '';
	display: block;
	width: 8px;
	height: 8px;
	background: #2c5f8a;
	border-radius: 50%;
}

.wcaf-term-name {
	flex: 1;
	font-size: 13px;
}

.wcaf-terms-list .wcaf-term-count {
	font-size: 12px;
	color: #bbb;
}

/* ─── DROPDOWN ────────────────────────────────────────────────── */
.wcaf-dropdown {
	width: 100%;
	padding: 7px 10px;
	font-size: 13px;
	border: 1px solid #ddd;
	border-radius: 4px;
	background: #fff;
	cursor: pointer;
	outline: none;
	transition: border-color .15s ease;
}

.wcaf-dropdown:focus {
	border-color: #2c5f8a;
	box-shadow: 0 0 0 2px rgba(44, 95, 138, .12);
}

/* ─── BOTONES / PILLS ─────────────────────────────────────────── */
.wcaf-buttons-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.wcaf-btn-term {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 12px;
	border: 1.5px solid #ddd;
	border-radius: 20px;
	font-size: 13px;
	color: #444;
	text-decoration: none;
	background: #fff;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, color .15s ease;
	white-space: nowrap;
}

.wcaf-btn-term:hover {
	border-color: #2c5f8a;
	color: #2c5f8a;
}

.wcaf-btn-term.wcaf-active {
	background: #2c5f8a;
	border-color: #2c5f8a;
	color: #fff;
}

.wcaf-btn-term.wcaf-term-hidden {
	display: none;
}

.wcaf-btn-term .wcaf-term-count {
	font-size: 11px;
	opacity: .7;
}

/* ─── COLOR SWATCHES ──────────────────────────────────────────── */
.wcaf-swatches-wrap {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.wcaf-color-swatch {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 2px solid transparent;
	text-decoration: none;
	cursor: pointer;
	transition: transform .15s ease, box-shadow .15s ease;
	box-shadow: 0 0 0 1px rgba(0,0,0,.12);
	position: relative;
}

.wcaf-color-swatch:hover {
	transform: scale(1.12);
	box-shadow: 0 0 0 2px rgba(0,0,0,.2);
}

.wcaf-color-swatch.wcaf-active {
	box-shadow: 0 0 0 2px #fff, 0 0 0 4px #2c5f8a;
}

.wcaf-color-swatch.wcaf-term-hidden {
	display: none;
}

.wcaf-swatch-check {
	font-size: 11px;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0,0,0,.5);
	line-height: 1;
}

/* Etiquetas de color activo */
.wcaf-swatch-label {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-top: 8px;
}

.wcaf-swatch-label span {
	font-size: 12px;
	color: #555;
	background: #f0f0f0;
	padding: 2px 8px;
	border-radius: 4px;
}

/* ─── SHOW MORE ───────────────────────────────────────────────── */
.wcaf-show-more {
	display: inline-flex !important;
	visibility: visible !important;
	align-items: center;
	gap: 5px;
	margin-top: 8px;
	padding: 5px 11px;
	background: #2c5f8a;
	color: #fff !important;
	border: none;
	border-radius: 4px;
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s ease;
}

.wcaf-show-more:hover {
	background: #1a3f60;
	color: #fff !important;
}

.wcaf-more-icon {
	font-size: 16px;
	line-height: 1;
	display: inline-block;
	transition: transform .2s ease;
}

.wcaf-show-more.wcaf-expanded .wcaf-more-icon {
	transform: rotate(45deg);
}

/* ─── MOBILE DRAWER ───────────────────────────────────────────── */
.wcaf-mobile-trigger {
	display: none;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	background: #2c5f8a;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	margin-bottom: 12px;
}

.wcaf-mobile-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	background: #fff;
	color: #2c5f8a;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 700;
}

.wcaf-mobile-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.45);
	z-index: 9998;
	opacity: 0;
	transition: opacity .25s ease;
}

.wcaf-mobile-overlay.wcaf-overlay-visible {
	opacity: 1;
}

.wcaf-panel-footer {
	position: sticky;
	bottom: 0;
	padding: 12px 16px;
	background: #fff;
	border-top: 1px solid #f0f0f0;
	box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}

.wcaf-apply-btn {
	display: block;
	width: 100%;
	padding: 12px;
	background: #2c5f8a;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease;
}

.wcaf-apply-btn:hover {
	background: #1a3f60;
}

@media ( max-width: 768px ) {
	.wcaf-mobile-trigger {
		display: inline-flex;
	}

	.wcaf-mobile-overlay {
		display: block;
	}

	/* Panel en drawer lateral */
	.wcaf-filter-panel {
		position: fixed;
		top: 0;
		left: 0;
		width: min(320px, 85vw);
		height: 100%;
		background: #fff;
		z-index: 9999;
		overflow-y: auto;
		padding: 20px 16px;
		box-sizing: border-box;
		transform: translateX(-110%);
		transition: transform .3s cubic-bezier(.4,0,.2,1);
		box-shadow: 4px 0 24px rgba(0,0,0,.15);
	}

	.wcaf-filter-panel.wcaf-panel-open {
		transform: translateX(0);
	}

	.wcaf-panel-footer {
		display: block !important;
	}
}

/* Versión no-drawer: ocultar siempre los elementos del drawer en desktop */
@media ( min-width: 769px ) {
	.wcaf-mobile-trigger,
	.wcaf-mobile-overlay,
	.wcaf-panel-close,
	.wcaf-panel-footer {
		display: none !important;
	}
}

/* ─── Loading state ───────────────────────────────────────────── */
.wcaf-loading .wcaf-filter-panel {
	opacity: .6;
	pointer-events: none;
}

.wcaf-products-loading {
	opacity: .4;
	transition: opacity .2s ease;
	pointer-events: none;
}

/* Overlay de carga con favicon animado */
#wcaf-loader-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(255, 255, 255, .55);
	backdrop-filter: blur(2px);
	z-index: 99999;
	align-items: center;
	justify-content: center;
	flex-direction: column;
	gap: 12px;
}

#wcaf-loader-overlay.wcaf-visible {
	display: flex;
}

#wcaf-loader-overlay img {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	animation: wcaf-pulse 1s ease-in-out infinite;
	filter: drop-shadow(0 4px 12px rgba(44,95,138,.35));
}

#wcaf-loader-overlay span {
	font-size: 13px;
	color: #2c5f8a;
	font-weight: 600;
	letter-spacing: .03em;
	animation: wcaf-fade .8s ease-in-out infinite alternate;
}

@keyframes wcaf-pulse {
	0%, 100% { transform: scale(1);   opacity: 1;   }
	50%       { transform: scale(1.15); opacity: .75; }
}

@keyframes wcaf-fade {
	from { opacity: .5; }
	to   { opacity: 1;  }
}

/* ─── Sin resultados ──────────────────────────────────────────── */
.wcaf-no-results {
	padding: 40px 20px;
	text-align: center;
	color: #999;
	font-size: 15px;
}

/* ─── Responsive general ──────────────────────────────────────── */
@media ( max-width: 768px ) {
	.wcaf-active-filters {
		font-size: 12px;
	}

	.wcaf-active-tag {
		font-size: 11px;
		padding: 2px 8px;
	}

	.wcaf-swatches-wrap {
		gap: 8px;
	}
}
