/**
 * Vehículos CR – Información del vehículo
 * Frontend 1.3.8
 * Barra técnica horizontal, compacta y adaptable por ancho real del componente.
 */

.vcrvi-product-card,
.woocommerce ul.products li.product.vcrvi-product-card {
    position: relative;
    overflow: visible !important;
}

.vcrvi-product-card.vcrvi-tooltip-active,
.woocommerce ul.products li.product.vcrvi-product-card.vcrvi-tooltip-active {
    z-index: 9990;
}

/* ==========================================================
 * BARRA TÉCNICA COMPACTA
 * Orden: Especificaciones → Extras → controles externos
 * ========================================================== */
.vcrvi-info-bar {
    --vcrvi-blue-900: #12365f;
    --vcrvi-blue-700: #1c5b95;
    --vcrvi-blue-100: #eef5fb;
    --vcrvi-line: #d9e4ee;
    --vcrvi-text: #223548;
    --vcrvi-muted: #66798b;
    --vcrvi-tooltip-width: 100%;
    --vcrvi-tooltip-left: 0px;
    --vcrvi-tooltip-arrow-x: 24px;

    container-name: vcrvi-bar;
    container-type: inline-size;

    display: flex;
    align-items: stretch;
    width: 100%;
    min-height: 38px;
    margin: 7px 0 0;
    padding: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 12;

    border: 1px solid var(--vcrvi-line);
    border-radius: 10px;
    background: linear-gradient(180deg, #fbfdff 0%, #f2f6fa 100%);
    box-shadow: 0 3px 9px rgba(17, 54, 95, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.92);

    color: var(--vcrvi-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 10.5px;
    line-height: 1;
    isolation: isolate;
    overflow: visible;
}

.vcrvi-info-bar > .vcrvi-control,
.vcrvi-info-bar > .vcrvi-car-id {
    min-width: 0;
    min-height: 38px;
    box-sizing: border-box;
}

.vcrvi-info-bar > * + * {
    border-left: 1px solid var(--vcrvi-line);
}

/* Proporciones con tres elementos. */
.vcrvi-info-bar--items-3 > .vcrvi-control--specifications {
    flex: 1.35 1 0;
}

.vcrvi-info-bar--items-3 > .vcrvi-control--extras {
    flex: 0.82 1 0;
}

.vcrvi-info-bar--items-3 > .vcrvi-car-id {
    flex: 1.02 1 0;
}

/* Proporciones con cuatro elementos: Ficha → Extras → Condiciones → Car ID. */
.vcrvi-info-bar--items-4 > .vcrvi-control--specifications {
    flex: 1.08 1 0;
}

.vcrvi-info-bar--items-4 > .vcrvi-control--extras {
    flex: 0.82 1 0;
}

.vcrvi-info-bar--items-4 > .vcrvi-control--conditions {
    flex: 1.02 1 0;
}

.vcrvi-info-bar--items-4 > .vcrvi-car-id {
    flex: 1.08 1 0;
}

/* Si falta Extras, los dos elementos restantes ocupan exactamente la mitad. */
.vcrvi-info-bar--items-2 > * {
    flex: 1 1 50%;
}

.vcrvi-info-bar--items-1 > * {
    flex: 1 1 100%;
}

.vcrvi-control {
    position: relative;
}

.vcrvi-trigger,
.vcrvi-car-id {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    min-width: 0;
    min-height: 38px;
    margin: 0;
    padding: 5px 8px;
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    box-shadow: none;
    font: inherit;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}

.vcrvi-trigger {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.vcrvi-trigger:hover,
.vcrvi-trigger:focus-visible,
.vcrvi-trigger[aria-expanded="true"] {
    background: var(--vcrvi-blue-100);
    color: var(--vcrvi-blue-900);
    text-decoration: none;
    box-shadow: inset 0 -2px 0 rgba(28, 91, 149, 0.55);
}

.vcrvi-trigger:focus-visible {
    position: relative;
    z-index: 2;
    outline: 2px solid rgba(28, 91, 149, 0.30);
    outline-offset: -2px;
}

.vcrvi-trigger__icon-wrap,
.vcrvi-car-id__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 50%;
    background: rgba(28, 91, 149, 0.09);
    color: var(--vcrvi-blue-700);
}

.vcrvi-car-id__icon {
    background: var(--vcrvi-blue-900);
    color: #fff;
}

.vcrvi-trigger__icon {
    width: 11px;
    height: 11px;
    flex: 0 0 11px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.vcrvi-trigger__label,
.vcrvi-car-id__label,
.vcrvi-car-id__value {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vcrvi-trigger__label {
    font-size: 10.4px;
    font-weight: 700;
    color: currentColor;
}

.vcrvi-trigger__label--compact,
.vcrvi-car-id__label--compact {
    display: none;
}

.vcrvi-car-id {
    color: var(--vcrvi-muted);
    cursor: default;
}

.vcrvi-car-id__label {
    flex: 0 0 auto;
    font-size: 9.4px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.vcrvi-car-id__value {
    flex: 0 1 auto;
    color: var(--vcrvi-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 10.3px;
    font-weight: 750;
    letter-spacing: 0.015em;
}

/* ==========================================================
 * ETIQUETAS ADAPTATIVAS SEGÚN EL ANCHO REAL DE CADA TARJETA
 * ========================================================== */
@container vcrvi-bar (max-width: 430px) {
    .vcrvi-info-bar--items-4 .vcrvi-trigger__label--full,
    .vcrvi-info-bar--items-4 .vcrvi-car-id__label--full {
        display: none;
    }

    .vcrvi-info-bar--items-4 .vcrvi-trigger__label--compact,
    .vcrvi-info-bar--items-4 .vcrvi-car-id__label--compact {
        display: inline;
    }

    .vcrvi-info-bar--items-4 .vcrvi-trigger,
    .vcrvi-info-bar--items-4 .vcrvi-car-id {
        gap: 3px;
        padding-right: 4px;
        padding-left: 4px;
    }
}

@container vcrvi-bar (max-width: 360px) {
    .vcrvi-info-bar {
        min-height: 37px;
        font-size: 9.6px;
    }

    .vcrvi-info-bar > .vcrvi-control,
    .vcrvi-info-bar > .vcrvi-car-id,
    .vcrvi-trigger,
    .vcrvi-car-id {
        min-height: 37px;
    }

    .vcrvi-trigger,
    .vcrvi-car-id {
        gap: 4px;
        padding: 4px 5px;
    }

    .vcrvi-trigger__label--full,
    .vcrvi-car-id__label--full {
        display: none;
    }

    .vcrvi-trigger__label--compact,
    .vcrvi-car-id__label--compact {
        display: inline;
    }

    .vcrvi-trigger__label,
    .vcrvi-car-id__value {
        font-size: 9.5px;
    }

    .vcrvi-car-id__label {
        font-size: 8.8px;
    }

    .vcrvi-info-bar--items-3 > .vcrvi-control--specifications {
        flex-grow: 1.05;
    }

    .vcrvi-info-bar--items-3 > .vcrvi-control--extras {
        flex-grow: 0.95;
    }

    .vcrvi-info-bar--items-3 > .vcrvi-car-id {
        flex-grow: 1.12;
    }

    .vcrvi-info-bar--items-4 > .vcrvi-control--specifications,
    .vcrvi-info-bar--items-4 > .vcrvi-control--extras,
    .vcrvi-info-bar--items-4 > .vcrvi-control--conditions,
    .vcrvi-info-bar--items-4 > .vcrvi-car-id {
        flex: 1 1 25%;
    }
}

@container vcrvi-bar (max-width: 265px) {
    .vcrvi-trigger,
    .vcrvi-car-id {
        gap: 3px;
        padding-right: 3px;
        padding-left: 3px;
    }

    .vcrvi-trigger__icon-wrap,
    .vcrvi-car-id__icon {
        width: 16px;
        height: 16px;
        flex-basis: 16px;
    }

    .vcrvi-trigger__icon {
        width: 9px;
        height: 9px;
        flex-basis: 9px;
    }

    .vcrvi-trigger__label,
    .vcrvi-car-id__value {
        font-size: 8.7px;
    }

    .vcrvi-car-id__label {
        font-size: 8px;
    }
}

/* Fallback para navegadores sin container queries. */
@supports not (container-type: inline-size) {
    @media (max-width: 767px) {
        .vcrvi-trigger__label--full,
        .vcrvi-car-id__label--full {
            display: none;
        }

        .vcrvi-trigger__label--compact,
        .vcrvi-car-id__label--compact {
            display: inline;
        }

        .vcrvi-trigger,
        .vcrvi-car-id {
            gap: 4px;
            padding-right: 5px;
            padding-left: 5px;
        }
    }
}

/* Mantiene una superficie táctil suficiente sin engrosar la tarjeta. */
@media (hover: none) and (pointer: coarse) {
    .vcrvi-info-bar,
    .vcrvi-info-bar > .vcrvi-control,
    .vcrvi-info-bar > .vcrvi-car-id,
    .vcrvi-trigger,
    .vcrvi-car-id {
        min-height: 40px;
    }
}

/* ==========================================================
 * TOOLTIPS AJUSTADOS AL ANCHO REAL DE LA TARJETA
 * ========================================================== */
.vcrvi-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: var(--vcrvi-tooltip-left, 0px);
    z-index: 999999;
    width: var(--vcrvi-tooltip-width, 100%);
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 150ms ease, visibility 150ms ease, transform 150ms ease;
}

.vcrvi-tooltip.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.vcrvi-tooltip__panel {
    position: relative;
    width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
    box-sizing: border-box;
    padding: 10px 12px 11px;
    border: 1px solid #d8e2ec;
    border-radius: 12px;
    background: #fff;
    color: #33404d;
    box-shadow: 0 16px 38px rgba(23, 48, 78, 0.18), 0 4px 10px rgba(23, 48, 78, 0.10);
    text-align: left;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.vcrvi-tooltip__panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.vcrvi-tooltip__title {
    margin: 0 25px 7px 0;
    padding: 0 0 7px;
    border-bottom: 1px solid #e8eef4;
    color: #125592;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: none;
}

.vcrvi-tooltip__close {
    position: absolute;
    top: 4px;
    right: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #687480;
    box-shadow: none;
    font-family: Arial, sans-serif;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.vcrvi-tooltip__close:hover,
.vcrvi-tooltip__close:focus-visible {
    background: #edf4fb;
    color: #125592;
}

.vcrvi-tooltip__close:focus-visible {
    outline: 2px solid rgba(18, 85, 146, 0.30);
    outline-offset: 1px;
}

.vcrvi-tooltip__arrow {
    position: absolute;
    bottom: -7px;
    left: calc(var(--vcrvi-tooltip-arrow-x, 24px) - 7px);
    width: 14px;
    height: 14px;
    border-right: 1px solid #d8e2ec;
    border-bottom: 1px solid #d8e2ec;
    background: #fff;
    transform: rotate(45deg);
}

.vcrvi-specifications-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.vcrvi-specification {
    display: grid;
    grid-template-columns: minmax(78px, 38%) minmax(0, 1fr);
    column-gap: 6px;
    align-items: start;
    margin: 0;
    padding: 2px 0;
    border-bottom: 1px solid #edf1f5;
    font-size: 10.25px;
    line-height: 1.18;
}

.vcrvi-specification:last-child {
    border-bottom: 0;
}

.vcrvi-specification__label {
    min-width: 0;
    color: #516273;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.vcrvi-specification__value {
    min-width: 0;
    color: #2e3944;
    text-align: left;
    overflow-wrap: anywhere;
}

.vcrvi-extras-content {
    color: #35414d;
    font-size: 11px;
    line-height: 1.34;
}

.vcrvi-extras-content p {
    margin: 0 0 6px;
}

.vcrvi-extras-content p:last-child {
    margin-bottom: 0;
}

.vcrvi-extras-content ul,
.vcrvi-extras-content ol {
    margin: 0;
    padding-left: 18px;
}

.vcrvi-extras-content li {
    margin: 0 0 3px;
    padding-left: 1px;
}

.vcrvi-extras-content li:last-child {
    margin-bottom: 0;
}

.vcrvi-tooltip.is-compact .vcrvi-tooltip__panel {
    padding: 8px 10px 9px;
}

.vcrvi-tooltip.is-compact .vcrvi-tooltip__title {
    margin-bottom: 5px;
    padding-bottom: 5px;
    font-size: 11.5px;
}

.vcrvi-tooltip.is-compact .vcrvi-specification {
    padding: 1px 0;
    font-size: 9.5px;
    line-height: 1.12;
}

.vcrvi-tooltip.is-compact .vcrvi-extras-content {
    font-size: 10px;
    line-height: 1.25;
}

.vcrvi-tooltip.is-compact .vcrvi-extras-content p {
    margin-bottom: 4px;
}

.vcrvi-tooltip.is-compact .vcrvi-extras-content li {
    margin-bottom: 2px;
}

@media (max-width: 390px) {
    .vcrvi-tooltip__panel {
        padding-right: 10px;
        padding-left: 10px;
    }

    .vcrvi-specification {
        grid-template-columns: minmax(74px, 39%) minmax(0, 1fr);
        column-gap: 5px;
        font-size: 10px;
    }

    .vcrvi-extras-content {
        font-size: 10.75px;
    }
}

@media (max-height: 720px) and (min-width: 768px) {
    .vcrvi-tooltip__panel {
        padding: 8px 10px 9px;
    }

    .vcrvi-tooltip__title {
        margin-bottom: 5px;
        padding-bottom: 5px;
        font-size: 11.5px;
    }

    .vcrvi-specification {
        padding: 1px 0;
        font-size: 9.5px;
        line-height: 1.12;
    }

    .vcrvi-extras-content {
        font-size: 10px;
        line-height: 1.25;
    }
}


@media (prefers-reduced-motion: reduce) {
    .vcrvi-trigger,
    .vcrvi-tooltip {
        transition: none;
    }
}


/* ==========================================================
 * INTEGRACIÓN 1.3.8: CAR ID SOBRE LA FOTO Y BARRA DE ACCIONES
 * ========================================================== */
.vcrvi-card-id {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: fit-content;
    max-width: calc(100% - 16px);
    min-height: 20px;
    padding: 2px 7px;
    box-sizing: border-box;
    border-radius: 999px;
    color: #33495f;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 9px;
    line-height: 1;
    white-space: nowrap;
}

/* Ubicación normal: esquina inferior derecha de la fotografía. */
.vcrgc-gallery > .vcrvi-card-id--overlay {
    position: absolute;
    right: 7px;
    bottom: 7px;
    z-index: 5;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.46);
    background: rgba(247, 250, 253, 0.78);
    box-shadow: 0 2px 7px rgba(5, 22, 38, 0.16);
    -webkit-backdrop-filter: blur(4px) saturate(108%);
    backdrop-filter: blur(4px) saturate(108%);
    pointer-events: none;
}

/* Respaldo excepcional para productos sin galería o sin imagen válida. */
.vcrvi-card-id--fallback {
    margin: 0 auto 4px;
    border: 1px solid #dbe5ee;
    background: #f4f7fa;
}

.vcrvi-card-id__label {
    font-size: 8.2px;
    font-weight: 750;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.vcrvi-card-id__value {
    min-width: 0;
    overflow: hidden;
    color: #20384e;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 9.5px;
    font-weight: 780;
    letter-spacing: 0.015em;
    text-overflow: ellipsis;
}

/* El Car ID ya no participa en la barra. Todos los controles de acción se
 * distribuyen de forma uniforme, incluidos Info y Fotos. */
.vcrvi-info-bar--items-4 > .vcrvi-control {
    flex: 1 1 25%;
}

.vcrvi-info-bar--items-3 > .vcrvi-control {
    flex: 1 1 33.333%;
}

.vcrvi-info-bar--items-2 > .vcrvi-control {
    flex: 1 1 50%;
}

.vcrvi-info-bar--items-1 > .vcrvi-control {
    flex: 1 1 100%;
}

.vcrvi-info-bar > .vcrvi-control {
    min-width: 0;
}

.vcrvi-info-bar .vcrvi-control--photos .vcrvi-trigger {
    color: inherit;
    text-decoration: none !important;
}

@media (max-width: 767px) {
    .vcrgc-gallery > .vcrvi-card-id--overlay {
        right: 6px;
        bottom: 6px;
        min-height: 19px;
        padding: 2px 6px;
        font-size: 8.6px;
    }

    .vcrvi-card-id--fallback {
        min-height: 19px;
        margin-bottom: 3px;
        padding: 2px 6px;
        font-size: 8.6px;
    }
}
