/* ── Overlay ──────────────────────────────────────────────────────────────── */
.pcj-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: pcjFadeIn .18s ease;
}
.pcj-overlay[hidden] { display: none; }

@keyframes pcjFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Popup container ─────────────────────────────────────────────────────── */
.pcj-popup {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 540px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    animation: pcjSlideUp .22s ease;
}

.pcj-popup__body {
    overflow-y: auto;
    padding: 22px 24px 20px;
}

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

/* ── Cerrar ──────────────────────────────────────────────────────────────── */
.pcj-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 4px 8px;
    transition: color .15s;
    z-index: 1;
}
.pcj-close:hover { color: #333; }

/* ── Cabecera con imagen ─────────────────────────────────────────────────── */
.pcj-popup__product-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding-right: 28px; /* espacio para la X */
}
.pcj-popup__product-header[hidden] { display: none; }

.pcj-popup__product-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.pcj-popup__title {
    margin: 0 0 2px;
    font-size: 18px;
    line-height: 1.25;
}

.pcj-popup__product-name {
    margin: 0;
    color: #666;
    font-size: 13px;
}

/* ── Lista de carrito dentro del popup ───────────────────────────────────── */
/* Selectores con #pcj-cart-items: deben ganar a los estilos de input/button del tema */
#pcj-cart-items {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 4px 12px;
    margin-bottom: 14px;
    font-size: 13.5px;
}
#pcj-cart-items[hidden] { display: none; }

#pcj-cart-items .pcj-cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #e2e8f0;
}
#pcj-cart-items .pcj-cart-item:last-child { border-bottom: none; }

#pcj-cart-items .pcj-cart-item__img {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
}
#pcj-cart-items .pcj-cart-item__img--empty { display: block; }

#pcj-cart-items .pcj-cart-item__name {
    flex: 1;
    min-width: 0;
    color: #1f2937;
    font-weight: 500;
    line-height: 1.35;
}

/* Selector de cantidad: [−][ 1 ][+] */
#pcj-cart-items .pcj-cart-item__qty {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 32px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}
#pcj-cart-items .pcj-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #475569;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    text-transform: none;
    cursor: pointer;
}
#pcj-cart-items .pcj-qty-btn:hover { background: #f1f5f9; color: var(--pcj-brand, #2563eb); }
#pcj-cart-items .pcj-qty-input {
    width: 36px;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-left: 1px solid #e5e7eb;
    border-right: 1px solid #e5e7eb;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    color: #111827;
    font-size: 13.5px;
    font-family: inherit;
    text-align: center;
    -moz-appearance: textfield;
    appearance: textfield;
}
#pcj-cart-items .pcj-qty-input::-webkit-inner-spin-button,
#pcj-cart-items .pcj-qty-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
#pcj-cart-items .pcj-qty-input:focus { outline: 2px solid rgba(var(--pcj-brand-rgb, 37,99,235), .35); outline-offset: -2px; }

/* Quitar producto */
#pcj-cart-items .pcj-cart-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    box-shadow: none;
    color: #94a3b8;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
#pcj-cart-items .pcj-cart-item__remove:hover,
#pcj-cart-items .pcj-cart-item__remove:focus-visible {
    background: #fef2f2;
    color: #dc2626;
}

/* ── Honeypot ────────────────────────────────────────────────────────────── */
.pcj-hp {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

/* ── Grid de campos ──────────────────────────────────────────────────────── */
.pcj-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

@media (max-width: 520px) {
    .pcj-row { grid-template-columns: 1fr; }
    .pcj-popup__body { padding: 20px 16px 16px; }
}

.pcj-popup .pcj-field {
    display: flex;
    flex-direction: column;
    margin: 0 0 10px;
}

.pcj-popup .pcj-field label:not(.pcj-dropzone) {
    margin: 0 0 4px;
    padding: 0;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
    color: #374151;
}

/* Cantidad en una sola línea: etiqueta y campo corto */
.pcj-popup .pcj-field--inline {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}
/* Selectores por ID: deben ganar a las reglas genéricas de label/input */
#pcj-single-qty label { margin: 0; }
#pcj-single-qty input { width: 96px; }

.pcj-hint {
    font-weight: 400;
    color: #9ca3af;
    font-size: 11px;
}

.pcj-field--required label::after {
    content: ' *';
    color: #dc2626;
}

.pcj-popup .pcj-field input,
.pcj-popup .pcj-field textarea,
.pcj-popup .pcj-field select {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px 11px;
    font-size: 14px;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
    color: #111;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    margin: 0;
    line-height: 1.4;
    box-shadow: none;
}
.pcj-popup .pcj-field input:not(.pcj-file-input) {
    height: 38px;
    min-height: 0;
}
.pcj-popup .pcj-field textarea {
    height: auto;
    min-height: 60px;
}

.pcj-popup .pcj-field input:focus,
.pcj-popup .pcj-field textarea:focus {
    outline: none;
    border-color: var(--pcj-brand, #2563eb);
    box-shadow: 0 0 0 3px rgba(var(--pcj-brand-rgb, 37,99,235), .15);
}

.pcj-popup .pcj-field input.pcj-error,
.pcj-popup .pcj-field textarea.pcj-error {
    border-color: #dc2626;
}

.pcj-field textarea { resize: vertical; }

/* ── Adjunto: zona de arrastre ───────────────────────────────────────────── */
.pcj-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

/* Input real oculto visualmente; sigue siendo enfocable y accesible */
.pcj-popup .pcj-field input.pcj-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
    opacity: 0;
}

.pcj-popup .pcj-dropzone {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 10px 14px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    text-align: left;
    font-size: 13.5px;
    font-weight: 400;
    color: #475569;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
.pcj-popup .pcj-dropzone[hidden] { display: none; }

/* Tinte del color de marca sin depender de color-mix() */
.pcj-dropzone::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--pcj-brand, #2563eb);
    opacity: 0;
    transition: opacity .15s;
}
/* Los hijos no capturan eventos: evita parpadeos de dragleave */
.pcj-dropzone > * { position: relative; pointer-events: none; }

.pcj-popup .pcj-dropzone:hover,
.pcj-popup .pcj-dropzone--over,
.pcj-popup .pcj-dropzone:focus-within {
    border-color: var(--pcj-brand, #2563eb);
}
.pcj-dropzone:hover::before        { opacity: .04; }
.pcj-dropzone--over::before        { opacity: .08; }
.pcj-popup .pcj-dropzone:focus-within { box-shadow: 0 0 0 3px rgba(var(--pcj-brand-rgb, 37,99,235), .15); }

.pcj-dropzone__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    color: var(--pcj-brand, #2563eb);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
    transition: transform .15s;
}
.pcj-dropzone--over .pcj-dropzone__icon { transform: translateY(-2px); }

.pcj-dropzone__body {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.pcj-dropzone__text { color: #334155; }
.pcj-dropzone__text strong {
    color: var(--pcj-brand, #2563eb);
    font-weight: 600;
}
.pcj-dropzone__help {
    font-size: 11.5px;
    color: #94a3b8;
}

/* En pantallas táctiles no se arrastra */
@media (hover: none) {
    .pcj-dropzone__drag { display: none; }
}

/* ── Adjunto: archivo seleccionado ───────────────────────────────────────── */
.pcj-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    animation: pcjFadeIn .18s ease;
}
.pcj-file[hidden] { display: none; }

.pcj-file__thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    background: #64748b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
}
.pcj-file__thumb[data-ext="pdf"]  { background: #dc2626; }
.pcj-file__thumb[data-ext="doc"],
.pcj-file__thumb[data-ext="docx"] { background: #2563eb; }
.pcj-file__thumb[data-ext="zip"]  { background: #a16207; }
.pcj-file__thumb--img             { background: #f1f5f9; }
.pcj-file__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pcj-file__info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.pcj-file__name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pcj-file__meta {
    font-size: 12px;
    color: #6b7280;
}

/* Reset fuerte: los temas suelen estilizar todos los <button> */
.pcj-popup .pcj-file__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    color: #6b7280;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.pcj-popup .pcj-file__remove:hover,
.pcj-popup .pcj-file__remove:focus-visible {
    background: #fef2f2;
    color: #dc2626;
}

.pcj-file__error {
    margin: 6px 0 0;
    font-size: 12px;
    color: #b91c1c;
}
.pcj-file__error[hidden] { display: none; }

/* ── Aviso ───────────────────────────────────────────────────────────────── */
.pcj-notice {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
}
.pcj-notice--success { background: #ecfdf5; color: #065f46; border: 1px solid #6ee7b7; }
.pcj-notice--error   { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Botón submit + spinner ──────────────────────────────────────────────── */
.pcj-btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin: 4px 0 0;
    padding: 11px;
    border: none;
    border-radius: 8px;
    background-color: var(--pcj-brand, #2563eb);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s, transform .1s;
    letter-spacing: .3px;
    font-family: inherit;
    text-transform: none;
}
.pcj-btn-submit:hover:not(:disabled)  { opacity: .88; }
.pcj-btn-submit:active:not(:disabled) { transform: scale(.98); }
.pcj-btn-submit:disabled              { opacity: .65; cursor: not-allowed; }

.pcj-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pcjSpin .7s linear infinite;
    flex-shrink: 0;
}
.pcj-spinner.pcj-spinner--active {
    display: inline-block;
}
@keyframes pcjSpin {
    to { transform: rotate(360deg); }
}

/* ── Botón "Solicitarlo" en producto / loop ──────────────────────────────── */
.pcj-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.pcj-btn-solicitar {
    cursor: pointer;
    color: #fff !important;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    padding: 10px 20px;
    border: none;
    transition: opacity .15s;
    display: inline-block;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    line-height: 1.4;
}
.pcj-btn-solicitar:hover { opacity: .85; color: #fff !important; }

/* ── Botón "Agregar a lista de cotización" ───────────────────────────────── */
.pcj-btn-agregar-lista {
    cursor: pointer;
    background: transparent;
    border: 2px solid currentColor;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    padding: 9px 16px;
    transition: background .15s, opacity .15s;
    display: inline-block;
    text-align: center;
    font-family: inherit;
}
.pcj-btn-agregar-lista:hover {
    background: rgba(0,0,0,.06);
}

/* ── Toast de confirmación ───────────────────────────────────────────────── */
.pcj-toast {
    position: fixed;
    bottom: 28px;
    right: 92px;
    background: #1e293b;
    color: #fff;
    padding: 12px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    z-index: 99997;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    max-width: 300px;
    transition: opacity .4s ease;
    opacity: 1;
}
.pcj-toast--hide { opacity: 0; }

/* ── Icono de WhatsApp (botón flotante) ─────────────────────────────────── */
.pcj-wa-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    flex-shrink: 0;
}

/* ── FAB carrito de cotización ───────────────────────────────────────────── */
/* Columna de botones flotantes: WhatsApp encima del carrito */
.pcj-fabs {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
@media (max-width: 520px) {
    .pcj-fabs { right: 16px; bottom: 16px; }
}

.pcj-wa-fab {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #25d366;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    text-decoration: none !important;
    transition: transform .15s, box-shadow .15s;
    animation: pcjFadeIn .3s ease;
}
.pcj-wa-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,.3);
}
.pcj-wa-fab .pcj-wa-icon { width: 28px; height: 28px; }

/* Etiqueta a la izquierda al pasar el ratón */
.pcj-wa-fab::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 6px;
    background: #1e293b;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.pcj-wa-fab:hover::after,
.pcj-wa-fab:focus-visible::after { opacity: 1; }
@media (hover: none) {
    .pcj-wa-fab::after { display: none; }
}

.pcj-cart-fab[hidden] { display: none; }

.pcj-cart-fab {
    position: relative;
    width: 54px;
    height: 54px;
    background: var(--pcj-brand, #1e40af);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.25);
    z-index: 99998;
    border: none;
    transition: transform .15s, box-shadow .15s;
    animation: pcjFadeIn .3s ease;
}
.pcj-cart-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,.3);
}

.pcj-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ── Capa de carga centrada sobre el modal ───────────────────────────────── */
.pcj-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(2px);
    animation: pcjFadeIn .15s ease;
}
.pcj-loading[hidden] { display: none; }

.pcj-loading__spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(var(--pcj-brand-rgb, 37,99,235), .18);
    border-top-color: var(--pcj-brand, #2563eb);
    border-radius: 50%;
    animation: pcjSpin .75s linear infinite;
}

.pcj-loading__text {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
}

/* ── Pantalla de agradecimiento ──────────────────────────────────────────── */
.pcj-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 8px 6px;
    text-align: center;
    animation: pcjSlideUp .25s ease;
}
.pcj-success[hidden] { display: none; }

.pcj-success__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: rgba(var(--pcj-brand-rgb, 37,99,235), .12);
    color: var(--pcj-brand, #2563eb);
}

.pcj-popup .pcj-success__title {
    margin: 0 0 6px;
    font-size: 22px;
    line-height: 1.25;
    color: #111827;
    outline: none;
}

.pcj-success__text {
    margin: 0 0 4px;
    max-width: 360px;
    font-size: 14.5px;
    color: #475569;
}

.pcj-success__meta {
    margin: 0 0 20px;
    font-size: 13px;
    color: #94a3b8;
}
.pcj-success__meta:empty { display: none; }

.pcj-popup .pcj-success__close {
    width: auto;
    min-width: 180px;
    padding: 11px 28px;
}

@media (prefers-reduced-motion: reduce) {
    .pcj-loading__spinner { animation-duration: 1.6s; }
    .pcj-success, .pcj-loading { animation: none; }
}
