/* ── Baraja de Mascotas — Avatar Stack Widget ─────────────────────────── */

/*
 * Estructura HTML:
 *  .wcm-avatar-stack-widget          → wrapper flex: [columna avatares] [columna CTA]
 *    .wcm-avatar-stack               → fila de avatares con superposición negativa
 *      .wcm-avatar-stack__item       → wrapper del avatar (overflow: visible para tooltip)
 *        .wcm-avatar-stack__circle   → clip circular + borde (overflow: hidden aquí)
 *          img
 *        .wcm-avatar-stack__tooltip  → nombre, sale fuera del círculo al hover
 *    .wcm-avatar-stack__cta          → columna derecha: texto clicable
 */

/* ── Widget wrapper: 2 columnas ─────────────────────────────────────────── */

.wcm-avatar-stack-widget {
    display: inline-flex;
    align-items: center;
    gap: 16px;
}

/* ── Pila de avatares ───────────────────────────────────────────────────── */

.wcm-avatar-stack {
    display: flex;
    align-items: center;
    padding-top: 28px; /* espacio para que el tooltip no quede cortado */
    --wcm-avatar-overlap: 14px;
    position: relative;
    z-index: 0; /* Creates local stacking context to trap child z-indexes */
}

/* Wrapper del avatar individual — SIN overflow:hidden para que el tooltip
   pueda salir hacia arriba sin ser recortado. */
.wcm-avatar-stack__item {
    position: relative;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    cursor: default;
}

.wcm-avatar-stack__item:not(:first-child) {
    margin-left: calc(-1 * var(--wcm-avatar-overlap));
}

/* z-index natural: el primer avatar (izquierda) queda al frente */
.wcm-avatar-stack__item:nth-child(1) { z-index: 7; }
.wcm-avatar-stack__item:nth-child(2) { z-index: 6; }
.wcm-avatar-stack__item:nth-child(3) { z-index: 5; }
.wcm-avatar-stack__item:nth-child(4) { z-index: 4; }
.wcm-avatar-stack__item:nth-child(5) { z-index: 3; }
.wcm-avatar-stack__item:nth-child(6) { z-index: 2; }
.wcm-avatar-stack__item:nth-child(7) { z-index: 1; }

/* El avatar señalado sube al frente */
.wcm-avatar-stack__item:hover {
    z-index: 8;
}

/* ── Círculo con clip de imagen ─────────────────────────────────────────── */

/* Este div maneja el clip circular y el borde decorativo.
   Es el único elemento con overflow:hidden, lo que garantiza
   que la imagen quede recortada en círculo. */
.wcm-avatar-stack__circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #ffffff;
    border-style: solid;
    overflow: hidden;
    background-color: #e5e7eb;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.wcm-avatar-stack__item:hover .wcm-avatar-stack__circle {
    transform: translateY(-4px) scale(1.06);
}

.wcm-avatar-stack__circle img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* Placeholder cuando no hay mascotas (modo editor de Bricks) */
.wcm-avatar-stack__circle--placeholder {
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
}

/* ── Tooltip con el nombre ──────────────────────────────────────────────── */

/* Posicionado absolutamente sobre el item, fuera del círculo hacia arriba.
   Se anima desde ligeramente abajo con opacidad 0 → arriba con opacidad 1. */
.wcm-avatar-stack__tooltip {
    position: absolute;
    bottom: calc(100% + 8px); /* 8px sobre el borde del círculo */
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background-color: #111827;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 9;
}

/* Triángulo apuntando hacia abajo */
.wcm-avatar-stack__tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #111827;
}

.wcm-avatar-stack__item:hover .wcm-avatar-stack__tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── CTA (columna derecha) ──────────────────────────────────────────────── */

.wcm-avatar-stack__cta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.875rem;
    font-weight: 500;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.wcm-avatar-stack__cta:hover {
    opacity: 0.65;
}

.wcm-avatar-stack__cta-arrow {
    display: inline-block;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.wcm-avatar-stack__cta:hover .wcm-avatar-stack__cta-arrow {
    transform: translateX(4px);
}
