/* ==========================================================================
   Checkout Pro · panel lateral del carrito
   1. Capa y panel   2. Cabecera y barra de envío gratis   3. Líneas
   4. Recomendados   5. Pie   6. Vacío y avisos   7. Móvil y movimiento
   ========================================================================== */

/* 1. Capa y panel */
.ckp-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s ease, visibility .25s;
}

.ckp-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    width: var(--ckp-drawer-width);
    max-width: 100%;
    background: var(--ckp-surface);
    color: var(--ckp-text);
    font-size: 15px;
    line-height: 1.4;
    box-shadow: -8px 0 32px rgba(0, 0, 0, .12);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility .3s;
    outline: none;
}

body.ckp-open {
    overflow: hidden;
}

body.ckp-open .ckp-overlay {
    opacity: 1;
    visibility: visible;
}

body.ckp-open .ckp-drawer {
    transform: none;
    visibility: visible;
}

.ckp-drawer.is-loading .ckp-body,
.ckp-drawer.is-loading .ckp-foot {
    opacity: .55;
    pointer-events: none;
}

/* 2. Cabecera y barra de envío gratis */
.ckp-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px var(--ckp-pad) 10px;
}

.ckp-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* En la misma fila que el título, como en Shopify; si no cabe (p. ej. el nombre de un
   regalo), dos líneas antes que cortar el texto */
.ckp-freeship-text {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    line-height: 1.3;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ckp-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: -8px -10px -8px auto;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ckp-text);
    cursor: pointer;
}

.ckp-close:hover {
    background: var(--ckp-ground);
}

.ckp-bar {
    position: relative;
    height: 6px;
    margin: 8px var(--ckp-pad) 12px;
    border-radius: 999px;
    background: var(--ckp-line);
}

.ckp-bar-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--ckp-primary);
    transition: width .5s cubic-bezier(.2, .8, .2, 1);
}

/* Iconos de objetivo (envío gratis, regalo, descuento), fijos en su importe:
   vacíos hasta alcanzarlos y en el color de «conseguido» después */
.ckp-bar-icon {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: -11px;
    border: 2px solid var(--ckp-line-strong);
    border-radius: 50%;
    background: var(--ckp-surface);
    color: var(--ckp-muted);
    transform: translateY(-50%);
    transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}

.ckp-bar-icon.is-reached {
    border-color: var(--ckp-reached);
    background: var(--ckp-reached);
    color: #fff;
}

/* Provincia para calcular el envío gratis (sin dirección) */
.ckp-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 var(--ckp-pad) 8px;
    font-size: 13px;
}

.ckp-zone-from {
    flex-shrink: 0;
    color: var(--ckp-muted);
    text-align: right;
    white-space: nowrap;
}

/* El texto ya está junto al título: aquí solo para lectores de pantalla */
.ckp-zone-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.ckp-zone-select {
    flex: 0 1 190px;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    padding-right: 32px;
    border: 1px solid var(--ckp-line-strong);
    border-radius: var(--ckp-radius);
    /* Una sola flecha, propia: la del navegador y la del tema se montaban */
    -webkit-appearance: none;
    appearance: none;
    background: var(--ckp-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--ckp-text);
    font-size: 14px;
}

/* 3. Líneas */
.ckp-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ckp-body > * {
    flex-shrink: 0;
}

.ckp-lines {
    margin: 0;
    padding: 0 var(--ckp-pad);
    list-style: none;
}

.ckp-line {
    display: grid;
    grid-template-columns: 76px 1fr auto;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--ckp-line);
}

.ckp-line-img img {
    display: block;
    width: 76px;
    height: 76px;
    object-fit: contain;
    border-radius: var(--ckp-radius);
    background: var(--ckp-ground);
}

.ckp-line-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.ckp-line-name {
    color: var(--ckp-text);
    font-weight: 600;
    text-decoration: none;
}

.ckp-line-name:hover {
    text-decoration: underline;
}

.ckp-line-attr {
    font-size: 13px;
    color: var(--ckp-muted);
}

.ckp-line-info .ckp-link {
    margin-top: 6px;
    font-size: 13px;
    color: var(--ckp-muted);
}

.ckp-line-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

.ckp-line-price {
    font-weight: 700;
    white-space: nowrap;
}

.ckp-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--ckp-line-strong);
    border-radius: 999px;
}

.ckp-qty button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--ckp-text);
    cursor: pointer;
}

.ckp-qty button:hover {
    background: var(--ckp-ground);
}

.ckp-qty-value {
    min-width: 20px;
    text-align: center;
    font-weight: 600;
}

/* 4. Recomendados */
.ckp-hooks {
    padding: 16px var(--ckp-pad);
}

/* Lo que pintan otros módulos suele venir en tarjetas de Bootstrap con su propio relleno */
.ckp-hooks .card-block,
.ckp-hooks .card-body {
    padding: 0;
}

.ckp-hooks :is(.card-block, .card-body) > :first-child {
    margin-top: 0;
}

.ckp-hooks :is(.card-block, .card-body) > :last-child {
    margin-bottom: 0;
}

/* Pegado abajo, encima del subtotal, como en Shopify; el hueco libre queda arriba */
.ckp-reco {
    margin-top: auto;
    padding: 12px 0 16px;
    background: var(--ckp-ground);
}

.ckp-reco summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px var(--ckp-pad) 10px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    cursor: pointer;
    list-style: none;
}

.ckp-reco summary::-webkit-details-marker {
    display: none;
}

.ckp-reco summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform .2s ease;
}

.ckp-reco[open] summary::after {
    transform: rotate(-135deg);
}

.ckp-reco-track {
    display: flex;
    gap: 8px;
    padding: 0 var(--ckp-pad);
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scroll-padding: 0 var(--ckp-pad);
    scrollbar-width: none;
}

.ckp-reco-track::-webkit-scrollbar {
    display: none;
}

/* Medidas de la tarjeta de Allbirds: asoma la siguiente, borde fino, foto 80 px */
.ckp-card {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    flex: 0 0 80%;
    min-height: 100px;
    padding: 10px;
    border: 1px solid var(--ckp-line);
    border-radius: 10px;
    background: var(--ckp-surface);
    scroll-snap-align: start;
}

.ckp-card-img img {
    display: block;
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.ckp-card-info {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr;
    column-gap: 10px;
    min-width: 0;
}

.ckp-card-name {
    color: var(--ckp-muted);
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ckp-card-name:hover {
    color: var(--ckp-text);
}

.ckp-card-price {
    color: var(--ckp-text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.ckp-card-add.ckp-link {
    grid-column: 1 / -1;
    align-self: end;
    justify-self: end;
    min-height: 34px;
    color: var(--ckp-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.ckp-card-add.ckp-link:hover {
    text-decoration: underline;
}

/* Flechas del carrusel (las pone checkoutpro.js si hay más de una tarjeta) */
.ckp-reco-nav {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px var(--ckp-pad) 0;
}

.ckp-reco-nav button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid var(--ckp-text);
    border-radius: 50%;
    background: none;
    color: var(--ckp-text);
    cursor: pointer;
}

.ckp-reco-nav button:disabled {
    border-color: var(--ckp-line-strong);
    color: var(--ckp-line-strong);
    cursor: default;
}

/* 5. Pie */
.ckp-foot {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px var(--ckp-pad) calc(14px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ckp-line);
    background: var(--ckp-surface);
}

.ckp-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.ckp-row--strong {
    font-size: 17px;
    font-weight: 700;
}

.ckp-insurance {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: start;
    margin: 4px 0;
    font-weight: 400;
    cursor: pointer;
}

.ckp-insurance small {
    display: block;
    color: var(--ckp-muted);
}

.ckp-foot .ckp-btn--primary {
    margin-top: 4px;
}

.ckp-express:empty {
    display: none;
}

/* 6. Vacío y avisos */
.ckp-empty {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 40px var(--ckp-pad) 24px;
}

.ckp-empty p {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

.ckp-notice {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin: 8px var(--ckp-pad) 0;
    padding: 10px 14px;
    border-radius: var(--ckp-radius);
    background: var(--ckp-ground);
    font-size: 14px;
}

.ckp-notice[hidden] {
    display: none;
}

/* 7. Móvil y movimiento */
@media (max-width: 575.98px) {
    .ckp-drawer {
        width: 100%;
    }

    .ckp-freeship-text {
        font-size: 12px;
    }

}

@media (prefers-reduced-motion: reduce) {
    .ckp-overlay,
    .ckp-drawer,
    .ckp-bar-fill,
    .ckp-bar-icon,
    .ckp-reco summary::after {
        transition: none;
    }
}
