:root {
    --primary-color: #f28b00;
    --dark-color: #1a1a1a;
    --sidebar-width: 75vw;
    --sidebar-max-width: 500px;
}

.cart-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    z-index: 1040;
    pointer-events: none;
}

.cart-sidebar.show {
    pointer-events: auto;
}

.cart-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    transition: background-color 0.3s ease;
    pointer-events: none;
}

.cart-sidebar.show .cart-backdrop {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.cart-sidebar-container {
    position: absolute;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    max-width: var(--sidebar-max-width);
    height: 100vh;
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1041;
}

.cart-sidebar.show .cart-sidebar-container {
    transform: translateX(0);
}

/* Header */
.cart-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary-color), #ff9f1c);
    color: white;
}

.cart-sidebar-header h4 {
    margin: 0;
    font-weight: 700;
}

.cart-sidebar-header .btn-close {
    opacity: 0.8;
    filter: brightness(0) invert(1);
}

.cart-sidebar-header .btn-close:hover {
    opacity: 1;
}

/* Items Wrapper */
.cart-items-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.cart-items-wrapper::-webkit-scrollbar {
    width: 6px;
}

.cart-items-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-items-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.cart-items-wrapper::-webkit-scrollbar-thumb:hover {
    background: #ff9f1c;
}

/* Empty Cart Message */
.empty-cart-message {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    min-height: 200px;
}

/* Cart Item Card */
.cart-item-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
    animation: slideInUp 0.3s ease;
}

.cart-item-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Removing animation */
.cart-item-card.removing {
    animation: slideOutDown 0.3s ease forwards;
}

@keyframes slideOutDown {
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Item Header */
.cart-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.cart-item-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark-color);
    margin: 0;
    max-width: 70%;
}

.cart-item-remove {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    font-size: 0.9rem;
}

.cart-item-remove:hover {
    opacity: 1;
}

/* Item Details */
.cart-item-details {
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
}

.detail-label {
    font-weight: 500;
}

/* Item Footer */
.cart-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

/* Quantity Controls */
.quantity-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 0.25rem;
}

.quantity-control button {
    background: none;
    border: none;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6c757d;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.quantity-control button:hover {
    background: white;
    color: var(--primary-color);
}

.quantity-control input {
    width: 35px;
    border: none;
    background: transparent;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.quantity-control input:focus {
    outline: none;
}

/* Item Price */
.cart-item-price {
    text-align: right;
}

.price-label {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.price-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Footer */
.cart-sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-shrink: 0;
}

.cart-summary {
    font-size: 0.9rem;
}

.cart-sidebar-footer .btn {
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #ff9f1c;
    border-color: #ff9f1c;
}

/* Responsive Design */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100vw;
        --sidebar-max-width: 100%;
    }

    .cart-sidebar-container {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    .cart-sidebar-header {
        padding: 1rem;
    }

    .cart-item-card {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
    }

    .cart-item-title {
        font-size: 0.9rem;
    }

    .cart-sidebar-footer {
        padding: 1rem 1rem 4rem;
    }
}

/* Loading State */
.cart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner-border {
    color: var(--primary-color);
}

/* Badge for item count */
.cart-item-badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    margin-left: 0.5rem;
}

/* The pulse effect when the number of items in the cart changes */
@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

.pulse-animation {
    animation: cartPulse 0.3s ease-in-out;
}


/* Hide the default up/down arrows of the input type="number" tag in Chrome, Safari, Edge, Opera */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0;
}

/* Hide the default up/down arrows of the input type="number" tag in Firefox */
input[type="number"] {
    appearance: textfield !important;
    -moz-appearance: textfield !important;
}