/* ═══════════════════════════════════════════════════════════════
   modal-variante.css — Modal de selección de variante
   ═══════════════════════════════════════════════════════════════ */

.modal-var {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-var__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    backdrop-filter: blur(2px);
}

/* ── Diálogo ─────────────────────────────────────────────────── */
.modal-var__dialog {
    position: relative;
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .18);
    overflow: hidden;
    animation: modal-entrar .2s cubic-bezier(.2, 1, .3, 1);
}

@keyframes modal-entrar {
    from { opacity: 0; transform: scale(.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1)   translateY(0); }
}

/* ── Header ──────────────────────────────────────────────────── */
.modal-var__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.modal-var__titulo {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-texto);
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.modal-var__cerrar {
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border: none;
    background: #f4f4f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background .15s;
}

.modal-var__cerrar:hover { background: #e5e7eb; }

/* ── Cuerpo ──────────────────────────────────────────────────── */
.modal-var__cuerpo {
    display: flex;
    gap: 1.25rem;
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* Imagen */
.modal-var__imagen {
    width: 8.5rem;
    height: 8.5rem;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f4f4f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-var__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .25s ease;
}

.modal-var__sin-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Atributos */
.modal-var__atributos {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    min-width: 0;
}

.modal-var__grupo { display: flex; flex-direction: column; gap: 0.4rem; }

.modal-var__grupo-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: #6b7280;
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.modal-var__grupo-sel {
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #111;
}

.modal-var__valores {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

/* Botón valor texto (talla, etc.) */
.modal-var__valor--texto {
    padding: 0.3rem 0.75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    background: #fff;
    color: var(--color-texto);
    transition: border-color .15s, background .15s, color .15s;
    line-height: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.modal-var__valor--texto:hover:not(:disabled)       { border-color: #aaa; }
.modal-var__valor--texto.modal-var__valor--sel      { border-color: #111; background: #111; color: #fff; }
.modal-var__valor--texto.modal-var__valor--sel .modal-var__extra-badge { color: #a3e635; }

/* Badge de precio extra (aparece en texto y debajo del color) */
.modal-var__extra-badge {
    font-size: 0.62rem;
    font-weight: 700;
    color: #059669;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -.01em;
}

/* Wrapper transparente para texto — no afecta el flex del contenedor */
.modal-var__item { display: contents; }

/* Contenedor color: círculo + precio debajo */
.modal-var__color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.modal-var__color-item .modal-var__extra-badge {
    font-size: 0.58rem;
}

/* Botón valor color (swatch) */
.modal-var__valor--color {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, .1);
    cursor: pointer;
    transition: transform .15s, outline-offset .15s;
}

.modal-var__valor--color:hover:not(:disabled)          { transform: scale(1.08); }
.modal-var__valor--color.modal-var__valor--sel         { outline: 2.5px solid #111; outline-offset: 2.5px; transform: scale(1.1); }

/* ── Valor bloqueado (sin stock / combinación inexistente) ─── */
.modal-var__valor--bloqueado {
    opacity: 0.4;
    cursor: not-allowed;
    position: relative;
}

.modal-var__valor--bloqueado::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top right,
        transparent calc(50% - 0.75px),
        #555       calc(50% - 0.75px),
        #555       calc(50% + 0.75px),
        transparent calc(50% + 0.75px)
    );
    border-radius: inherit;
    pointer-events: none;
}

/* Aviso combinación no disponible */
.modal-var__no-disp {
    font-size: 0.78rem;
    font-weight: 500;
    color: #ef4444;
    margin: 0;
}

.modal-var__no-disp--stock {
    color: #b45309;
}

/* ── Footer ──────────────────────────────────────────────────── */
.modal-var__footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.modal-var__precio {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-texto);
    white-space: nowrap;
    letter-spacing: -.02em;
}

/* Precio por unidad (aparece cuando cantidad > 1) */
.modal-var__precio-unit {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    color: #9ca3af;
    margin-top: 0.1rem;
}

/* Controles de cantidad */
.modal-var__cant {
    display: flex;
    align-items: center;
    border: 1.5px solid #e5e7eb;
    border-radius: 7px;
    overflow: hidden;
    flex-shrink: 0;
}

.modal-var__cant-btn {
    width: 2.1rem;
    height: 2.1rem;
    border: none;
    background: #f9fafb;
    color: #374151;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    flex-shrink: 0;
}

.modal-var__cant-btn:hover:not(:disabled) { background: #f3f4f6; }
.modal-var__cant-btn:disabled             { opacity: .35; cursor: not-allowed; }

.modal-var__cant-num {
    min-width: 2.25rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-texto);
    border-left: 1.5px solid #e5e7eb;
    border-right: 1.5px solid #e5e7eb;
    line-height: 2.1rem;
    padding: 0 0.2rem;
}

/* Contenedor de los dos botones del footer */
.modal-var__botones {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.modal-var__confirmar {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, border-color .15s, opacity .15s;
    white-space: nowrap;
}

.modal-var__confirmar:not(:disabled):hover { background: #333; }
.modal-var__confirmar:disabled             { opacity: .4; cursor: not-allowed; }

/* Botón secundario — lista de deseos */
.modal-var__confirmar--deseo {
    background: #fff;
    color: #111;
    border: 1.5px solid #e5e7eb;
}
.modal-var__confirmar--deseo:not(:disabled):hover { background: #f9fafb; border-color: #d1d5db; }
.modal-var__confirmar--deseo:disabled             { opacity: .4; cursor: not-allowed; }

/* ── Móvil ───────────────────────────────────────────────────── */
@media (max-width: 480px) {
    .modal-var__cuerpo  { flex-direction: column; }
    .modal-var__imagen  { width: 100%; height: 11rem; }
    .modal-var__footer  { flex-wrap: wrap; gap: 0.75rem; }
    .modal-var__precio  { flex: 1; }
    .modal-var__botones { width: 100%; }
}
