/**
 * WC Elementor Cart Widget - Estilos
 */

/* Reset e variáveis */
.wcecw-cart-widget {
    --wcecw-transition: 0.25s ease;
    --wcecw-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    --wcecw-overlay-bg: rgba(0, 0, 0, 0.4);
    position: relative;
    display: inline-block;
}

.wcecw-cart-widget * {
    box-sizing: border-box;
}

/* Trigger Button */
.wcecw-cart-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    position: relative;
    transition: transform var(--wcecw-transition);
}

.wcecw-cart-trigger:hover {
    transform: scale(1.05);
}

.wcecw-cart-trigger:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.wcecw-cart-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.wcecw-cart-icon svg {
    display: block;
}

/* Cart Count Badge */
.wcecw-cart-count {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    border-radius: 50px;
    transform: translate(25%, -25%);
}

.wcecw-cart-count:empty,
.wcecw-cart-count:contains("0") {
    display: none;
}

/* Subtotal */
.wcecw-cart-subtotal {
    font-size: 14px;
    font-weight: 500;
}

/* Modal Overlay */
.wcecw-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s linear 0.3s, opacity var(--wcecw-transition);
}

.wcecw-modal.is-open {
    visibility: visible;
    opacity: 1;
    transition-delay: 0s;
}

.wcecw-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--wcecw-overlay-bg);
    backdrop-filter: blur(2px);
}

/* Modal Content */
.wcecw-modal-content {
    position: absolute;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    background: #fff;
    box-shadow: var(--wcecw-shadow);
    transform: translateX(100%);
    transition: transform var(--wcecw-transition);
}

.wcecw-modal.is-open .wcecw-modal-content {
    transform: translateX(0);
}

/* Modal Positions */
.wcecw-modal-right .wcecw-modal-content {
    right: 0;
    border-radius: 0;
}

.wcecw-modal-left .wcecw-modal-content {
    left: 0;
    right: auto;
    transform: translateX(-100%);
}

.wcecw-modal-left.wcecw-modal.is-open .wcecw-modal-content {
    transform: translateX(0);
}

.wcecw-modal-center .wcecw-modal-content {
    top: 50%;
    left: 50%;
    right: auto;
    height: auto;
    max-height: 90vh;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    border-radius: 12px;
}

.wcecw-modal-center.wcecw-modal.is-open .wcecw-modal-content {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Modal Header */
.wcecw-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.wcecw-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

.wcecw-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--wcecw-transition), transform var(--wcecw-transition);
}

.wcecw-modal-close:hover {
    background: #e8e8e8;
    transform: rotate(90deg);
}

.wcecw-modal-close:focus {
    outline: 2px solid #333;
    outline-offset: 2px;
}

/* Modal Body */
.wcecw-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    overscroll-behavior: contain;
}

/* Empty Cart - Sofisticado */
.wcecw-empty-cart {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    padding: 40px 20px;
    text-align: center;
}

.wcecw-empty-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    opacity: 0.2;
}

.wcecw-empty-icon svg {
    width: 100%;
    height: 100%;
    stroke: #1a1a1a;
}

.wcecw-empty-title {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -0.02em;
    color: #1a1a1a;
}

.wcecw-empty-highlight {
    display: block;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    max-width: 280px;
}

.wcecw-empty-suggestion {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #666;
}

.wcecw-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: #1a1a1a;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    border-radius: 6px;
    transition: all var(--wcecw-transition);
}

.wcecw-empty-cta:hover {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcecw-empty-cta svg {
    width: 16px;
    height: 16px;
    transition: transform var(--wcecw-transition);
}

.wcecw-empty-cta:hover svg {
    transform: translateX(3px);
}

/* Cart Items */
.wcecw-cart-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wcecw-cart-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: #fafafa;
    border-radius: 8px;
    position: relative;
    transition: background var(--wcecw-transition);
}

.wcecw-cart-item:hover {
    background: #f5f5f5;
}

.wcecw-cart-item.is-updating {
    opacity: 0.5;
    pointer-events: none;
}

.wcecw-cart-item.is-removing {
    animation: wcecw-slide-out 0.3s ease forwards;
}

@keyframes wcecw-slide-out {
    to {
        opacity: 0;
        transform: translateX(20px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* Item Image */
.wcecw-item-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
}

.wcecw-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wcecw-item-image a {
    display: block;
}

/* Item Details */
.wcecw-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcecw-item-name {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--wcecw-transition);
}

.wcecw-item-name:hover {
    color: #666;
}

.wcecw-item-price {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

/* Quantity Controls */
.wcecw-item-quantity {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-top: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    width: fit-content;
}

.wcecw-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    color: #666;
    transition: background var(--wcecw-transition), color var(--wcecw-transition);
}

.wcecw-qty-btn:hover {
    background: #f5f5f5;
    color: #1a1a1a;
}

.wcecw-qty-btn:focus {
    outline: none;
    background: #eee;
}

.wcecw-qty-input {
    width: 40px;
    height: 32px;
    padding: 0;
    border: none;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    -moz-appearance: textfield;
}

.wcecw-qty-input::-webkit-outer-spin-button,
.wcecw-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wcecw-qty-input:focus {
    outline: none;
}

/* Remove Button */
.wcecw-item-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #999;
    border-radius: 50%;
    transition: background var(--wcecw-transition), color var(--wcecw-transition);
}

.wcecw-item-remove:hover {
    background: #fee;
    color: #e74c3c;
}

.wcecw-item-remove:focus {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

/* Modal Footer */
.wcecw-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    background: #fff;
}

/* Cart Totals */
.wcecw-cart-totals {
    margin-bottom: 16px;
}

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

.wcecw-subtotal-label {
    font-weight: 500;
    color: #666;
}

.wcecw-subtotal-value {
    font-weight: 700;
    font-size: 18px;
    color: #1a1a1a;
}

/* Cart Buttons */
.wcecw-cart-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wcecw-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 24px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--wcecw-transition);
}

.wcecw-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wcecw-btn:active {
    transform: translateY(0);
}

.wcecw-btn-checkout {
    background: #1a1a1a;
    color: #fff;
}

.wcecw-btn-checkout:hover {
    background: #333;
}

.wcecw-btn-cart {
    background: #f5f5f5;
    color: #1a1a1a;
}

.wcecw-btn-cart:hover {
    background: #eee;
}

/* Loading State */
.wcecw-cart-widget.is-loading .wcecw-cart-items {
    opacity: 0.5;
    pointer-events: none;
}

.wcecw-loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wcecw-loading-spinner::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 2px solid #e0e0e0;
    border-top-color: #1a1a1a;
    border-radius: 50%;
    animation: wcecw-spin 0.8s linear infinite;
}

@keyframes wcecw-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Added to cart animation */
.wcecw-cart-trigger.is-bouncing {
    animation: wcecw-bounce 0.5s ease;
}

@keyframes wcecw-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .wcecw-modal-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    .wcecw-modal-center .wcecw-modal-content {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 85vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }

    .wcecw-modal-center.wcecw-modal.is-open .wcecw-modal-content {
        transform: translateY(0);
    }

    .wcecw-modal-header {
        padding: 16px 20px;
    }

    .wcecw-modal-body {
        padding: 12px 20px;
    }

    .wcecw-modal-footer {
        padding: 16px 20px;
    }

    .wcecw-cart-item {
        padding: 12px;
        gap: 12px;
    }

    .wcecw-item-image {
        width: 60px;
        height: 60px;
    }

    .wcecw-empty-cart {
        min-height: 300px;
        padding: 32px 16px;
    }

    .wcecw-empty-title {
        font-size: 16px;
    }

    .wcecw-empty-cta {
        width: 100%;
        justify-content: center;
    }
}

/* Hide when empty - optional class */
.wcecw-hide-empty .wcecw-cart-count[data-count="0"] {
    display: none;
}

/* Print styles */
@media print {
    .wcecw-modal {
        display: none !important;
    }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .wcecw-cart-widget,
    .wcecw-cart-widget * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
