/* ===== CART DRAWER ===== */

/* --- Nav Cart Badge --- */
.nav-cart-count {
    background: var(--accent-active);
    color: #1e1e1e;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.nav-cart-count.has-items { display: flex; }

/* --- Overlay --- */
.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.cart-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- Drawer Panel --- */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    height: 100%;
    background: var(--bg-main);
    border-left: 1px solid var(--border-subtle);
    z-index: 1060;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
.cart-drawer.open {
    transform: translateX(0);
}

/* --- Header --- */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.cart-drawer-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}
.cart-drawer-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}
.cart-drawer-close:hover {
    color: var(--text-primary);
}

/* --- Body (scrollable items) --- */
.cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
}

/* --- Empty State --- */
.cart-drawer-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 60px 0;
    color: var(--text-secondary);
}
.cart-drawer-empty i {
    font-size: 40px;
    opacity: 0.4;
}
.cart-drawer-empty p {
    font-size: 14px;
    font-weight: 500;
}

/* --- Item Row --- */
.cart-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: opacity 0.3s ease;
}
.cart-drawer-item:last-child {
    border-bottom: none;
}
.cart-drawer-item.removing {
    opacity: 0;
}

.cart-drawer-item-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.cart-drawer-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-drawer-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.cart-drawer-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cart-drawer-item-price {
    font-size: 12px;
    color: var(--accent-passive);
    font-weight: 600;
}

.cart-drawer-item-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    padding: 6px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}
.cart-drawer-item-remove:hover {
    color: var(--accent-warn, #d97755);
}

/* --- Footer --- */
.cart-drawer-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.cart-drawer-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.cart-drawer-checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: var(--accent-active);
    color: #1e1e1e;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none;
}
.cart-drawer-checkout:hover {
    opacity: 0.9;
}

.cart-drawer-continue {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: none;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.cart-drawer-continue:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

/* --- Responsive --- */
@media (max-width: 480px) {
    .cart-drawer {
        width: 100%;
    }
}
