/**
 * FMAS Lista de Deseos - Estilos frontend v2
 * Compatible con Astra y WooCommerce
 */

:root {
	--fmas-wl-color:      #e74c3c;
	--fmas-wl-color-dark: #c0392b;
	--fmas-wl-text:       var(--ast-body-font-color, #333);
	--fmas-wl-border:     #e2e2e2;
	--fmas-wl-bg:         #fff;
	--fmas-wl-radius:     6px;
	--fmas-wl-shadow:     0 2px 8px rgba(0,0,0,.08);
	--fmas-wl-speed:      .22s;
}

/* ── BASE DEL BOTÓN ───────────────────────────────────────── */
.fmas-wl-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	line-height: 1;
	transition: color var(--fmas-wl-speed), opacity var(--fmas-wl-speed), transform var(--fmas-wl-speed);
}
.fmas-wl-btn svg {
	fill: currentColor;
	flex-shrink: 0;
	transition: transform var(--fmas-wl-speed), fill var(--fmas-wl-speed);
}
.fmas-wl-btn:focus-visible { outline: 2px solid var(--fmas-wl-color); outline-offset: 2px; }

@keyframes fmas-pulse {
	0%   { transform: scale(1); }
	40%  { transform: scale(1.45); }
	70%  { transform: scale(.92); }
	100% { transform: scale(1.05); }
}
.fmas-wl-btn.fmas-wl-adding svg { animation: fmas-pulse .42s ease forwards; }

/* ── BOTÓN EN CATÁLOGO (loop) ─────────────────────────────── */
.woocommerce ul.products li.product { position: relative; }

.fmas-wl-btn--loop {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	z-index: 2;
	/* Color se inyecta desde PHP vía inject_custom_css() */
}
.fmas-wl-btn--loop:hover svg { transform: scale(1.2); }

/* ── MODO: siempre visible (por defecto) ── */
.fmas-wl-btn--loop {
	opacity: 1;
}

/* ── MODO: solo en hover sobre la tarjeta (clase en <li>) ── */
.woocommerce ul.products li.product.fmas-wl-hover-only .fmas-wl-btn--loop {
	opacity: 0;
	transform: scale(.8);
	transition: opacity .2s ease, transform .2s ease;
	pointer-events: none;
}
.woocommerce ul.products li.product.fmas-wl-hover-only:hover .fmas-wl-btn--loop,
.woocommerce ul.products li.product.fmas-wl-hover-only .fmas-wl-btn--loop.fmas-wl-active {
	opacity: 1;
	transform: scale(1);
	pointer-events: auto;
}

/* ── BOTÓN INDIVIDUAL: modo BOTÓN ─────────────────────────── */
.fmas-wl-btn--single {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 10px;
	width: 100%;
	padding: 10px 16px;
	font-size: .9rem;
	cursor: pointer;
	transition: background var(--fmas-wl-speed), color var(--fmas-wl-speed), border-color var(--fmas-wl-speed);
}

/* ── BOTÓN INDIVIDUAL: modo DESPLEGABLE ───────────────────── */
.fmas-wl-dropdown-wrap {
	position: relative;
	display: block;
	margin-top: 10px;
}

.fmas-wl-dropdown-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 10px 16px;
	font-size: .9rem;
	cursor: pointer;
	justify-content: space-between;
	transition: background var(--fmas-wl-speed), border-color var(--fmas-wl-speed);
}

.fmas-wl-dropdown-trigger__left {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

.fmas-wl-dropdown-trigger__arrow {
	transition: transform .22s;
	opacity: .6;
}

.fmas-wl-dropdown-wrap.fmas-wl-open .fmas-wl-dropdown-trigger__arrow {
	transform: rotate(180deg);
}

.fmas-wl-dropdown-panel {
	display: none;
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid #ddd;
	border-radius: var(--fmas-wl-radius);
	box-shadow: 0 6px 20px rgba(0,0,0,.12);
	z-index: 100;
	overflow: hidden;
}

.fmas-wl-dropdown-wrap.fmas-wl-open .fmas-wl-dropdown-panel {
	display: block;
	animation: fmas-dropdown-in .18s ease;
}

@keyframes fmas-dropdown-in {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.fmas-wl-dropdown-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 11px 16px;
	cursor: pointer;
	font-size: .88rem;
	color: #444;
	border: none;
	background: transparent;
	width: 100%;
	text-align: left;
	transition: background .15s;
}
.fmas-wl-dropdown-item:hover { background: #f5f5f5; }
.fmas-wl-dropdown-item svg   { fill: currentColor; flex-shrink: 0; }
.fmas-wl-dropdown-item.fmas-wl-active { color: var(--fmas-wl-color); font-weight: 600; }

.fmas-wl-dropdown-sep {
	height: 1px;
	background: #f0f0f0;
	margin: 0;
}

/* ── CONTADOR ──────────────────────────────────────────────── */
.fmas-wl-counter {
	display: inline-flex;
	align-items: center;
	position: relative;
	text-decoration: none;
	color: inherit;
}
.fmas-wl-counter svg { fill: var(--fmas-wl-color); width: 22px; height: 22px; }
.fmas-wl-counter__badge {
	position: absolute; top: -5px; right: -8px;
	min-width: 17px; height: 17px; padding: 0 3px;
	background: var(--fmas-wl-color); color: #fff;
	border-radius: 9px; font-size: .7rem; font-weight: 700; line-height: 17px;
	text-align: center;
}
.fmas-wl-counter__badge[data-count="0"] { opacity: 0; }

/* ── TOAST ─────────────────────────────────────────────────── */
#fmas-wl-toast {
	position: fixed; bottom: 22px; right: 22px; z-index: 99999;
	background: #222; color: #fff;
	padding: 11px 18px; border-radius: var(--fmas-wl-radius);
	font-size: .88rem; box-shadow: 0 4px 18px rgba(0,0,0,.22);
	display: flex; align-items: center; gap: 10px;
	max-width: 300px; pointer-events: none;
	opacity: 0; transform: translateY(10px);
	transition: opacity .24s, transform .24s;
}
#fmas-wl-toast.fmas-wl-toast--show { opacity: 1; transform: translateY(0); pointer-events: auto; }
#fmas-wl-toast a { color: var(--fmas-wl-color); text-decoration: none; font-weight: 600; white-space: nowrap; }

/* ── PÁGINA DE LA LISTA DE DESEOS ──────────────────────────── */
.fmas-wl-page__header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.fmas-wl-page__title  { margin: 0; font-size: 1.5rem; }
.fmas-wl-page__count  { font-size: .88rem; color: #888; }

.fmas-wl-empty { text-align: center; padding: 60px 20px; }
.fmas-wl-empty svg { fill: #ddd; }
.fmas-wl-empty p { color: #888; margin: 14px 0 22px; font-size: 1rem; }

.fmas-wl-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 18px;
}

.fmas-wl-card {
	border: 1px solid var(--fmas-wl-border);
	border-radius: var(--fmas-wl-radius);
	background: var(--fmas-wl-bg);
	box-shadow: var(--fmas-wl-shadow);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: box-shadow var(--fmas-wl-speed), transform var(--fmas-wl-speed);
}
.fmas-wl-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.12); transform: translateY(-2px); }
.fmas-wl-card.fmas-wl-removing { opacity: 0; transform: scale(.95); transition: opacity .28s, transform .28s; }

.fmas-wl-card__image  { position: relative; overflow: hidden; background: #f7f7f7; aspect-ratio: 1/1; }
.fmas-wl-card__img    { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .38s ease; }
.fmas-wl-card:hover .fmas-wl-card__img { transform: scale(1.05); }

.fmas-wl-card__badge { position: absolute; top: 8px; left: 8px; padding: 2px 7px; font-size: .7rem; font-weight: 700; border-radius: 3px; text-transform: uppercase; }
.fmas-wl-card__badge--sale { background: var(--fmas-wl-color); color: #fff; }
.fmas-wl-card__badge--out  { background: #888; color: #fff; }

.fmas-wl-card__body      { padding: 13px; display: flex; flex-direction: column; flex: 1; }
.fmas-wl-card__name      { font-size: .93rem; margin: 0 0 7px; line-height: 1.4; }
.fmas-wl-card__name a    { text-decoration: none; color: var(--fmas-wl-text); }
.fmas-wl-card__name a:hover { color: var(--fmas-wl-color); }
.fmas-wl-card__price     { font-size: 1rem; font-weight: 600; color: var(--fmas-wl-color); margin-bottom: 5px; }
.fmas-wl-card__price del { color: #aaa; font-weight: 400; font-size: .88rem; }
.fmas-wl-card__variation  { font-size: .78rem; color: #777; margin-bottom: 7px; }

.fmas-wl-card__actions { margin-top: auto; padding-top: 11px; display: flex; gap: 7px; align-items: center; }
.fmas-wl-card__btn { flex: 1; text-align: center; font-size: .84rem; padding: 7px 10px; }
.fmas-wl-card__btn--cart { background: var(--fmas-wl-color) !important; color: #fff !important; border-color: var(--fmas-wl-color) !important; }
.fmas-wl-card__btn--cart:hover { background: var(--fmas-wl-color-dark) !important; border-color: var(--fmas-wl-color-dark) !important; }

.fmas-wl-card__remove {
	width: 34px; height: 34px; flex-shrink: 0;
	border-radius: 50%; border: 1px solid var(--fmas-wl-border);
	background: #f5f5f5; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	color: #999; transition: background var(--fmas-wl-speed), color var(--fmas-wl-speed), border-color var(--fmas-wl-speed);
}
.fmas-wl-card__remove:hover { background: #ffe5e5; color: var(--fmas-wl-color); border-color: var(--fmas-wl-color); }
.fmas-wl-card__remove svg { fill: currentColor; }

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 600px) {
	.fmas-wl-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
	.fmas-wl-btn--loop { width: 32px; height: 32px; }
	#fmas-wl-toast { bottom: 10px; right: 10px; left: 10px; max-width: none; }
}

/* ── OVERRIDE ASTRA ─────────────────────────────────────────── */
.fmas-wl-btn, .fmas-wl-btn:focus, .fmas-wl-btn:active {
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
}


/* Remove button fix */
.fmas-table .button.remove {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width:110px;
    padding:12px 20px;
    margin-left:10px;
    border:1px solid #e53935;
    border-radius:14px;
    background:#fff;
    color:#e53935;
    font-weight:600;
    text-decoration:none;
}

.fmas-table .button.remove:hover {
    background:#fff5f5;
    color:#c62828;
    border-color:#c62828;
}
