/*
 * Casa Marcus - Header Popups
 * Version 0.1.0
 * Colores: #252666 / #ffb700
 */

/* Contenedor principal del carrito */
#desk_cart-wrapper .block-minicart {
    background: #ffffff;
    border: 1px solid #e8eaf0;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(20, 24, 65, 0.18);
    overflow: hidden;
}

/* Encabezado */
#desk_cart-wrapper .block-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 16px 18px;
    background: #252666;
    color: #ffffff;
}

#desk_cart-wrapper .block-title .text {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
}

#desk_cart-wrapper .block-title .items-total {
    padding: 4px 9px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 12px;
}

/* Evitar duplicar el enlace del carrito */
#desk_cart-wrapper .block-title .action.viewcart {
    display: none;
}

/* Contenido */
#desk_cart-wrapper .block-content {
    padding: 16px 18px 20px;
}

#desk_cart-wrapper .minicart-items .product-item {
    padding: 14px 0;
    border-bottom: 1px solid #edf0f4;
}

#desk_cart-wrapper .product-item-photo img {
    border-radius: 8px;
    object-fit: contain;
}

#desk_cart-wrapper .product-item-name,
#desk_cart-wrapper .product-item-name a {
    color: #252666;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

/* Resumen */
#desk_cart-wrapper .cart-total {
    margin-top: 14px;
    padding-top: 16px;
    border-top: 1px solid #e8eaf0;
}

/* Boton principal */
#desk_cart-wrapper #top-cart-btn-checkout {
    width: 100%;
    min-height: 44px;
    border: 1px solid #ffb700;
    border-radius: 9px;
    background: #ffb700;
    color: #252666;
    font-weight: 700;
}

/* Boton secundario */
#desk_cart-wrapper .cart-total .action.button.secondary {
    display: block;
    width: 100%;
    min-height: 42px;
    border: 1px solid #252666;
    border-radius: 9px;
    background: #ffffff;
    color: #252666;
    text-align: center;
    font-weight: 600;
}

/* Estados interactivos */
#desk_cart-wrapper #top-cart-btn-checkout:hover {
    background: #e5a600;
    border-color: #e5a600;
}

#desk_cart-wrapper .cart-total .action.button.secondary:hover {
    background: #f3f3fa;
}

/* CM Popup Desktop Width v0.2 */

@media (min-width: 769px) {

    #desk_cart-wrapper .cdz-dd-content {
        width: 420px !important;
        max-width: calc(100vw - 24px) !important;
        box-sizing: border-box;
    }

    #desk_cart-wrapper .cdz-dd-content-inner,
    #desk_cart-wrapper .block-minicart {
        width: 100% !important;
        box-sizing: border-box;
    }

    #desk_cart-wrapper .minicart-items .product-item {
        width: 100%;
        box-sizing: border-box;
    }

}

/* CM Popup Product Layout v0.3 */

@media (min-width: 769px) {

    /* Distribucion principal del producto */
    #desk_cart-wrapper .minicart-items .product-item > .product.row {
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 0;
    }

    /* Fotografia */
    #desk_cart-wrapper .minicart-items .product-item-left {
        flex: 0 0 88px;
        width: 88px;
        max-width: 88px;
        padding: 0;
        float: none;
    }

    #desk_cart-wrapper .minicart-items .product-item-photo img {
        width: 88px;
        height: 88px;
        object-fit: contain;
    }

    /* Informacion del producto */
    #desk_cart-wrapper .minicart-items .product-item-details {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 0;
        float: none;
    }

    #desk_cart-wrapper .minicart-items .product-item-details > .row {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        margin: 0;
    }

    /* Nombre del producto */
    #desk_cart-wrapper .minicart-items .product-info {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        padding: 0;
        float: none;
    }

    #desk_cart-wrapper .minicart-items .product-item-name {
        display: block;
        overflow-wrap: break-word;
        line-height: 1.45;
    }

    /* Precio y cantidad */
    #desk_cart-wrapper .minicart-items .product-item-actions {
        flex: 0 0 90px;
        width: 90px;
        max-width: 90px;
        padding: 0;
        float: none;
    }

}

/* CM Popup Product Details v0.4 */

@media (min-width: 769px) {

    /* Nombre y acciones en filas independientes */
    #desk_cart-wrapper .minicart-items .product-item-details > .row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    #desk_cart-wrapper .minicart-items .product-info,
    #desk_cart-wrapper .minicart-items .product-item-actions {
        flex: none;
        width: 100%;
        max-width: none;
    }

    /* Nombre con todo el espacio disponible */
    #desk_cart-wrapper .minicart-items .product-item-name {
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    /* Precio y cantidad */
    #desk_cart-wrapper .minicart-items .product-item-pricing {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 12px;
    }

    #desk_cart-wrapper .minicart-items .details-qty {
        margin: 0;
    }

}

/* CM Popup Item Actions v0.5 */

@media (min-width: 769px) {

    #desk_cart-wrapper .minicart-items .product-item-left {
        display: grid !important;
        grid-template-columns: 28px 28px;
        grid-template-rows: 88px 28px;
        justify-content: center;
        justify-items: center;
        align-content: start;
        gap: 6px;
    }

    #desk_cart-wrapper .minicart-items
    .product-item-left > .product-item-photo {
        grid-column: 1 / -1;
        grid-row: 1;
        position: static !important;
        display: block !important;
        width: 88px !important;
        height: 88px !important;
        margin: 0 !important;
    }

    #desk_cart-wrapper .minicart-items
    .product-item-left > .action.delete,
    #desk_cart-wrapper .minicart-items
    .product-item-left > .action.edit {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none !important;
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 28px !important;
        height: 28px !important;
        padding: 0 !important;
        margin: 0 !important;
        background: #252666;
        color: #ffffff;
        border-radius: 5px;
    }

    #desk_cart-wrapper .minicart-items
    .product-item-left > .action.delete {
        grid-column: 1;
        grid-row: 2;
    }

    #desk_cart-wrapper .minicart-items
    .product-item-left > .action.edit {
        grid-column: 2;
        grid-row: 2;
    }

}

/* CM Popup Close Button v0.6 */

@media (min-width: 769px) {

    /* Referencia para posicionar el cierre */
    #desk_cart-wrapper .block-minicart {
        position: relative;
    }

    /* Reservar espacio para la X */
    #desk_cart-wrapper .block-title {
        padding-right: 58px;
    }

    /* Reutilizar el cierre original de Codazon */
    #desk_cart-wrapper #btn-minicart-close {
        display: flex !important;
        position: absolute !important;
        top: 11px !important;
        right: 12px !important;
        left: auto !important;
        z-index: 30;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        min-width: 34px;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 6px;
        background: transparent !important;
        color: #ffffff !important;
        opacity: 1 !important;
        visibility: visible !important;
        cursor: pointer;
    }

    #desk_cart-wrapper #btn-minicart-close span {
        font-size: 0 !important;
    }

    #desk_cart-wrapper #btn-minicart-close::before {
        content: "\00d7";
        font-family: Arial, sans-serif !important;
        font-size: 27px !important;
        font-weight: 400;
        line-height: 1;
        color: #ffffff !important;
    }

    #desk_cart-wrapper #btn-minicart-close:hover {
        background: rgba(255, 255, 255, 0.15) !important;
    }

    #desk_cart-wrapper #btn-minicart-close:focus-visible {
        outline: 2px solid #ffb700;
        outline-offset: 2px;
    }

}
