/**
 * Cart Widget Styles
 * Super-fast, optimized cart layouts for Elementor
 *
 * @package Storedash_Checkout
 * @since 2.8.0
 */

/* ============================================
   Common Styles (All Layouts)
   ============================================ */

.storedash-cart-widget {
    width: 100%;
    max-width: 100%;
}

/* Empty Cart */
.storedash-cart-empty {
    text-align: center;
    padding: 80px 20px;
}

.storedash-cart-empty .empty-cart-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    color: #d1d5db;
}

.storedash-cart-empty h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px;
}

.storedash-cart-empty p {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

/* ============================================
   LAYOUT 1 - Two Column (Current Design)
   ============================================ */

.cart-layout-1 .cart-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 40px;
    align-items: start;
}

.cart-layout-1 .cart-left {
    min-width: 0;
}

.cart-layout-1 .cart-items-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.cart-layout-1 .cart-item {
    position: relative;
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 20px;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.cart-layout-1 .item-image {
    width: 80px;
    height: 80px;
}

.cart-layout-1 .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.cart-layout-1 .item-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.cart-layout-1 .item-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
}

.cart-layout-1 .item-name a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-layout-1 .item-name a:hover {
    color: #E65500;
}

.cart-layout-1 .item-meta {
    font-size: 13px;
    color: #6b7280;
}

.cart-layout-1 .item-quantity .quantity {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 4px;
    background: #f9fafb;
}

.cart-layout-1 .quantity-minus,
.cart-layout-1 .quantity-plus {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
    color: #1f2937;
}

.cart-layout-1 .quantity-minus:hover,
.cart-layout-1 .quantity-plus:hover {
    background: #E65500;
    color: #ffffff;
}

.cart-layout-1 .quantity input.qty {
    width: 50px;
    height: 32px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide number input spinners in WebKit browsers */
.cart-layout-1 .quantity input.qty::-webkit-inner-spin-button,
.cart-layout-1 .quantity input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-layout-1 .item-price-remove {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.cart-layout-1 .item-price {
    font-size: 18px;
    font-weight: 700;
    color: #E65500;
}

.cart-layout-1 .item-remove a {
    color: #6b7280;
    font-size: 24px;
    line-height: 1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-layout-1 .item-remove a:hover {
    color: #dc2626;
}

.cart-layout-1 .cart-actions {
    display: flex;
    gap: 12px;
    padding: 20px 0;
}

.cart-layout-1 .update-cart {
    padding: 12px 24px;
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cart-layout-1 .update-cart:hover {
    background: #e5e7eb;
}

/* Right Column - Totals */
.cart-layout-1 .cart-right {
    position: sticky;
    top: 100px;
}

.cart-layout-1 .cart-totals-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.cart-layout-1 .totals-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px;
    color: #1f2937;
}

.cart-layout-1 .cart-totals {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.cart-layout-1 .totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    color: #1f2937;
}

.cart-layout-1 .totals-row.total {
    padding-top: 16px;
    font-size: 18px;
    font-weight: 700;
}

.cart-layout-1 .totals-row .row-value {
    font-weight: 600;
}

.cart-layout-1 .checkout-button {
    display: block;
    width: 100%;
    padding: 16px;
    background: #E65500;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.cart-layout-1 .checkout-button:hover {
    background: #cc4d00;
    transform: translateY(-2px);
    box-shadow: none;
}

/* ============================================
   LAYOUT 2 - Single Column
   ============================================ */

.cart-layout-2 .cart-layout {
    max-width: 800px;
    margin: 0 auto;
}

.cart-layout-2 .cart-single-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.cart-layout-2 .cart-items-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cart-layout-2 .cart-item {
    position: relative;
    display: flex;
    gap: 16px;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.cart-layout-2 .item-image {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.cart-layout-2 .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.cart-layout-2 .item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-layout-2 .item-name {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.cart-layout-2 .item-name a {
    color: #1f2937;
    text-decoration: none;
}

.cart-layout-2 .item-name a:hover {
    color: #E65500;
}

.cart-layout-2 .item-quantity .quantity {
    display: inline-flex;
    gap: 4px;
}

.cart-layout-2 .quantity-minus,
.cart-layout-2 .quantity-plus {
    width: 28px;
    height: 28px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

.cart-layout-2 .quantity-minus:hover,
.cart-layout-2 .quantity-plus:hover {
    background: #E65500;
    color: #ffffff;
    border-color: #E65500;
}

.cart-layout-2 .quantity input.qty {
    width: 50px;
    height: 28px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide number input spinners in WebKit browsers */
.cart-layout-2 .quantity input.qty::-webkit-inner-spin-button,
.cart-layout-2 .quantity input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-layout-2 .item-price-remove {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.cart-layout-2 .item-price {
    font-size: 20px;
    font-weight: 700;
    color: #E65500;
}

.cart-layout-2 .item-remove a {
    color: #9ca3af;
    font-size: 20px;
    text-decoration: none;
}

.cart-layout-2 .item-remove a:hover {
    color: #dc2626;
}

.cart-layout-2 .cart-totals-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
}

.cart-layout-2 .checkout-button {
    display: block;
    width: 100%;
    padding: 16px;
    background: #E65500;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
}

.cart-layout-2 .checkout-button:hover {
    background: #cc4d00;
}

/* ============================================
   LAYOUT 3 - Compact Modern
   ============================================ */

.cart-layout-3 .cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.cart-layout-3 .cart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.cart-layout-3 .item-image {
    width: 60px;
    height: 60px;
}

.cart-layout-3 .item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.cart-layout-3 .item-details {
    flex: 1;
}

.cart-layout-3 .item-name {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 4px;
}

.cart-layout-3 .item-name a {
    color: #1f2937;
    text-decoration: none;
}

.cart-layout-3 .quantity {
    display: inline-flex;
    gap: 4px;
    margin-top: 4px;
}

.cart-layout-3 .quantity-minus,
.cart-layout-3 .quantity-plus {
    width: 24px;
    height: 24px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.cart-layout-3 .quantity input.qty {
    width: 40px;
    height: 24px;
    text-align: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide number input spinners in WebKit browsers */
.cart-layout-3 .quantity input.qty::-webkit-inner-spin-button,
.cart-layout-3 .quantity input.qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-layout-3 .item-price {
    font-size: 16px;
    font-weight: 700;
    color: #E65500;
}

.cart-layout-3 .compact-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-layout-3 .compact-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.cart-layout-3 .compact-image {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.cart-layout-3 .compact-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.cart-layout-3 .compact-info {
    flex: 1;
    min-width: 0;
}

.cart-layout-3 .compact-name {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-layout-3 .compact-qty {
    font-size: 12px;
    color: #6b7280;
}

.cart-layout-3 .compact-price {
    font-size: 15px;
    font-weight: 700;
    color: #E65500;
}

.cart-layout-3 .compact-summary {
    position: sticky;
    top: 100px;
}

.cart-layout-3 .cart-totals-card {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
}

.cart-layout-3 .checkout-button {
    display: block;
    width: 100%;
    padding: 14px;
    background: #E65500;
    color: #ffffff;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
}

/* ============================================
   Cart Totals (Shared)
   ============================================ */

.cart-totals {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
}

.totals-row.total {
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.totals-row .row-label {
    color: #6b7280;
}

.totals-row .row-value {
    font-weight: 600;
    color: #1f2937;
}

/* Total value color now controlled via Elementor */

.totals-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 16px;
    color: #1f2937;
}

/* ============================================
   Cart Actions
   ============================================ */

.cart-actions {
    display: flex;
    gap: 12px;
}

.cart-actions .button {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.cart-actions .update-cart {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #e5e7eb;
}

.cart-actions .update-cart:hover {
    background: #e5e7eb;
}

/* ============================================
   Responsive Layouts
   ============================================ */

/* Layout 1 - Mobile */
@media (max-width: 1024px) {
    .cart-layout-1 .cart-layout {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .cart-layout-1 .cart-right {
        position: static;
    }
}

@media (max-width: 768px) {
    .cart-layout-1 .cart-item {
        grid-template-columns: 60px 1fr;
        gap: 12px;
    }

    .cart-layout-1 .item-image {
        width: 60px;
        height: 60px;
    }

    .cart-layout-1 .item-price-remove {
        grid-column: 2;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 8px;
    }
}

/* Layout 2 - Mobile */
@media (max-width: 768px) {
    .cart-layout-2 .cart-item {
        flex-direction: column;
    }

    .cart-layout-2 .item-image {
        width: 100%;
        height: 150px;
    }

    .cart-layout-2 .item-price-remove {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
    }
}

/* Layout 3 - Mobile */
@media (max-width: 1024px) {
    .cart-layout-3 .cart-layout {
        grid-template-columns: 1fr;
    }

    .cart-layout-3 .compact-summary {
        position: static;
    }
}

/* ============================================
   Loading State
   ============================================ */

.storedash-cart-widget.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* Use transform for better performance */
.cart-item,
.checkout-button,
.quantity-minus,
.quantity-plus {
    will-change: transform;
}

/* Reduce repaints */
.item-image img {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Title Divider Styling */
.storedash-cart-widget .left-panel-title,
.storedash-cart-widget .cart-totals-card .totals-title {
    display: flex;
    flex-direction: column;
    position: relative;
}

.storedash-cart-widget .left-panel-title::after,
.storedash-cart-widget .cart-totals-card .totals-title::after {
    content: '';
    display: block;
    margin-top: 10px;
    margin-bottom: 15px;
}

/* X Button Positioning - !important ensures Elementor editor preview updates correctly */

/* Base positioning for remove button - ensures consistent behavior */
.storedash-cart-widget .item-remove {
    position: relative;
    display: block;
}

.storedash-cart-widget.x-placement-left-top .item-remove {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
}

.storedash-cart-widget.x-placement-left-bottom .item-remove {
    position: absolute !important;
    left: 0 !important;
    bottom: 0 !important;
    right: auto !important;
    top: auto !important;
}

.storedash-cart-widget.x-placement-right-top .item-remove {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    left: auto !important;
    bottom: auto !important;
}

.storedash-cart-widget.x-placement-right-bottom .item-remove {
    position: absolute !important;
    right: 0 !important;
    bottom: 0 !important;
    left: auto !important;
    top: auto !important;
}

.storedash-cart-widget.x-placement-center-top .item-remove {
    position: absolute !important;
    left: 50% !important;
    top: 0 !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%);
}

.storedash-cart-widget.x-placement-center-bottom .item-remove {
    position: absolute !important;
    left: 50% !important;
    bottom: 0 !important;
    right: auto !important;
    top: auto !important;
    transform: translateX(-50%);
}

.storedash-cart-widget.x-placement-above-image .item-remove {
    position: absolute !important;
    left: 0 !important;
    top: -10px !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 2;
}

.storedash-cart-widget.x-placement-inline-price .item-remove {
    position: static !important;
    display: inline-block !important;
    margin-left: 12px;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
}

/* Quantity Button Styling */
.storedash-cart-widget .quantity-minus,
.storedash-cart-widget .quantity-plus {
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
    line-height: 1;
}

.storedash-cart-widget .quantity-minus:active,
.storedash-cart-widget .quantity-plus:active {
    transform: scale(0.95);
}

.storedash-cart-widget .qty {
    text-align: center;
    font-weight: 500;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Hide number input spinners globally for all cart layouts */
.storedash-cart-widget .qty::-webkit-inner-spin-button,
.storedash-cart-widget .qty::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Quantity label styling */
.storedash-cart-widget .item-quantity-label {
    display: block;
    font-size: 13px;
}

