/**
 * Cart Page Styles
 */

/* ========================================
    CART LAYOUT WITH SIDEBAR
   ======================================== */

.dm-cart-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.dm-cart-main {
    flex: 1;
    min-width: 0; /* Prevent flex overflow */
}

.dm-cart-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem;
    position: sticky;
    top: 20px;
    /*ax-height: calc(100vh - 120px);*/
    overflow-y: auto;
}

.dm-cart-sidebar-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.dm-cart-sidebar-header h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #2d3748;
}

.dm-cart-sidebar-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Recommended Product Card */
.dm-recommended-product {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    transition: all 0.2s;
    position: relative;
}

.dm-recommended-product:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

.dm-recommended-product-link,
.dm-recommended-product-info {
    text-decoration: none;
    color: inherit;
}

.dm-recommended-product-link {
    flex-shrink: 0;
}

.dm-recommended-product-image {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
    background: white;
}

.dm-recommended-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dm-recommended-product-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-right: 2.5rem; /* Space for add button */
}

.dm-recommended-product-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.dm-recommended-product-category {
    font-size: 0.75rem;
    color: #718096;
}

.dm-recommended-product-price {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-top: auto;
}

/* Add to cart button in recommendations */
.dm-add-xs {
    position: absolute;
    top: 50%;
    inset-inline-end: 0.75rem;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    /*background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);*/
    background: var(--primary-color);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(var(--primary-color-rgb), 0.3);
    z-index: 1;
}

.wv-tbody .wv-cell .dm-add-xs {
    position: relative;
    top: 50%;
    inset-inline-start: 0;
}

body[data-view="list"] .wv-tbody .wv-cell .dm-add-xs {
	bottom: 0;
	top: unset;
	position: absolute;
	inset-inline-end: 12px;
	inset-inline-start: unset;
}

.dm-add-xs:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 8px rgba(var(--primary-color-rgb), 0.4);
}

.dm-add-xs:active {
    transform: translateY(-50%) scale(0.95);
}

.dm-add-xs.is-added {
    background: var(--accent);
    box-shadow: 0 2px 4px rgba(var(--accent-rgb), 0.3);
}

.dm-add-xs.is-added:hover {
    box-shadow: 0 4px 8px rgba(var(--accent-h), 0.4);
}

/* Empty state for recommendations */
.dm-sidebar-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #a0aec0;
    font-size: 0.875rem;
}

/* Mobile Responsive */
@media (max-width: 968px) {
    .dm-cart-layout {
        flex-direction: column;
    }
    
    .dm-cart-sidebar {
        width: 100%;
        position: static;
        max-height: none;
        order: 2; /* Sidebar en bas sur mobile */
    }
    
    .dm-cart-main {
        order: 1;
    }
}

/* ========================================
    NOTIFICATIONS
   ======================================== */

/* Notifications */
.dm-cart-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    animation: slideInUp 0.3s ease-out;
    min-width: 280px;
    max-width: 400px;
}

.dm-cart-notification.error {
    background: #ef4444;
}

.dm-cart-notification.info {
    background: #3b82f6;
}

.dm-cart-notification-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.dm-cart-notification-message {
    font-size: 0.875rem;
    opacity: 0.95;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.dm-cart-notification.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

.dm-cart-items {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.dm-cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: box-shadow 0.2s;
}

.dm-cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dm-cart-item-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    background: #f7fafc;
}

.dm-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dm-cart-item-info {
    flex: 1;
    min-width: 0;
}

.dm-cart-item-name {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
}

.dm-cart-item-notes {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    color: #718096;
    font-style: italic;
}

.dm-cart-item-unit-price {
    margin: 0;
    font-size: 0.875rem;
    color: #4a5568;
    font-weight: 500;
}

.dm-cart-item-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.dm-cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem;
    background: #f7fafc;
    border-radius: 6px;
}

.dm-cart-qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #4a5568;
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.dm-cart-qty-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.dm-cart-qty-btn:active {
    transform: scale(0.95);
}

.dm-cart-qty-value {
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    color: #2d3748;
}

.dm-cart-item-total {
    min-width: 80px;
    text-align: right;
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
}

.dm-cart-remove-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #e53e3e;
    cursor: pointer;
    transition: all 0.2s;
}

.dm-cart-remove-btn:hover {
    background: #fff5f5;
    border-color: #fc8181;
}

.dm-cart-summary {
    padding: 1.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.dm-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
}

.dm-cart-total-amount {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.dm-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dm-cart-empty {
    text-align: center;
    padding: 3rem 1rem;
}

.dm-cart-empty p {
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
    color: #718096;
}

.dm-auth-card-wide {
    padding: 0;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .dm-cart-item {
        flex-wrap: wrap;
    }
    
    .dm-cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    .dm-cart-item-controls {
        width: 100%;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid #e2e8f0;
    }
    
    .dm-cart-item-total {
        min-width: auto;
    }

    .dm-auth-card-wide.guest-card .dm-cart-sidebar {
        padding: 0;
    }

    .dm-guest-cart-notice > div {
        padding: 1rem!important;
        margin-bottom: 0!important;
    }
}
