/* PamiPet Connect - PDP Pet Selector Styles */

.pamipet-connect-selector {
    margin: 1.5rem 0;
    animation: pamipetFadeIn 0.3s ease-out;
}

@keyframes pamipetFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pamipet-connect-selector__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Toggle Switch Styling */
.pamipet-connect-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 10px;
}

.pamipet-connect-toggle input {
    display: none;
}

.pamipet-connect-toggle__slider {
    position: relative;
    width: 40px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 20px;
    transition: background-color 0.3s;
}

.pamipet-connect-toggle__slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.pamipet-connect-toggle input:checked + .pamipet-connect-toggle__slider {
    background-color: #ff6b6b; /* PamiPet Primary Color */
}

.pamipet-connect-toggle input:checked + .pamipet-connect-toggle__slider::before {
    transform: translateX(20px);
}

.pamipet-connect-toggle__label {
    font-size: 14px;
    font-weight: 500;
    color: #475569;
}

/* Contenedor de chips cuando hay una o más mascotas asignadas */
.pamipet-connect-assigned-pets {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.pamipet-connect-add-another {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.pamipet-connect-add-another:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Selected Badge
 * Verde (no coral) a propósito: el coral/rojo ya lo usa el badge "X% OFF"
 * de compra recurrente justo arriba en la misma tarjeta del producto -- un
 * chip rojo con "×" al lado se leía como otro tag de descuento o incluso
 * como un selector de ciudad (mismo patrón visual: pastilla + "×"). Verde
 * se lee de forma inequívoca como "confirmado/asignado", y el ícono de
 * especie (🐶/🐱) dentro del chip elimina cualquier ambigüedad de qué es.
 */
.pamipet-connect-selected-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #15803d;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(21, 128, 61, 0.06);
    cursor: help;
}

.pamipet-connect-selected-badge:focus-visible {
    outline: 2px solid #15803d;
    outline-offset: 2px;
}

.pamipet-connect-selected-badge__icon {
    font-size: 15px;
    line-height: 1;
}

/* Selector reforzado (tag + 2 clases) y !important en el tamaño: el tema/
 * Bricks trae su propio reset de "img { max-width: 100%; height: auto; }"
 * con más especificidad que una sola clase, y le ganaba a este ícono --
 * se veía la foto de la mascota a tamaño completo en vez de 18px. */
.pamipet-connect-selected-badge img.pamipet-connect-selected-badge__icon--photo {
    width: 18px !important;
    height: 18px !important;
    max-width: 18px !important;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.pamipet-connect-selected-badge__info {
    display: inline-flex;
    color: #4ade80;
    line-height: 1;
}

.pamipet-connect-clear-btn {
    background: none;
    border: none;
    color: #4ade80;
    font-size: 18px;
    margin-left: 2px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.pamipet-connect-clear-btn:hover {
    color: #dc2626;
}

/* Tooltip explicativo del chip -- mismo patrón CSS-only (sin JS) que el
 * tooltip de "puntos con esta compra" de wc-mascotas más arriba en la
 * misma tarjeta, para que ambos se vean y se comporten igual. */
.pamipet-connect-tooltip-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 8px;
    width: 190px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease;
    pointer-events: none;
    z-index: 10;
}

.pamipet-connect-tooltip-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.pamipet-connect-selected-badge:hover .pamipet-connect-tooltip-bubble,
.pamipet-connect-selected-badge:focus .pamipet-connect-tooltip-bubble,
.pamipet-connect-selected-badge:focus-visible .pamipet-connect-tooltip-bubble {
    opacity: 1;
    visibility: visible;
}

/* Modal Styling */
.pamipet-connect-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.pamipet-connect-modal.is-open {
    opacity: 1;
    visibility: visible;
}

.pamipet-connect-modal__overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
}

.pamipet-connect-modal__container {
    position: relative;
    background: white;
    width: 90%;
    max-width: 450px;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pamipet-connect-modal.is-open .pamipet-connect-modal__container {
    transform: scale(1);
}

.pamipet-connect-modal__header {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pamipet-connect-modal__header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
}

.pamipet-connect-modal__close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #64748b;
    font-size: 20px;
    transition: all 0.2s;
}

.pamipet-connect-modal__close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.pamipet-connect-modal__body {
    padding: 24px;
    max-height: 400px;
    overflow-y: auto;
}

/* Pet Grid */
.pamipet-connect-pet-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.pamipet-connect-pet-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #f8fafc;
    border: 2px solid transparent;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.pamipet-connect-pet-card:hover {
    background: #ffffff;
    border-color: #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.1);
    transform: translateY(-2px);
}

/* Ya asignada desde una elección anterior -- no tiene sentido volver a
 * ofrecerla al reabrir el modal desde "+ Agregar también para otra
 * mascota". */
.pamipet-connect-pet-card.is-assigned {
    display: none;
}

.pamipet-connect-pet-card__icon {
    font-size: 28px;
    margin-right: 16px;
    background: white;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    overflow: hidden;
}

.pamipet-connect-pet-card__icon img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: cover;
    flex-shrink: 0;
}

.pamipet-connect-pet-card__info {
    display: flex;
    flex-direction: column;
}

.pamipet-connect-pet-card__name {
    font-weight: 700;
    color: #1e293b;
    font-size: 16px;
}

.pamipet-connect-pet-card__breed {
    font-size: 13px;
    color: #64748b;
}
