/**
 * ZonaCNC Product Page — Machineseeker-style Layout
 * Two-column: left (data + price) | right (seller + contact form)
 */

/* WCAG 1.3.1: product__right (H1) is now first DOM child.
   Use order to keep product__left visually on the left column. */
.product__container > .product__left { order: 1; }
.product__container > .product__right { order: 2; }

/* ── Hide PS e-commerce elements ── */
.product-add-to-cart,
.product-quantity,
.add-to-cart,
#add-to-cart-or-refresh,
.product-availability,
.product-out-of-stock,
.product-in-stock,
.product-last-items,
.product-minimal-quantity,
.product-additional-info .social-sharing,
.product-pack,
.product-discounts,
.product-variants,
.tax-shipping-delivery-label,
.product-prices .product-discount,
.product-prices .regular-price {
    display: none !important;
}

/* Hide PS default price — we show our own */
.product-prices {
    display: none !important;
}

/* Hide PS product flags (Nuevo, Fuera de stock badges on image) */
.product-flags,
.product-flag,
.product__flags {
    display: none !important;
}

/* Hide PS product actions (form, notify, social), bottom section, comments */
.product__actions {
    display: none !important;
}
.product__bottom {
    display: none !important;
}
.product-comments-wrapper {
    display: none !important;
}
.blockreassurance_product,
[class*="reassurance"] {
    display: none !important;
}

/* ═══════ MACHINE DATA LAYOUT (full-width below image) ═══════ */
.zcnc-product-layout {
    display: block;
    margin: 1.5rem 0 2rem;
}

/* Right column is now moved into product__right via JS — hide it in the grid */
.zcnc-product-right {
    display: none;
}

/* Sticky sidebar — v6 2026-04-29: hide-on-scroll dinámico.
   Por defecto se ve TODO (descripción corta, vendor title/meta).
   Al hacer scroll (>80px) se añade .is-sticky-collapsed vía JS y
   se ocultan los elementos no esenciales para que name+brand+vendor+form
   quepan en el viewport sticky. top: 7rem despeja el header sticky de Hummingbird. */
.product__right {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 7rem !important;
    align-self: start !important;
    z-index: 10;
}

/* Modo collapsed (sólo cuando hay scroll): ocultar elementos no esenciales.
   Incluye .zcnc-desc-wrap (que envuelve description-short + toggle "Ver más"). */
.product__right.is-sticky-collapsed .product__description-short,
.product__right.is-sticky-collapsed .product__description-short.rich-text,
.product__right.is-sticky-collapsed .zcnc-desc-wrap,
.product__right.is-sticky-collapsed .zcnc-seller-title,
.product__right.is-sticky-collapsed .zcnc-seller-meta {
    display: none !important;
}

/* Vendor card + form: pegados sólo en modo collapsed para look cohesivo */
.product__right.is-sticky-collapsed .zcnc-seller-card {
    margin-bottom: 0 !important;
    border-radius: 8px 8px 0 0 !important;
    border-bottom: 1px solid rgba(0,0,0,0.08) !important;
    padding: 0.75rem 0.9rem !important;
}
.product__right.is-sticky-collapsed .zcnc-contact-form-card {
    margin-top: 0 !important;
    border-radius: 0 0 8px 8px !important;
}

/* Margin-top reducido entre prices/manufacturer y seller card */
.product__right .product__manufacturer + .zcnc-seller-card,
.product__right .zcnc-seller-card {
    margin-top: 0.6rem !important;
}

/* Compactar h1 + manufacturer en la sidebar sticky */
.product__right .product__name {
    font-size: 1.25rem !important;
    line-height: 1.3 !important;
    margin: 0 0 0.35rem !important;
    color: #1a2332;
}
.product__right .product__manufacturer {
    font-size: 0.85rem !important;
    margin: 0 0 0.75rem !important;
    color: #5a6470;
}
.product__right .product__manufacturer a {
    color: #5a6470;
    text-decoration: none;
}
.product__right .product__manufacturer img {
    max-height: 24px;
    max-width: 60px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Compactar contact form para que quepa todo */
.product__right .zcnc-contact-form-card {
    padding: 0.85rem 1rem !important;
    margin-top: 0.5rem;
}
.product__right .zcnc-contact-form-title {
    font-size: 0.85rem !important;
    margin-bottom: 0.6rem !important;
}
.product__right .zcnc-inline-contact-form textarea {
    min-height: 90px !important;
    font-size: 0.82rem !important;
    padding: 0.5rem 0.65rem !important;
}
.product__right .zcnc-inline-contact-form input[type="text"],
.product__right .zcnc-inline-contact-form input[type="email"],
.product__right .zcnc-inline-contact-form input[type="tel"] {
    padding: 0.45rem 0.65rem !important;
    font-size: 0.82rem !important;
}
.product__right .zcnc-inline-contact-form .zcnc-form-field {
    margin-bottom: 0.4rem !important;
}
.product__right .zcnc-submit-solicitud {
    padding: 0.55rem !important;
    font-size: 0.88rem !important;
    margin-top: 0.5rem !important;
    min-height: 44px !important;
}

/* Seller card: más compacto */
.product__right .zcnc-seller-card {
    padding: 0.75rem 0.9rem !important;
    margin-bottom: 0.5rem;
}

/* Bandera del país en la ubicación de la máquina */
.zcnc-flag {
    display: inline-block;
    width: 20px;
    height: auto;
    vertical-align: -2px;
    margin-left: 4px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 2px;
}

/* Description-short clamped a 3 líneas con "Ver más" inline + degradado.
   El JS envuelve la descripción en .zcnc-desc-wrap y posiciona el botón
   absolutamente al final de la 3ª línea con fade desde transparente a #fff
   para que no quede pegado al texto. */
.product__right .zcnc-desc-wrap {
    position: relative;
    margin: 0 0 0.5rem;
}
.product__right .product__description-short {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}
.product__right .product__description-short.is-expanded {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
}
.product__right .zcnc-desc-wrap .zcnc-desc-toggle {
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 0 0 0 48px;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, #fff 30%, #fff 100%);
    color: #c62828;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.5;
    border: 0;
    cursor: pointer;
    text-decoration: underline;
}
.product__right .zcnc-desc-wrap.is-expanded .zcnc-desc-toggle {
    position: static;
    background: none;
    padding: 4px 0 0;
}
.product__right .zcnc-desc-toggle:hover { text-decoration: none; }

/* Avatar con logo de empresa: la <img> rellena el círculo */
.zcnc-seller-avatar.zcnc-seller-avatar--has-logo {
    padding: 0 !important;
    overflow: hidden;
    background: #fff !important;
    color: transparent !important;
}
.zcnc-seller-avatar.zcnc-seller-avatar--has-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Mapa de ubicación del vendedor */
.zcnc-seller-map {
    margin-top: 0.6rem;
    border: 1px solid #e0e6ef;
    border-radius: 6px;
    overflow: hidden;
    background: #f5f7fa;
}
.zcnc-seller-map iframe {
    display: block;
    width: 100%;
}
.zcnc-seller-map-link {
    display: block;
    padding: 6px 10px;
    font-size: 0.78rem;
    color: #1a73e8;
    text-decoration: none;
    border-top: 1px solid #e0e6ef;
    background: #fff;
}
.zcnc-seller-map-link:hover { text-decoration: underline; }

/* En modo sticky-collapsed el mapa estorba — lo ocultamos para que el form quepa */
.product__right.is-sticky-collapsed .zcnc-seller-map {
    display: none !important;
}

/* ── LEFT COLUMN ── */
.zcnc-product-left {
    min-width: 0;
}

/* Price Bar */
.zcnc-price-bar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.zcnc-price-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.zcnc-price-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.zcnc-price-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #c62828;
    line-height: 1.1;
}

.zcnc-price-consultar {
    color: #555;
    font-size: 1.25rem;
}

.zcnc-price-type {
    display: inline-block;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-top: 0.25rem;
}

.zcnc-quick-info {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.zcnc-quick-item {
    display: flex;
    flex-direction: column;
}

.zcnc-quick-label {
    font-size: 0.7rem;
    color: #595959;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.zcnc-quick-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: #333;
}

/* Data Section (Datos de la maquina) */
.zcnc-data-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.zcnc-data-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.zcnc-data-table {
    width: 100%;
    border-collapse: collapse;
}

.zcnc-data-table tr {
    border-bottom: 1px solid #f0f0f0;
}

.zcnc-data-table tr:last-child {
    border-bottom: none;
}

.zcnc-dt-label {
    padding: 0.6rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #555;
    width: 40%;
    vertical-align: top;
}

.zcnc-dt-value {
    padding: 0.6rem 0;
    font-size: 0.875rem;
    color: #222;
}

/* Specs sin valor: gris atenuado para no compita con los valores reales */
.zcnc-data-table tr.zcnc-spec-empty .zcnc-dt-label {
    color: #888;
    font-weight: 500;
}
.zcnc-spec-pending {
    font-style: italic;
    color: #888;
    font-size: 0.85rem;
}

/* Condition Badge */
.zcnc-condition-badge {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
}

.zcnc-condition-badge.condition-new {
    background: #e8f5e9;
    color: #2e7d32;
}

.zcnc-condition-badge.condition-used {
    background: #e3f2fd;
    color: #1565c0;
}

.zcnc-condition-badge.condition-repair {
    background: #fff3e0;
    color: #e65100;
}

.zcnc-condition-badge.condition-parts {
    background: #fce4ec;
    color: #c62828;
}

/* Video button */
.zcnc-btn-video {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    background: #f5f5f5;
    color: #333;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.15s;
}

.zcnc-btn-video:hover {
    background: #e0e0e0;
    text-decoration: none;
}

/* Seller Card */
.zcnc-seller-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.zcnc-seller-title {
    font-size: 1rem;
    font-weight: 700;
    color: #333;
    margin: 0 0 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0f0f0;
}

.zcnc-seller-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.zcnc-seller-avatar {
    width: 48px;
    height: 48px;
    background: #1565c0;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    flex-shrink: 0;
}

.zcnc-seller-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.zcnc-seller-name {
    font-size: 1rem;
    font-weight: 700;
    color: #222;
}

.zcnc-verified-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    width: fit-content;
}

.zcnc-seller-meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.zcnc-seller-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #666;
}

.zcnc-seller-meta-item svg {
    flex-shrink: 0;
    color: #999;
}

.zcnc-seller-phone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.65rem;
    background: #f5f5f5;
    color: #333;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
    border: 1px solid #e0e0e0;
}

.zcnc-seller-phone-btn:hover {
    background: #e8e8e8;
    color: #333;
    text-decoration: none;
}

/* Seller card — Ocasional variant */
.zcnc-seller-avatar--ocasional {
    background: #78909c;
}
.zcnc-ocasional-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: #fff3e0;
    color: #e65100;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    width: fit-content;
}
.zcnc-ocasional-tag svg {
    flex-shrink: 0;
}

/* Seller card — Pro variant */
.zcnc-seller-avatar--pro {
    background: #1565c0;
}

/* Owner CTA block */
.zcnc-owner-cta {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #bbdefb;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
    text-align: center;
}
.zcnc-owner-cta-icon {
    margin-bottom: 0.5rem;
    color: #1565c0;
}
.zcnc-owner-cta-icon svg {
    width: 28px;
    height: 28px;
}
.zcnc-owner-cta-text {
    font-size: 0.8rem;
    color: #444;
    line-height: 1.4;
    margin: 0 0 0.75rem;
}
.zcnc-owner-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.25rem;
    background: #1565c0;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s;
}
.zcnc-owner-cta-btn:hover {
    background: #0d47a1;
    color: #fff;
    text-decoration: none;
}

/* Masked phone display */
.zcnc-seller-phone-masked {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #333;
}
.zcnc-seller-phone-masked svg {
    flex-shrink: 0;
    color: #666;
}
.zcnc-phone-number {
    font-weight: 600;
    letter-spacing: 0.5px;
}
.zcnc-phone-reveal-link {
    margin-left: auto;
    font-size: 0.75rem;
    color: #1565c0;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.zcnc-phone-reveal-link:hover {
    text-decoration: underline;
    color: #0d47a1;
}
a.zcnc-phone-number {
    color: #1565c0;
    text-decoration: none;
}
a.zcnc-phone-number:hover { text-decoration: underline; }
.zcnc-phone-reveal-btn {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: #1565c0;
    border: 0;
    border-radius: 6px;
    padding: 0.4rem 0.95rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.zcnc-phone-reveal-btn:hover { background: #0d47a1; }
.zcnc-phone-reveal-btn:disabled { opacity: .6; cursor: default; }

/* Owner badge */
.zcnc-owner-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
}
.zcnc-owner-badge svg {
    flex-shrink: 0;
}

/* Feature Banner — invita al owner a destacar su anuncio */
.zcnc-feature-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    margin-top: 0.5rem;
    padding: 0.75rem 0.9rem;
    border-radius: 8px;
    border: 1px solid;
    font-size: 0.85rem;
    line-height: 1.35;
}
.zcnc-feature-banner > svg {
    flex-shrink: 0;
    margin-top: 2px;
}
.zcnc-feature-banner__body {
    flex: 1 1 auto;
    min-width: 0;
}
.zcnc-feature-banner__body strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}
.zcnc-feature-banner__body small {
    display: block;
    font-size: 0.78rem;
    opacity: 0.85;
}
.zcnc-feature-banner__btn {
    flex-shrink: 0;
    align-self: center;
    background: #f59e0b;
    color: #fff;
    border: 0;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}
.zcnc-feature-banner__btn:hover {
    background: #d97706;
    color: #fff;
    text-decoration: none;
}
.zcnc-feature-banner__btn:disabled,
.zcnc-feature-banner__btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}
.zcnc-feature-banner--cta {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}
.zcnc-feature-banner--cta > svg { stroke: #f59e0b; }
.zcnc-feature-banner--upgrade {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1e3a8a;
}
.zcnc-feature-banner--upgrade > svg { stroke: #2563eb; }
.zcnc-feature-banner--upgrade .zcnc-feature-banner__btn {
    background: #2563eb;
}
.zcnc-feature-banner--upgrade .zcnc-feature-banner__btn:hover {
    background: #1d4ed8;
}
.zcnc-feature-banner--active {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #78350f;
}
.zcnc-feature-banner--full {
    background: #fef3c7;
    border-color: #d97706;
    color: #78350f;
}
.zcnc-feature-banner--full > svg { stroke: #b45309; }

/* Contact Form Card */
.zcnc-contact-form-card {
    background: #1a2332;
    border-radius: 8px;
    padding: 1.25rem;
    color: #fff;
}

.zcnc-contact-form-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1rem;
    letter-spacing: 0.05em;
}

.zcnc-inline-contact-form .zcnc-form-field {
    margin-bottom: 0.6rem;
}

.zcnc-inline-contact-form textarea,
.zcnc-inline-contact-form input[type="text"],
.zcnc-inline-contact-form input[type="email"],
.zcnc-inline-contact-form input[type="tel"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #3a4a5c;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.zcnc-inline-contact-form textarea:focus,
.zcnc-inline-contact-form input:focus {
    border-color: #2e7d32;
    box-shadow: 0 0 0 2px rgba(46, 125, 50, 0.15);
}

.zcnc-inline-contact-form textarea {
    resize: vertical;
    min-height: 170px;
    font-family: inherit;
}

.zcnc-submit-solicitud {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: #2e7d32;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.25rem;
}

.zcnc-submit-solicitud:hover {
    background: #1b5e20;
}

/* Description content (moved from PS accordion into our layout) */
.zcnc-desc-content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: #444;
    word-break: break-word;
}

.zcnc-desc-content a {
    color: #1565c0;
}

/* ── Ensure cards fill their container ── */
.zcnc-contact-form-card,
.zcnc-seller-card {
    box-sizing: border-box;
    width: 100%;
}

/* ── RESPONSIVE ── */
@media (max-width: 991px) {
    .product__right {
        position: static !important;
    }

    /* Header mobile: h1 + brand + descripcion corta movidos al principio del container.
       El JS hace insertBefore(firstChild) en .product__container, asi que el orden
       DOM ya es correcto sin necesidad de flex order (que provocaba CLS catastrofico
       en PDP — ver PSI v2 2026-04-28: 0.992 en main#wrapper). */
    .zcnc-mobile-header .product__name {
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
        font-size: 1.4rem;
        line-height: 1.25;
    }
    .zcnc-mobile-header .product__description-short {
        font-size: 0.95rem;
        color: #555;
        margin-bottom: 0;
    }
    .zcnc-mobile-header .product-manufacturer,
    .zcnc-mobile-header [itemprop="brand"] {
        font-size: 0.85rem;
        color: #777;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
}

/* Wrapper hidden por defecto en desktop — solo se muestra cuando JS lo crea
   (que solo crea en mobile). Pero si el viewport rota a desktop tras crearlo,
   queda colgado: este rule lo oculta para no romper el grid 2-col. */
@media (min-width: 992px) {
    .zcnc-mobile-header { display: none !important; }
}

@media (max-width: 576px) {
    .zcnc-price-bar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .zcnc-quick-info {
        gap: 1rem;
    }

    .zcnc-dt-label {
        width: 45%;
    }
}

/* ═══════ FINDING-008: PDP thumbnail list a11y fix ═══════ */
/* <li> wrappers injected by pdp-thumbnails-a11y.js need zero default styling
   so the CSS grid on <ul> governs layout without disruption. */
ul.product__thumbnails-list > li {
    display: block;
    padding: 0;
    margin: 0;
    list-style: none;
}

/* The <button> inside <li> must fill the grid cell (same as original direct child). */
ul.product__thumbnails-list > li > button.product__thumbnail {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
}
