/**
 * Cart Widget Styles
 * Styles for the SE-Builder cart display widget
 */

/* ===================================
   CART WIDGET BASE STYLES
   =================================== */

.se-cart-widget {
    width: 100%;
}

/* Loading State */
.se-cart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.se-cart-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: se-cart-spin 1s linear infinite;
}

@keyframes se-cart-spin {
    to {
        transform: rotate(360deg);
    }
}

.se-cart-loading-text {
    margin-top: 0.75rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.se-cart-loading.hidden,
.se-cart-empty.hidden,
.se-cart-footer.hidden {
    display: none;
}

/* Empty State */
.se-cart-empty {
    text-align: center;
    padding: 3rem 1.5rem;
}

.se-cart-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: #9ca3af;
}

.se-cart-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.se-cart-empty-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.se-cart-empty-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: #3b82f6;
    color: white;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s;
}

.se-cart-empty-link:hover {
    background-color: #2563eb;
}

/* ===================================
   CART ITEMS LIST
   =================================== */

.se-cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Default/List Layout */
.se-cart-item,
.se-cart-layout-list .se-cart-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    position: relative;
}

/* Compact Layout */
.se-cart-layout-compact {
    gap: 0;
}

.se-cart-layout-compact .se-cart-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: transparent;
    border-radius: 0;
}

.se-cart-layout-compact .se-cart-item:last-child {
    border-bottom: none;
}

.se-cart-layout-compact .se-cart-item-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.se-cart-layout-compact .se-cart-item-name {
    flex: 1;
    min-width: 120px;
}

.se-cart-layout-compact .se-cart-item-price {
    margin-bottom: 0;
}

.se-cart-layout-compact .se-cart-item-quantity {
    margin: 0;
}

.se-cart-layout-compact .se-cart-item-total {
    margin-top: 0;
    margin-left: auto;
}

/* ===================================
   CART ITEM ELEMENTS
   =================================== */

/* Item Image */
.se-cart-item-image {
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 0.375rem;
    background-color: #e5e7eb;
}

.se-cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Item Details */
.se-cart-item-details {
    flex: 1;
    min-width: 0;
}

.se-cart-item-name {
    display: block;
    font-weight: 500;
    color: #111827;
    text-decoration: none;
    margin-bottom: 0.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.se-cart-item-name:hover {
    color: #3b82f6;
}

.se-cart-item-price {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.se-cart-item-qty-text {
    font-size: 0.875rem;
    color: #6b7280;
}

.se-cart-item-total {
    font-weight: 600;
    color: #111827;
    margin-top: 0.25rem;
}

/* ===================================
   QUANTITY CONTROLS
   =================================== */

.se-cart-item-quantity {
    display: inline-flex;
    align-items: center;
    gap: 0;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    overflow: hidden;
    background-color: white;
}

.se-cart-qty-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: background-color 0.2s, color 0.2s;
}

.se-cart-qty-btn:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.se-cart-qty-btn:active {
    background-color: #e5e7eb;
}

.se-cart-qty-input {
    width: 40px;
    height: 28px;
    text-align: center;
    border: none;
    border-left: 1px solid #d1d5db;
    border-right: 1px solid #d1d5db;
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    background: transparent;
    -moz-appearance: textfield;
}

.se-cart-qty-input::-webkit-outer-spin-button,
.se-cart-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ===================================
   REMOVE BUTTON
   =================================== */

.se-cart-item-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #9ca3af;
    transition: background-color 0.2s, color 0.2s;
}

.se-cart-item-remove:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* ===================================
   CART FOOTER
   =================================== */

.se-cart-footer {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Summary Rows */
.se-cart-summary {
    margin-bottom: 1rem;
}

.se-cart-subtotal,
.se-cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.se-cart-subtotal-label,
.se-cart-total-label {
    color: #6b7280;
    font-size: 0.875rem;
}

.se-cart-subtotal-value {
    font-weight: 500;
    color: #111827;
}

.se-cart-total {
    border-top: 1px solid #e5e7eb;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.se-cart-total-label {
    font-weight: 600;
    font-size: 1rem;
    color: #111827;
}

.se-cart-total-value {
    font-weight: 700;
    font-size: 1.125rem;
    color: #111827;
}

/* Action Buttons */
.se-cart-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.se-cart-checkout-btn,
.se-cart-continue-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
}

.se-cart-checkout-btn {
    background-color: #3b82f6;
    color: white;
}

.se-cart-checkout-btn:hover {
    background-color: #2563eb;
}

.se-cart-checkout-btn:active {
    transform: scale(0.98);
}

.se-cart-continue-btn {
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

.se-cart-continue-btn:hover {
    background-color: #e5e7eb;
}

/* ===================================
   ANIMATIONS
   =================================== */

.se-cart-item {
    transition: opacity 0.3s, height 0.3s, margin 0.3s, padding 0.3s;
}

.se-cart-item-removing {
    opacity: 0.5;
    pointer-events: none;
}

/* ===================================
   RESPONSIVE STYLES
   =================================== */

@media (max-width: 480px) {
    .se-cart-layout-list .se-cart-item {
        flex-wrap: wrap;
    }
    
    .se-cart-item-details {
        flex-basis: calc(100% - 80px);
    }
    
    .se-cart-item-remove {
        position: absolute;
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .se-cart-actions {
        flex-direction: column;
    }
}

/* ===================================
   DARK MODE (if needed)
   =================================== */

@media (prefers-color-scheme: dark) {
    .se-cart-widget[data-theme="auto"] .se-cart-loading-spinner {
        border-color: #374151;
        border-top-color: #60a5fa;
    }
    
    .se-cart-widget[data-theme="auto"] .se-cart-loading-text,
    .se-cart-widget[data-theme="auto"] .se-cart-empty-subtitle {
        color: #9ca3af;
    }
    
    .se-cart-widget[data-theme="auto"] .se-cart-empty-icon {
        color: #6b7280;
    }
    
    .se-cart-widget[data-theme="auto"] .se-cart-empty-title,
    .se-cart-widget[data-theme="auto"] .se-cart-item-name,
    .se-cart-widget[data-theme="auto"] .se-cart-item-total,
    .se-cart-widget[data-theme="auto"] .se-cart-total-label,
    .se-cart-widget[data-theme="auto"] .se-cart-total-value {
        color: #f9fafb;
    }
    
    .se-cart-widget[data-theme="auto"] .se-cart-layout-list .se-cart-item {
        background-color: #1f2937;
    }
    
    .se-cart-widget[data-theme="auto"] .se-cart-layout-compact .se-cart-item {
        border-bottom-color: #374151;
    }
}
