/**
 * Cart Sidebar - Slide-in cart popup
 * Matches vita4you.gr style
 */

/* Hide default Aimeos mini basket (we use our own sidebar) */
.aimeos.basket-mini .basket-mini-main,
.aimeos.basket-mini .basket-mini-product,
.aimeos.basket-mini .aimeos-overlay-offscreen {
    display: none !important;
}

/* Hide Aimeos loading animation on add-to-cart buttons */
.basket-form .btn-action.loading::after,
.basket-form .btn-action.loading::before,
.basket-form button[type="submit"].loading::after,
.basket-form button[type="submit"].loading::before,
.basket-form .loading,
.catalog-detail-basket .loading,
.catalog-list .loading {
    display: none !important;
    animation: none !important;
}

/* Overlay */
.cart-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cart-sidebar-overlay.open {
    display: block;
    opacity: 1;
}

/* Sidebar Panel */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transition: right 0.3s ease;
}
.cart-sidebar.open {
    right: 0;
}

/* Header */
.cart-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 3rem 1rem 1rem;
    border-bottom: 2px solid #5BB5C5;
    position: relative;
    flex-shrink: 0;
    background: #f8fdfe;
    min-height: 56px;
}
.cart-sidebar-header .cart-icon-badge {
    position: relative;
    margin-right: 0.5rem;
    flex-shrink: 0;
}
.cart-sidebar-header .cart-icon-badge svg {
    width: 24px;
    height: 24px;
    stroke: #1f2937;
}
.cart-sidebar-header .cart-icon-badge .badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: #5BB5C5;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cart-sidebar-header h3 {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}
.cart-sidebar-close {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #4b5563;
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 400;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
}
.cart-sidebar-close:hover {
    color: #1f2937;
    background: #e5e7eb;
}

/* Product List */
.cart-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.cart-sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #9ca3af;
    font-size: 0.875rem;
    padding: 2rem;
    text-align: center;
}
.cart-sidebar-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* Product Item */
.cart-sidebar-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
}
.cart-sidebar-item .item-image {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    overflow: hidden;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-color 0.15s;
}
.cart-sidebar-item a.item-image:hover {
    border-color: #5BB5C5;
}
.cart-sidebar-item .item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.cart-sidebar-item .item-image .no-image {
    width: 32px;
    height: 32px;
    opacity: 0.25;
}
.cart-sidebar-item .item-details {
    flex: 1;
    min-width: 0;
}
.cart-sidebar-item .item-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.4;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
    transition: color 0.15s;
}
.cart-sidebar-item a.item-name:hover {
    color: #5BB5C5;
}
.cart-sidebar-item .item-qty-price {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.cart-sidebar-item .qty-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: #fff;
    color: #5BB5C5;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.cart-sidebar-item .qty-btn:hover {
    background: #5BB5C5;
    border-color: #5BB5C5;
    color: #fff;
}
.cart-sidebar-item .qty-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
    min-width: 1.75rem;
    text-align: center;
}
.cart-sidebar-item .item-price {
    font-size: 0.875rem;
    font-weight: 600;
    color: #5BB5C5;
    white-space: nowrap;
    margin-left: 0.5rem;
}
.cart-sidebar-item .item-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: #d1d5db;
    padding: 0.25rem;
    transition: color 0.15s;
    margin-top: 0.125rem;
}
.cart-sidebar-item .item-delete:hover {
    color: #ef4444;
}

/* Footer */
.cart-sidebar-footer {
    flex-shrink: 0;
    border-top: 2px solid #e5e7eb;
    padding: 1rem;
    background: #fafafa;
}
.cart-sidebar-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.25rem;
}
.cart-sidebar-subtotal .label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #1f2937;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.cart-sidebar-subtotal .value {
    font-size: 1.125rem;
    font-weight: 700;
    color: #5BB5C5;
}
.cart-sidebar-footer .btn-cart {
    display: block;
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    border: 2px solid #1f2937;
    border-radius: 0.375rem;
    background: #fff;
    color: #1f2937;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}
.cart-sidebar-footer .btn-cart:hover {
    background: #1f2937;
    color: #fff;
}
.cart-sidebar-footer .btn-checkout {
    display: block;
    width: 100%;
    padding: 0.75rem;
    text-align: center;
    border: none;
    border-radius: 0.375rem;
    background: #5BB5C5;
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s;
}
.cart-sidebar-footer .btn-checkout:hover {
    background: #4aa3b3;
}

/* Loading spinner */
.cart-sidebar-loading {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    z-index: 1;
    align-items: center;
    justify-content: center;
}
.cart-sidebar-loading.active {
    display: flex;
}
.cart-sidebar-loading .spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #5BB5C5;
    border-radius: 50%;
    animation: cart-spin 0.6s linear infinite;
}
@keyframes cart-spin {
    to { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 480px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }
    .cart-sidebar-header {
        padding: 0.875rem 3rem 0.875rem 0.75rem;
    }
    .cart-sidebar-header h3 {
        font-size: 0.875rem;
    }
}
