/* ----------------------------------------------------------------
 * Mobile header cart + cart drawer
 * ---------------------------------------------------------------- */

.erp-mobile-cart-trigger {
    display: none;
}

@media (max-width: 991.98px) {
    button.erp-mobile-cart-trigger {
        position: relative;
        display: inline-flex;
        flex: 0 0 42px;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
        margin: 0 8px 0 auto;
        padding: 0;
        border: 0;
        border-radius: 8px;
        background: transparent;
        box-shadow: none;
        color: inherit;
        line-height: 1;
        appearance: none;
        cursor: pointer;
    }

    .erp-mobile-cart-trigger + .navbar-toggler {
        margin-left: 0 !important;
    }

    button.erp-mobile-cart-trigger:hover,
    button.erp-mobile-cart-trigger:focus {
        background: rgba(15, 23, 42, 0.06);
        color: inherit;
    }

    button.erp-mobile-cart-trigger:focus-visible {
        outline: 2px solid var(--erp-primary);
        outline-offset: 2px;
    }

    .erp-mobile-cart-trigger__icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 22px;
        height: 22px;
        font-size: 22px;
        line-height: 1;
    }

    .erp-mobile-cart-trigger__icon > svg {
        display: block;
        width: 22px;
        height: 22px;
    }

    .erp-mobile-cart-trigger__badge {
        position: absolute;
        top: 1px;
        right: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 17px;
        height: 17px;
        padding: 0 4px;
        border: 2px solid #fff;
        border-radius: 999px;
        background: var(--erp-primary);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        line-height: 1;
    }

    .erp-mobile-cart-trigger__badge[hidden] {
        display: none !important;
    }
}

body.erp-cart-drawer-open {
    overflow: hidden;
}

.erp-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: var(--erp-z-cart-drawer, 2147483010);
    display: flex;
    justify-content: flex-end;
    font-family: var(--erp-font);
    pointer-events: none;
}

.erp-cart-drawer[hidden] {
    display: none !important;
}

.erp-cart-drawer.is-open {
    pointer-events: auto;
}

.erp-cart-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.erp-cart-drawer__panel {
    position: relative;
    z-index: 1;
    width: min(500px, 100vw);
    height: 100%;
    background: #f8fafc;
    box-shadow: -18px 0 58px rgba(15, 23, 42, 0.22);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.erp-cart-drawer.is-open .erp-cart-drawer__backdrop {
    opacity: 1;
}

.erp-cart-drawer.is-open .erp-cart-drawer__panel {
    transform: translateX(0);
}

/* Header */
.erp-cart-drawer__header {
    padding: 18px 22px 0;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.erp-confirmation__addresses .erp-confirmation__section {
    margin-bottom: 0;
}

.erp-cart-drawer__header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.erp-cart-drawer__tabs {
    display: flex;
    gap: 16px;
    align-items: baseline;
}

.erp-cart-drawer__tab {
    background: none;
    border: none;
    padding: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}

.erp-cart-drawer__tab:hover {
    color: var(--erp-text-muted);
}

.erp-cart-drawer__tab.is-active {
    color: var(--erp-primary);
    border-bottom-color: var(--erp-primary);
}

.erp-cart-drawer__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    margin-left: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--erp-primary);
    border-radius: 10px;
    vertical-align: middle;
}

.erp-cart-drawer__close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--erp-border);
    background: #fff;
    color: var(--erp-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.erp-cart-drawer__close:hover {
    background: #f1f5f9;
    color: var(--erp-text);
}

/* Auth row */
.erp-cart-drawer__auth {
    padding: 12px 0 14px;
    border-top: 1px solid #f1f5f9;
}

.erp-cart-drawer__auth-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.erp-cart-drawer__auth-icon {
    color: #94a3b8;
    flex-shrink: 0;
}

.erp-cart-drawer__auth-user {
    font-size: 13px;
    color: var(--erp-text-muted);
    font-weight: 500;
}

.erp-cart-drawer__auth-toggle {
    margin-left: auto;
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--erp-primary);
    cursor: pointer;
}

.erp-cart-drawer__auth-toggle:hover {
    text-decoration: underline;
}

.erp-cart-drawer__auth-link {
    margin-left: auto;
    border: 0;
    background: transparent;
    padding: 0;
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    text-decoration: none;
}

.erp-cart-drawer__auth-link:hover,
.erp-cart-drawer__auth-link:focus-visible {
    color: var(--erp-text);
    text-decoration: underline;
}

.erp-cart-drawer__auth-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
    margin-top: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: var(--erp-radius);
    background: #f8fafc;
}

.erp-cart-drawer__auth-form[hidden] {
    display: none;
}

.erp-cart-drawer__auth-toggle[hidden],
.erp-cart-drawer__auth-link[hidden] {
    display: none;
}

.erp-cart-drawer__auth-input {
    width: 100%;
    border: 1px solid var(--erp-border);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    color: var(--erp-text);
    background: #f8fafc;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.erp-cart-drawer__auth-input:focus {
    outline: none;
    border-color: var(--erp-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: #fff;
}

.erp-cart-drawer__auth-button {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

/* Content area */
.erp-cart-drawer__content {
    flex: 1;
    overflow-y: auto;
    padding: 18px 22px;
    background: #f8fafc;
}

.erp-cart-drawer__section {
    display: none;
}

.erp-cart-drawer__section.is-active {
    display: block;
}

/* Shipping progress */
.erp-cart-drawer__shipping {
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #fff;
    border-radius: var(--erp-radius);
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.erp-cart-drawer__shipping-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.erp-cart-drawer__shipping-icon {
    color: var(--erp-text-muted);
    flex-shrink: 0;
}

.erp-cart-drawer__shipping-text {
    margin: 0;
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
}

.erp-cart-drawer__shipping-bar {
    height: 4px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.erp-cart-drawer__shipping-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--erp-primary), #34d399);
    transition: width 0.4s ease;
}

/* States */
.erp-cart-drawer__state {
    padding: 32px 0;
    color: #94a3b8;
    text-align: center;
    font-size: 14px;
}

.erp-cart-drawer__state svg {
    display: block;
    margin: 0 auto 12px;
}

.erp-cart-drawer__state--warning {
    text-align: left;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
}

/* Cart items */
.erp-cart-drawer__items,
.erp-cart-drawer__recent {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.erp-cart-drawer__item,
.erp-cart-drawer__recent-card {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: var(--erp-radius);
    background: #fff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.erp-cart-drawer__item.is-purchase-blocked {
    border-color: rgba(245, 158, 11, 0.28);
    background: #fffdf8;
    box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.42), 0 10px 24px rgba(15, 23, 42, 0.04);
}

.erp-cart-drawer__item:first-child,
.erp-cart-drawer__recent-card:first-child {
    padding-top: 14px;
}

.erp-cart-drawer__item:last-child,
.erp-cart-drawer__recent-card:last-child {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 14px;
}

.erp-cart-drawer__item-image,
.erp-cart-drawer__recent-image {
    display: block;
    width: 78px;
    height: 78px;
    border-radius: var(--erp-radius);
    background: #fff;
    border: 1px solid #f1f5f9;
    overflow: hidden;
}

.erp-cart-drawer__item-image img,
.erp-cart-drawer__recent-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.erp-cart-drawer__item-placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
}

.erp-cart-drawer__item-title,
.erp-cart-drawer__recent-title {
    display: block;
    color: var(--erp-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 2px;
}

.erp-cart-drawer__item-title:hover,
.erp-cart-drawer__recent-title:hover {
    color: var(--erp-primary);
}

.erp-cart-drawer__item-price,
.erp-cart-drawer__recent-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--erp-text);
    margin-bottom: 8px;
}

.erp-cart-drawer__item-meta,
.erp-cart-drawer__recent-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.erp-cart-drawer__item-qty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--erp-text-muted);
}

.erp-cart-drawer__item-qty .erp-qty {
    background: #fff;
}

.erp-cart-drawer__item-remove {
    color: #94a3b8;
    font-size: 12px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
}

.erp-cart-drawer__item-remove:hover {
    color: #ef4444;
}

/* Footer */
.erp-cart-drawer__footer {
    padding: 18px 22px;
    border-top: 1px solid #e2e8f0;
    border-bottom: 0;
    background: #fff;
    flex-shrink: 0;
}

.erp-cart-drawer__summary {
    margin-bottom: 14px;
}

.erp-cart-drawer__summary-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 5px 0;
}

.erp-cart-drawer__summary-row--total {
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
}

.erp-cart-drawer__summary-label {
    font-size: 13px;
    color: var(--erp-text-muted);
}

.erp-cart-drawer__summary-row--total .erp-cart-drawer__summary-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--erp-text);
}

.erp-cart-drawer__summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--erp-text);
}

.erp-cart-drawer__summary-row--total .erp-cart-drawer__summary-value {
    font-size: 18px;
    font-weight: 700;
}

.erp-cart-drawer__actions {
    display: flex;
    flex-direction: column;
}

#erp-cart-drawer-checkout {
    display: flex;
    justify-content: center;
    width: 100%;
    text-align: center;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 20px;
}

@media (max-width: 640px) {

    .erp-cart-drawer__panel {
        width: 100vw;
    }

    .erp-cart-drawer__header {
        padding: 14px 16px 0;
    }

    .erp-cart-drawer__content {
        padding: 14px 16px;
    }

    .erp-cart-drawer__footer {
        padding: 14px 16px;
    }

    .erp-cart-drawer__tab {
        font-size: 14px;
    }

    .erp-cart-drawer__auth-form {
        grid-template-columns: 1fr;
    }

    .erp-cart-drawer__item,
    .erp-cart-drawer__recent-card {
        grid-template-columns: 60px 1fr;
    }

    .erp-cart-drawer__item-image,
    .erp-cart-drawer__recent-image {
        width: 60px;
        height: 60px;
    }
}
#erp-cart-drawer-rounding-row[hidden] { display: none !important; }
