/* ============================================================
   CART DRAWER
   ============================================================ */

.cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 2000;

    visibility: hidden;
}

.cart-drawer.open {
    visibility: visible;
}


/* ============================================================
   OVERLAY
   ============================================================ */

.cart-overlay {
    position: absolute;
    inset: 0;

    background: rgba(9, 14, 26, 0.55);

    opacity: 0;

    transition: opacity 0.35s ease;

    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.cart-drawer.open .cart-overlay {
    opacity: 1;
}


/* ============================================================
   PANEL
   ============================================================ */

.cart-content {
    position: absolute;

    top: 0;
    right: 0;

    width: min(440px, 100%);
    height: 100dvh;

    background: var(--white);

    display: flex;
    flex-direction: column;

    transform: translateX(100%);

    transition:
        transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    box-shadow:
        -10px 0 35px rgba(17, 34, 80, 0.12);

    border-left: 1px solid var(--gray-200);
}

.cart-drawer.open .cart-content {
    transform: translateX(0);
}


/* ============================================================
   HEADER
   ============================================================ */

.cart-header {
    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 20px 24px;

    background: var(--white);

    border-bottom: 1px solid var(--gray-200);
}

.cart-header h3 {
    margin: 0;

    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;

    color: var(--royal-blue);
}


/* ============================================================
   CLOSE
   ============================================================ */

.cart-close {
    width: 40px;
    height: 40px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--gray-200);
    border-radius: 50%;

    background: var(--white);

    color: var(--text-dark);
    font-size: 1.2rem;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.25s ease;
}

.cart-close:hover {
    background: var(--gray-100);
    color: var(--royal-blue);

    border-color: var(--sapphire);

    transform: rotate(90deg);
}


/* ============================================================
   PRODUCT LIST
   ============================================================ */

.cart-items {
    flex: 1;
    min-height: 0;

    overflow-y: auto;

    padding: 20px 24px;

    scrollbar-width: thin;
    scrollbar-color:
        var(--gray-200) transparent;
}

.cart-items::-webkit-scrollbar {
    width: 5px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 10px;
}


/* ============================================================
   EMPTY CART
   ============================================================ */

.cart-empty-state {
    height: 100%;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    padding: 40px 20px;

    text-align: center;

    color: var(--text-muted);
}

.cart-empty-state i {
    margin-bottom: 12px;

    font-size: 2.8rem;

    color: var(--gray-200);
}


/* ============================================================
   CART ITEM
   ============================================================ */

.cart-item {
    display: flex;
    align-items: flex-start;

    width: 100%;

    gap: 14px;

    padding-bottom: 16px;
    margin-bottom: 16px;

    border-bottom: 1px solid var(--gray-100);
}

/* ============================================================
   SELECCIÓN DE ÍTEMS
   ============================================================ */

.cart-item-selection {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.cart-item-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    margin: 0;
    border: 1.5px solid var(--royal-blue);
    border-radius: 4px;
    background: var(--white);
    cursor: pointer;
    display: grid;
    place-content: center;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.15s ease;
}

.cart-item-checkbox::before {
    content: "";
    width: 8px;
    height: 8px;
    transform: scale(0);
    background: var(--white);
    clip-path: polygon(14% 44%,
            0 59%,
            39% 100%,
            100% 16%,
            84% 0,
            36% 68%);
    transition: transform 0.15s ease;
}

.cart-item-checkbox:checked {
    background: var(--royal-blue);
    border-color: var(--royal-blue);
}

.cart-item-checkbox:checked::before {
    transform: scale(1);
}

.cart-item-checkbox:hover {
    border-color: var(--sapphire);
    box-shadow:
        0 0 0 3px rgba(0, 98, 168, 0.08);
}

.cart-item-checkbox:focus-visible {
    outline: 2px solid var(--sapphire);
    outline-offset: 2px;
}


/* ============================================================
   SELECCIONAR TODO
   ============================================================ */

.cart-selection-toolbar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.cart-select-all {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-family: var(--font-primary);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.cart-select-all-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    margin: 0;
    border: 1.5px solid var(--royal-blue);
    border-radius: 4px;
    background: var(--white);
    cursor: pointer;
    display: grid;
    place-content: center;
    transition:
        background-color 0.2s ease,
        border-color 0.2s ease,
        box-shadow 0.2s ease;
    pointer-events: none;
}

.cart-select-all-checkbox::before {
    content: "";
    width: 8px;
    height: 8px;
    transform: scale(0);
    background: var(--white);
    clip-path: polygon(14% 44%,
            0 59%,
            39% 100%,
            100% 16%,
            84% 0,
            36% 68%);
    transition: transform 0.15s ease;
}

.cart-select-all.is-selected .cart-select-all-checkbox {
    background: var(--royal-blue);
    border-color: var(--royal-blue);
}

.cart-select-all.is-selected .cart-select-all-checkbox::before {
    transform: scale(1);
}

.cart-select-all-label {
    line-height: 17px;
}

.cart-select-all:hover {
    color: var(--royal-blue);
}

.cart-select-all:hover .cart-select-all-checkbox {
    border-color: var(--sapphire);
    box-shadow:
        0 0 0 3px rgba(0, 98, 168, 0.08);
}

.cart-select-all:focus-visible {
    outline: 2px solid var(--sapphire);
    outline-offset: 3px;
    border-radius: 4px;
}


/* ============================================================
   PRODUCT IMAGE
   ============================================================ */

.cart-item-img {
    flex: 0 0 64px;

    width: 64px !important;
    height: 86px !important;

    max-width: 64px !important;
    max-height: 86px !important;

    object-fit: contain;

    background: transparent;
}


/* ============================================================
   PRODUCT INFORMATION
   ============================================================ */

.cart-item-info {
    flex: 1;
    min-width: 0;
}


/* ============================================================
   TITLE + PRICE
   ============================================================ */

.cart-item-top {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
}

.cart-item-title {
    min-width: 0;
    margin: 0;
    font-family: var(--font-primary);
    font-size: .85rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-dark);
}


/* ============================================================
   PRICES
   ============================================================ */

.cart-item-prices {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.cart-item-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    margin-top: 3px;
}

.cart-item-price-old {
    font-size: 0.68rem;
    font-weight: 500;

    color: var(--text-muted);

    text-decoration: line-through;

    opacity: 0.65;
}

.cart-item-price {
    font-size: 0.82rem;
    font-weight: 700;

    color: var(--royal-blue);
}


/* ============================================================
   ATTRIBUTES
   ============================================================ */

.cart-item-attributes {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
}

.cart-item-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    font-size: .7rem;
    line-height: 1.35;
    color: var(--text-muted);
}

.cart-item-attribute-name {
    color: var(--text-dark);
    font-weight: 500;
}

.cart-item-attribute-value {
    color: var(--text-muted);
}


/* ============================================================
   COLOR
   ============================================================ */

.cart-item-color {
    gap: 5px;
}

.cart-color-dot {
    width: 9px;
    height: 9px;

    flex: 0 0 9px;

    border-radius: 50%;

    border: 1px solid rgba(0, 0, 0, 0.15);
}


/* ============================================================
   QUANTITY + REMOVE
   ============================================================ */

.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    margin: 0;
}


/* ============================================================
   QUANTITY SELECTOR
   ============================================================ */

.cart-item-qty {
    display: inline-flex;
    align-items: center;

    height: 28px;

    overflow: hidden;

    border: 1px solid var(--gray-200);
    border-radius: 6px;

    background: var(--white);
}

.cart-item-qty button {
    width: 28px;
    height: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: none;
    background: transparent;

    color: var(--royal-blue);

    font-size: 0.6rem;

    cursor: pointer;

    transition:
        background-color 0.2s ease,
        color 0.2s ease;
}

.cart-item-qty button:hover {
    background: var(--gray-100);
    color: var(--sapphire);
}

.cart-item-qty span {
    min-width: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 0.72rem;
    font-weight: 700;

    color: var(--text-dark);
}


/* ============================================================
   REMOVE
   ============================================================ */

.cart-item-remove {
    padding: 0;

    border: none;
    background: transparent;

    font-size: 0.65rem;
    font-weight: 500;

    color: var(--text-muted);

    cursor: pointer;

    transition: color 0.2s ease;
}

.cart-item-remove:hover {
    color: #dc2626;
}


/* ============================================================
   FOOTER
   ============================================================ */

.cart-footer {
    flex-shrink: 0;

    padding: 20px 24px 24px;

    background: var(--white);

    border-top: 1px solid var(--gray-200);

    box-shadow:
        0 -4px 15px rgba(17, 34, 80, 0.04);
}


/* ============================================================
   SUBTOTAL
   ============================================================ */

.cart-totals {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 8px;

    font-family: var(--font-heading);

    font-size: 0.9rem;
    font-weight: 500;

    color: var(--text-muted);
}

.cart-totals>span:first-child {
    color: var(--text-muted);
}

#cartSubtotal {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;

    gap: 8px;
}

.cart-subtotal-old {
    font-size: 0.85rem;
    font-weight: 500;

    color: var(--text-muted);

    text-decoration: line-through;

    opacity: 0.65;
}

.cart-subtotal-current {
    font-size: 1.2rem;
    font-weight: 700;

    color: var(--royal-blue);
}


/* ============================================================
   NOTE
   ============================================================ */

.cart-note {
    margin: 0 0 16px;

    font-size: 0.72rem;
    line-height: 1.45;

    color: var(--text-muted);
}


/* ============================================================
   CHECKOUT
   ============================================================ */

#checkoutBtn {
    width: 100%;
    min-height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    background: var(--royal-blue);

    border: 1px solid var(--royal-blue);
    border-radius: 3px;

    color: var(--white);

    font-size: 0.82rem;
    font-weight: 700;

    letter-spacing: 0.08em;
    text-transform: uppercase;

    cursor: pointer;

    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        transform 0.2s ease,
        box-shadow 0.25s ease;
}

#checkoutBtn:hover:not(:disabled) {
    background: var(--sapphire);
    border-color: var(--sapphire);

    transform: translateY(-1px);

    box-shadow:
        0 6px 16px rgba(17, 34, 80, 0.16);
}

#checkoutBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 480px) {

    .cart-content {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
    }

    .cart-header {
        padding: 16px 20px;
    }

    .cart-header h3 {
        font-size: 1rem;
    }

    .cart-close {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    .cart-items {
        padding: 16px 18px;
    }

    .cart-footer {
        padding: 16px 18px 20px;
    }


    /* --------------------------------------------------------
       ITEM
       -------------------------------------------------------- */

    .cart-item {
        gap: 11px;

        padding-bottom: 14px;
        margin-bottom: 14px;
    }

    .cart-item-img {
        flex: 0 0 60px;

        width: 60px !important;
        height: 80px !important;

        max-width: 60px !important;
        max-height: 80px !important;
    }

    .cart-item-selection {
        flex-basis: 17px;
        width: 17px;
    }

    .cart-item-checkbox {
        width: 15px;
        height: 15px;
    }


    /* --------------------------------------------------------
       TITLE + PRICE
       -------------------------------------------------------- */

    .cart-item-top {
        gap: 7px;
    }

    .cart-item-title {
        font-size: 0.78rem;
    }

    .cart-item-price-old {
        font-size: 0.6rem;
    }

    .cart-item-price {
        font-size: 0.75rem;
    }


    /* --------------------------------------------------------
       ATTRIBUTES
       -------------------------------------------------------- */

    .cart-item-attributes {
        margin-top: 5px;
        gap: 2px;
    }

    .cart-item-meta {
        font-size: 0.66rem;
    }


    /* --------------------------------------------------------
       CONTROLS
       -------------------------------------------------------- */

    .cart-item-controls {
        margin-top: 8px;
        gap: 4px;
    }


    /* --------------------------------------------------------
       QUANTITY
       -------------------------------------------------------- */

    .cart-item-qty {
        height: 27px;
    }

    .cart-item-qty button {
        width: 27px;
        height: 27px;
    }

    .cart-item-qty span {
        min-width: 27px;
    }


    /* --------------------------------------------------------
       REMOVE
       -------------------------------------------------------- */

    .cart-item-remove {
        font-size: 0.63rem;
    }


    /* --------------------------------------------------------
       SUBTOTAL
       -------------------------------------------------------- */

    .cart-totals {
        font-size: 0.85rem;
    }

    .cart-subtotal-old {
        font-size: 0.75rem;
    }

    .cart-subtotal-current {
        font-size: 1.05rem;
    }


    /* --------------------------------------------------------
       NOTE
       -------------------------------------------------------- */

    .cart-note {
        font-size: 0.65rem;
        margin-bottom: 12px;
    }


    /* --------------------------------------------------------
       CHECKOUT
       -------------------------------------------------------- */

    #checkoutBtn {
        min-height: 44px;
        font-size: 0.72rem;
    }
}
.cart-drawer-status {
    margin: .75rem 0;
    padding: .65rem .75rem;
    border: 1px solid #dcc99e;
    border-radius: .5rem;
    background: #fffaf0;
    color: #152349;
}

.cart-drawer-status:empty {
    display: none;
}
