/* Bag Drawer & Sheet Styles */

/* Overlay */
.bag-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.bag-overlay.active {
    display: block;
    opacity: 1;
}

/* Bag Drawer (Desktop) */
.bag-drawer {
    position: fixed;
    top: 0;
    right: -500px;
    width: 500px;
    height: 100vh;
    background-color: #ffffff;
    z-index: 300;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    /* Prevent flash during breakpoint transition */
    will-change: right;
}

.bag-drawer.open {
    right: 0;
}

.bag-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

.bag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #f6f6f6;
}

.bag-title {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    margin: 0;
}

.bag-close {
    background: none;
    border: none;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    cursor: pointer;
    padding: 0;
}

.bag-items {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.bag-item {
    display: flex;
    gap: 16px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid #f6f6f6;
}

.bag-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.bag-item-image {
    width: 80px;
    height: 100px;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
}

.bag-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bag-item-title {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    margin: 0;
    cursor: pointer;
}

.bag-item-title:hover {
    text-decoration: none;
}

.bag-item-price {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    margin: 0;
}

.bag-item-remove {
    background: none;
    border: none;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    align-self: flex-start;
    margin-top: auto;
}

.bag-empty {
    padding: 32px 16px;
    text-align: center;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
}

.bag-footer {
    padding: 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid #f6f6f6;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-color: #ffffff;
    flex-shrink: 0;
}

.bag-subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.subtotal-label,
.subtotal-amount {
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: #000000;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    margin: 0;
}

.checkout-button {
    background-color: #000000;
    color: #ffffff;
    border: none;
    padding: 8px;
    height: 40px;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    font-style: normal;
    line-height: normal;
    cursor: pointer;
    width: 100%;
}

.checkout-button:hover {
    opacity: 0.9;
}

.checkout-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Full Screen Sheet */
@media (max-width: 767px) {
    .bag-drawer {
        right: -100%;
        width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile browsers */
        /* Ensure smooth transition when crossing breakpoint */
        transition: right 0.3s ease;
    }
    
    .bag-drawer.open {
        right: 0;
    }
    
    .bag-content {
        height: 100%;
        max-height: 100dvh;
    }
    
    .bag-footer {
        position: sticky;
        bottom: 0;
        z-index: 10;
    }
}

