/* Cart Sidebar Styles */
.cart-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 450px;
    height: 100vh;
    z-index: 9999;
    transition: left 0.3s ease;
    pointer-events: none;
}

.cart-sidebar.active {
    left: 0;
    pointer-events: auto;
}

.cart-sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 9998;
}

/* Overlay styles when sidebar is active */
body:has(.cart-sidebar.active) .cart-sidebar-overlay,
.cart-sidebar.active ~ .cart-sidebar-overlay {
    opacity: 1;
    visibility: visible;
}

.cart-sidebar-content {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-right: 2px solid var(--tg-theme-primary);
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
    z-index: 9999;
}

.cart-sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, var(--tg-theme-primary) 0%, var(--tg-common-color-cyan) 100%);
    border-bottom: 2px solid var(--tg-theme-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-sidebar-title {
    margin: 0;
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cart-sidebar-title i {
    font-size: 24px;
}

.cart-sidebar-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.cart-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--tg-common-color-black);
}

.cart-sidebar-body::-webkit-scrollbar {
    width: 6px;
}

.cart-sidebar-body::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.cart-sidebar-body::-webkit-scrollbar-thumb {
    background: var(--tg-theme-primary);
    border-radius: 3px;
}

.cart-sidebar-body::-webkit-scrollbar-thumb:hover {
    background: var(--tg-common-color-cyan);
}

.cart-sidebar-loading,
.cart-sidebar-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--tg-body-color);
    min-height: 200px;
}

.cart-sidebar-loading .spinner-border {
    width: 50px;
    height: 50px;
    border-width: 4px;
    border-color: var(--tg-theme-primary);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.cart-sidebar-error i {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 15px;
}

.cart-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: var(--tg-body-color);
}

.cart-sidebar-empty .empty-cart-icon {
    font-size: 80px;
    color: var(--tg-theme-primary);
    margin-bottom: 20px;
    opacity: 0.5;
}

.cart-sidebar-empty h4 {
    color: #fff;
    margin-bottom: 10px;
}

.cart-sidebar-empty p {
    margin-bottom: 25px;
    color: var(--tg-body-color);
}

.cart-sidebar-items {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cart-sidebar-item {
    background: linear-gradient(135deg, #2a2a3e 0%, #1e1e2e 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    gap: 15px;
    position: relative;
    transition: all 0.3s ease;
}

.cart-sidebar-item:hover {
    border-color: var(--tg-theme-primary);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.2);
}

.cart-sidebar-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-sidebar-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-sidebar-item-image .no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-primary);
    font-size: 24px;
}

.cart-sidebar-item-details {
    flex: 1;
    min-width: 0;
}

.cart-sidebar-item-title {
    margin: 0 0 5px;
    font-size: 16px;
    font-weight: bold;
}

.cart-sidebar-item-title a {
    color: #fff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.cart-sidebar-item-title a:hover {
    color: var(--tg-theme-primary);
}

.cart-sidebar-item-category {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--tg-body-color);
}

.cart-sidebar-item-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.cart-sidebar-item-price .price {
    color: var(--tg-theme-primary);
    font-weight: bold;
    font-size: 14px;
}

.cart-sidebar-item-qty {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cart-sidebar-item-qty .qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--tg-theme-primary);
    background: transparent;
    color: var(--tg-theme-primary);
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cart-sidebar-item-qty .qty-btn:hover {
    background: var(--tg-theme-primary);
    color: #000;
}

.cart-sidebar-item-qty .qty-input {
    width: 45px;
    height: 28px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-radius: 5px;
    font-size: 14px;
}

.cart-sidebar-item-price .fixed-qty {
    font-size: 12px;
    color: var(--tg-body-color);
}

.cart-sidebar-item-total {
    font-size: 13px;
    color: var(--tg-common-color-cyan);
    font-weight: bold;
}

.cart-sidebar-item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.cart-sidebar-item-remove:hover {
    background: #dc3545;
    color: #fff;
    transform: scale(1.1);
}

.cart-sidebar-footer {
    padding: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-top: 2px solid var(--tg-theme-primary);
}

.cart-sidebar-summary {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-sidebar-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: var(--tg-body-color);
    font-size: 14px;
}

.cart-sidebar-summary-row.total {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-sidebar-summary-row.total span:last-child {
    color: var(--tg-theme-primary);
}

.cart-sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cart-sidebar-actions .btn {
    padding: 12px 20px;
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: block;
}

.cart-sidebar-actions .btn-primary {
    background: linear-gradient(135deg, var(--tg-theme-primary) 0%, var(--tg-common-color-cyan) 100%);
    color: #000;
}

.cart-sidebar-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 255, 255, 0.4);
}

.cart-sidebar-actions .btn-secondary {
    background: transparent;
    color: var(--tg-theme-primary);
    border: 1px solid var(--tg-theme-primary);
}

.cart-sidebar-actions .btn-secondary:hover {
    background: var(--tg-theme-primary);
    color: #000;
}

.cart-sidebar-actions .btn-block {
    width: 100%;
}

@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
    }
}
