/* =================================================================
   Modal "Comprar este diseño" — picker compartido entre Comunidad
   y Swipea. Se monta una sola vez en el body cuando se abre por
   primera vez. Mobile-first, sheet-style en móvil.
   ================================================================= */
.pcbuy-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, .58);
    padding: 0;
    overflow: hidden;
    animation: pcbuy-fade .18s ease;
}
@media (min-width: 720px) {
    .pcbuy-modal { align-items: center; padding: 24px; }
}
@keyframes pcbuy-fade { from { opacity: 0; } to { opacity: 1; } }

.pcbuy-card {
    width: 100%;
    max-width: 460px;
    background: #FFFFFF;
    color: #0F172A;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 40px rgba(15, 23, 42, .25);
    padding: 18px 18px 22px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    animation: pcbuy-slide .22s cubic-bezier(.16,.84,.44,1);
}
@media (min-width: 720px) {
    .pcbuy-card { border-radius: 18px; padding: 22px 24px 24px; }
}
@keyframes pcbuy-slide { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.pcbuy-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 0;
    background: rgba(15, 23, 42, .05);
    color: #0F172A;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pcbuy-close:hover { background: rgba(15, 23, 42, .1); }

.pcbuy-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 36px 4px 0;
    letter-spacing: -.01em;
}
.pcbuy-product {
    font-size: 13.5px;
    color: #64748B;
    margin: 0 0 14px;
    min-height: 18px;
}
.pcbuy-product strong { color: #0F172A; font-weight: 700; }

.pcbuy-preview {
    position: relative;
    width: 100%;
    aspect-ratio: var(--pcbuy-ar, 1 / 1.05);
    background: linear-gradient(180deg, #F1F5F9 0%, #E2E8F0 100%);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 14px;
    isolation: isolate;
}
.pcbuy-preview img.pcbuy-img,
.pcbuy-preview img.pcbuy-overlay {
    position: absolute;
    inset: 0;
    margin: auto;
    max-width: 92%;
    max-height: 92%;
    object-fit: contain;
}
.pcbuy-preview img.pcbuy-overlay { mix-blend-mode: multiply; }
.pcbuy-preview img.pcbuy-design {
    position: absolute;
    object-fit: contain;
    pointer-events: none;
}
.pcbuy-preview.is-negative img.pcbuy-design { filter: invert(1); }

.pcbuy-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}
.pcbuy-row-label {
    font-size: 12.5px;
    font-weight: 700;
    color: #64748B;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.pcbuy-select {
    appearance: none;
    width: 100%;
    border: 1.5px solid #E2E8F0;
    background: #FFFFFF;
    color: #0F172A;
    border-radius: 10px;
    padding: 12px 38px 12px 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.pcbuy-select:focus {
    outline: 0;
    border-color: #6366F1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .15);
}

.pcbuy-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.pcbuy-color {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: 2px solid #FFF;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, .15);
    background-size: cover;
    background-position: center;
    background-color: #FFF;
    cursor: pointer;
    padding: 0;
    transition: transform .12s ease, box-shadow .12s ease;
}
.pcbuy-color:hover { transform: scale(1.06); }
.pcbuy-color.is-on {
    box-shadow: 0 0 0 2.5px #6366F1, 0 0 0 4px rgba(99, 102, 241, .2);
}

.pcbuy-status {
    font-size: 13px;
    color: #DC2626;
    margin: 6px 0 0;
    min-height: 18px;
}
.pcbuy-status.is-ok { color: #047857; }

.pcbuy-foot {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.pcbuy-foot .pcbuy-cta {
    flex: 1;
    border: 0;
    background: #6366F1;
    color: #FFF;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 15.5px;
    font-weight: 800;
    cursor: pointer;
    transition: background .15s ease, transform .12s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.pcbuy-foot .pcbuy-cta:hover { background: #4F46E5; }
.pcbuy-foot .pcbuy-cta:active { transform: translateY(1px); }
.pcbuy-foot .pcbuy-cta[disabled] { opacity: .55; cursor: progress; }

.pcbuy-skeleton {
    text-align: center;
    color: #64748B;
    font-size: 13.5px;
    padding: 32px 12px;
}
.pcbuy-skeleton::before {
    content: "";
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, .2);
    border-top-color: #6366F1;
    margin-right: 10px;
    vertical-align: middle;
    animation: pcbuy-spin 1s linear infinite;
}
@keyframes pcbuy-spin { to { transform: rotate(360deg); } }
