/* Complete Cart System Styles */

/* Cart Sidebar */
.cart-sidebar {
    position: fixed;
    inset: 0;
    z-index: 10500 !important;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-sidebar.open {
    display: block;
    opacity: 1;
}

.cart-sidebar__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    /* backdrop-filter removed for Safari */
    cursor: pointer;
}

.cart-sidebar__panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 420px;
    max-width: 100vw;
    background: var(--primary-black, #000);
    border-left: 2px solid var(--primary-gold, #D4AF37);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-sidebar.open .cart-sidebar__panel {
    transform: translateX(0);
}

/* Cart Header */
.cart-sidebar__header {
    padding: 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    background: rgba(212, 175, 55, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.cart-sidebar__title {
    color: var(--primary-gold, #D4AF37);
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.cart-sidebar__close {
    background: none;
    border: 2px solid var(--primary-gold, #D4AF37);
    color: var(--primary-gold, #D4AF37);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: bold;
}

.cart-sidebar__close:hover {
    background: var(--primary-gold, #D4AF37);
    color: var(--primary-black, #000);
    transform: scale(1.1);
}

/* Cart Body */
.cart-sidebar__body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-gold, #D4AF37) transparent;
}

.cart-sidebar__body::-webkit-scrollbar {
    width: 6px;
}

.cart-sidebar__body::-webkit-scrollbar-track {
    background: transparent;
}

.cart-sidebar__body::-webkit-scrollbar-thumb {
    background: var(--primary-gold, #D4AF37);
    border-radius: 3px;
}

/* Cart Loading */
.cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--light-gray, #666);
}

.cart-loading .spinner-border {
    color: var(--primary-gold, #D4AF37);
    margin-bottom: 15px;
}

/* Cart Empty */
.cart-empty {
    text-align: center;
    padding: 40px 20px;
}

.cart-empty i {
    color: var(--primary-gold, #D4AF37);
    margin-bottom: 20px;
}

.cart-empty h5 {
    color: var(--white, #fff);
    margin-bottom: 10px;
}

.cart-empty p {
    color: var(--light-gray, #666);
    margin-bottom: 20px;
}

/* Cart Items */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: start;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    gap: 15px;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.cart-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(212, 175, 55, 0.3);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.1);
}

.cart-item__image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid rgba(212, 175, 55, 0.3);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.cart-item:hover .cart-item__image {
    border-color: rgba(212, 175, 55, 0.5);
    transform: scale(1.05);
}

.cart-item__info {
    flex: 1;
    min-width: 0;
}

.cart-item__title {
    color: var(--white, #fff);
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
}

.cart-item__price {
    color: var(--primary-gold, #D4AF37);
    font-weight: 700;
    margin: 0 0 12px 0;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
}

.cart-item__controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.cart-item__qty-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(212, 175, 55, 0.1);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    padding: 6px 10px;
}

.cart-item__qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--primary-gold, #D4AF37);
    background: rgba(212, 175, 55, 0.1);
    color: var(--primary-gold, #D4AF37);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.cart-item__qty-btn:hover:not(:disabled) {
    background: var(--primary-gold, #D4AF37);
    color: var(--primary-black, #000);
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.cart-item__qty-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.cart-item__qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.cart-item__qty {
    color: var(--white, #fff);
    font-weight: 600;
    min-width: 24px;
    text-align: center;
    font-size: 1rem;
}

.cart-item__remove {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.cart-item__remove:hover {
    background: #dc3545;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.cart-item__remove:active {
    transform: translateY(0);
}

.cart-item__subtotal {
    color: var(--primary-gold, #D4AF37);
    font-weight: 700;
    font-size: 1.1rem;
    text-align: right;
    flex-shrink: 0;
    min-width: 80px;
    align-self: center;
    letter-spacing: 0.5px;
}

/* Cart Footer */
.cart-sidebar__footer {
    padding: 20px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    background: rgba(212, 175, 55, 0.05);
    flex-shrink: 0;
}

.cart-summary {
    margin-bottom: 20px;
}

.cart-summary__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    color: var(--white, #fff);
    font-size: 0.95rem;
}

.cart-summary__total {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-gold, #D4AF37);
    padding-top: 8px;
    border-top: 1px solid rgba(212, 175, 55, 0.2);
    margin-top: 8px;
}

.cart-security-note {
    text-align: center;
    margin-top: 15px;
}

.cart-security-note small {
    color: var(--light-gray, #666);
    font-size: 0.8rem;
}

/* Cart Badge */
.cart-badge {
    background: var(--primary-gold, #D4AF37);
    color: var(--primary-black, #000);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    position: absolute;
    top: -5px;
    right: -10px;
    transition: all 0.3s ease;
}

.cart-badge.updated {
    animation: cartBadgePulse 0.6s ease;
}

@keyframes cartBadgePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .cart-sidebar__panel {
        width: 100vw;
    }

    .cart-sidebar__header {
        padding: 15px;
    }

    .cart-sidebar__body {
        padding: 15px;
    }

    .cart-sidebar__footer {
        padding: 15px;
    }

    .cart-item {
        padding: 12px;
    }

    .cart-item__image {
        width: 60px;
        height: 60px;
    }

    .cart-item__title {
        font-size: 0.9rem;
    }

    .cart-item__price,
    .cart-item__subtotal {
        font-size: 0.9rem;
    }
}