/* --- Floating Slide-out Cart Layer Core Elements --- */
.cart-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cart-drawer-overlay.drawer-open-active {
    opacity: 1;
    visibility: visible;
}

.cart-drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 440px;
    height: 100%;
    background-color: #FCF9F5;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-drawer-overlay.drawer-open-active .cart-drawer-panel {
    transform: translateX(0);
}

/* --- Headers setup --- */
.cart-drawer-header {
    padding: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0; /* Prevents the header from flattening when lists scale */
}

.cart-drawer-title-group {
    display: flex;
    align-items: center;
}

.cart-drawer-title {
    font-size: 20px;
    font-weight: bold;
    color: #000000;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.cart-drawer-badge {
    font-size: 12px;
    font-weight: bold;
    background-color: #2D221E;
    color: #ffffff;
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 10px;
}

.cart-drawer-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #555555;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}

/* --- Scrollable Content Rules --- */
.cart-drawer-items-container {
    flex: 1;
    overflow-y: auto; /* Activates vertical sliding panel overflow */
    max-height: calc(100vh - 240px); /* Sets clear operational limits above footer boundaries */
    padding: 24px;
    display: flex;
    flex-direction: column;
}

/* Clean Minimal Scrollbar Tracks */
.cart-drawer-items-container::-webkit-scrollbar {
    width: 5px;
}
.cart-drawer-items-container::-webkit-scrollbar-track {
    background: transparent;
}
.cart-drawer-items-container::-webkit-scrollbar-thumb {
    background: #2D221E;
    border-radius: 10px;
}

/* --- Dynamic Listing Design Layout --- */
.cart-drawer-item {
    display: flex;
    gap: 16px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    flex-shrink: 0; /* Ensures cards maintain uniform height arrays during scroll actions */
}

.cart-drawer-item-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-item-title {
    font-size: 15px;
    font-weight: bold;
    color: #000000;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.cart-item-price {
    font-size: 14px;
    font-weight: bold;
    color: #555555;
    margin: 0 0 8px 0;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    border-radius: 4px;
    padding: 2px;
}

.quantity-btn {
    background: none;
    border: none;
    font-size: 14px;
    color: #555555;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-val {
    font-size: 13px;
    font-weight: bold;
    color: #000000;
    padding: 0 8px;
    min-width: 20px;
    text-align: center;
}

.cart-item-remove-btn {
    background: none;
    border: none;
    color: #ff4d4d;
    font-size: 13px;
    cursor: pointer;
}

/* --- Panel Footer Layer --- */
.cart-drawer-footer {
    padding: 24px;
    background-color: #F5EFE6;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0; /* Keeps checkout buttons pinned to baseline matrix points */
}

.cart-drawer-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.cart-summary-label {
    font-size: 13px;
    color: #555555;
    text-transform: uppercase;
}

.cart-summary-value {
    font-size: 18px;
    font-weight: bold;
    color: #000000;
}

.cart-drawer-disclaimer {
    font-size: 12px;
    color: #555555;
    line-height: 1.5;
    margin: 0 0 16px 0;
}

.cart-checkout-btn {
    width: 100%;
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 16px;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
}