/**
 * Cart Drawer Styles
 */

.cart-drawer .drawer-content {
    left: auto;
    right: 0;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.opsim-drawer.cart-drawer.is-active .drawer-content {
    transform: translateX(0);
}

.cart-drawer .drawer-header {
    background-color: var(--opsim-brand, #355872);
}

.cart-drawer-count {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-left: 5px;
    font-weight: 400;
}

.cart-drawer-items-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 15px;
}

.cart-drawer-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    position: relative;
    background: #fff;
}

.cart-item-image {
    width: 75px;
    height: 75px;
    flex-shrink: 0;
    border-radius: 10px;
    overflow: hidden;
    background: #f7f7f7;
}

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

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

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

.cart-item-title {
    font-size: 0.75rem;
    font-weight: 500;
    margin: 0;
    color: #111827;
    line-height: 1.3;
    max-width: 85%;
    text-transform: uppercase;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #cccccc;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.cart-item-remove:hover {
    color: #ff4d4d;
}

.cart-item-remove svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 767px) {
    .cart-item-remove svg {
        width: 18px;
        height: 18px;
    }
}

.cart-item-price {
    color: var(--opsim-brand, #355872);
    font-weight: 800;
    font-size: 1rem;
    margin: 4px 0;
}

.cart-item-actions {
    display: flex;
    align-items: center;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    height: 28px;
    background: #fff;
}

.qty-btn {
    width: 28px;
    height: 100%;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #333;
    transition: background 0.2s;
    font-weight: 700;
}

.qty-btn:hover {
    background: #f9f9f9;
}

.qty-input {
    width: 32px;
    height: 100%;
    border: none;
    border-left: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    text-align: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #111827;
    background: #fff;
    -moz-appearance: textfield;
    padding: 0;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-drawer .drawer-footer {
    padding: 20px 15px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

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

.total-label {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.total-amount {
    font-size: 1.2rem;
    font-weight: 800;
    color: #000;
}

.checkout-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background-color: var(--opsim-brand, #355872);
    color: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    transition: opacity 0.2s ease;
    border: none; /* Removed black border */
    outline: none;
    cursor: pointer;
}

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

/* Empty cart state */
.empty-cart-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 10px;
    text-align: center;
}

.empty-cart-icon {
    width: 60px;
    height: 60px;
    color: #f0f0f0;
    margin-bottom: 15px;
}

.empty-cart-message {
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    margin-bottom: 20px;
}

.return-to-shop {
    display: inline-block;
    background-color: var(--opsim-brand, #355872);
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.8rem;
    transition: opacity 0.2s;
}

.return-to-shop:hover {
    opacity: 0.9;
}

/* Loading state */
.cart-drawer.is-loading {
    /* pointer-events: none; */ /* Removed to prevent blocking the checkout button */
}

.cart-drawer.is-loading .drawer-content {
    pointer-events: none; /* Block content but we might want to allow footer */
}

.cart-drawer.is-loading .drawer-footer {
    pointer-events: auto; /* Always allow clicking checkout even if list is loading */
}

.cart-drawer.is-loading .drawer-content::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin-top: -15px;
    margin-left: -15px;
    border: 3px solid rgba(var(--opsim-brand-rgb, 53, 88, 114), 0.1);
    border-top-color: var(--opsim-brand, #355872);
    border-radius: 50%;
    animation: cart-drawer-spin 0.8s linear infinite;
    z-index: 100;
}

@keyframes cart-drawer-spin {
    to { transform: rotate(360deg); }
}

.cart-drawer.is-loading .drawer-body,
.cart-drawer.is-loading .drawer-footer {
    opacity: 0.5;
    transition: opacity 0.2s;
}
