/**
 * Cart Drawer Styles - Redesigned
 */

/* Drawer Container */
.cart-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    visibility: hidden;
    pointer-events: none;
}

.cart-drawer.open {
    visibility: visible;
    pointer-events: auto;
}

/* Backdrop */
.cart-drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-drawer.open .cart-drawer-backdrop {
    opacity: 1;
}

/* Drawer Content */
.cart-drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 460px;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}

.cart-drawer.open .cart-drawer-content {
    transform: translateX(0);
}

/* Header */
.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e5e5;
    flex-shrink: 0;
}

.cart-drawer-header h3 {
    font-family: 'Inter', 'Maison Neue Book', Arial, sans-serif;
    font-size: 18px;
    font-weight: 500;
    margin: 0;
    color: #000;
    letter-spacing: -0.01em;
}

.cart-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #000;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-drawer-close:hover {
    opacity: 0.6;
}

/* Items Container */
.cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Empty State */
.cart-drawer-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cart-drawer-empty p {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    margin: 0;
    color: #000;
}

/* Cart Item */
.cart-drawer-item {
    display: flex;
    gap: 20px;
    padding: 24px 28px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
    transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.3s ease, padding 0.3s ease;
    max-height: 300px;
    overflow: hidden;
}

.cart-drawer-item:last-child {
    border-bottom: 1px solid #f0f0f0;
}

/* Remove animation */
.cart-drawer-item.removing {
    opacity: 0;
    transform: translateX(30px);
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Item Image */
.drawer-item-image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    background: #f8f8f8;
    overflow: hidden;
}

.drawer-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.drawer-item-image a {
    display: block;
    width: 100%;
    height: 100%;
}

/* Item Details */
.drawer-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.drawer-item-title {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 8px;
    color: #000;
}

.drawer-item-title a {
    color: #000;
    text-decoration: none;
}

.drawer-item-title a:hover {
    text-decoration: underline;
}

.drawer-item-price {
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #000;
    margin-bottom: 16px;
}

/* Controls Row - Quantity + Remove */
.drawer-item-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: auto;
}

/* Quantity Controls */
.drawer-item-quantity {
    display: flex;
    align-items: center;
    border: 1px solid #e0e0e0;
    border-radius: 0;
}

.drawer-qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    color: #000;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.drawer-qty-btn:hover {
    background: #f5f5f5;
}

.drawer-qty-btn:active {
    background: #eee;
}

.drawer-qty-value {
    width: 40px;
    text-align: center;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 36px;
    /* border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0; */
    color: #000;
}

/* Remove Button - Text Link Style */
.drawer-item-remove {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #000;
    text-decoration: none;
    transition: opacity 0.2s;
}

.drawer-item-remove:hover {
    text-decoration: underline;
    opacity: 0.7;
}

/* Footer */
.cart-drawer-footer {
    padding: 20px 28px 28px;
    border-top: 1px solid #e5e5e5;
    background: #fff;
    flex-shrink: 0;
}

/* Order Note Section */
.cart-drawer-order-note {
    margin-bottom: 20px;
}

.order-note-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #666;
    text-decoration: none;
    transition: color 0.2s;
}

.order-note-toggle:hover {
    color: #000;
}

.order-note-input {
    margin-top: 12px;
}

.order-note-input textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 3px;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
    color: #000;
}

.order-note-input textarea:focus {
    outline: none;
    border-color: #000;
}

.order-note-input textarea::placeholder {
    color: #999;
}

/* Checkout Button */
.cart-drawer-checkout {
    width: 100%;
    padding: 18px 24px;
    background: #000;
    color: #fff;
    border: none;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 3px;
    letter-spacing: 0.01em;
}

.cart-drawer-checkout:hover:not(:disabled) {
    background: #333;
}

.cart-drawer-checkout:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Loading state for checkout button */
.cart-drawer-checkout.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.cart-drawer-checkout.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: drawer-spin 0.8s linear infinite;
}

@keyframes drawer-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .cart-drawer-content {
        max-width: 85%;  /* Leave space on left for backdrop click to close */
    }

    .cart-drawer-header {
        padding: 20px;
    }

    .cart-drawer-header h3 {
        font-size: 16px;
    }

    .cart-drawer-item {
        padding: 20px;
        gap: 16px;
    }

    .drawer-item-image {
        width: 80px;
        height: 80px;
    }

    .drawer-item-title {
        font-size: 13px;
    }

    .drawer-item-price {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .drawer-item-controls {
        gap: 16px;
    }

    .drawer-qty-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .drawer-qty-value {
        width: 36px;
        font-size: 13px;
        line-height: 32px;
    }

    .drawer-item-remove {
        font-size: 12px;
    }

    .cart-drawer-footer {
        padding: 16px 20px 24px;
    }

    .cart-drawer-checkout {
        padding: 16px 20px;
        font-size: 13px;
    }

    .order-note-toggle {
        font-size: 13px;
    }

    .order-note-input textarea {
        font-size: 13px;
        padding: 10px;
    }
}

/* Smooth scrollbar for items */
.cart-drawer-items::-webkit-scrollbar {
    width: 4px;
}

.cart-drawer-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-drawer-items::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.cart-drawer-items::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* Firefox scrollbar */
.cart-drawer-items {
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}
