/**
 * WooCart Pro Styles
 */

:root {
    --woocart-primary: #7c3aed;
    --woocart-primary-hover: #6d28d9;
}

/* ==========================================
   Overlay
   ========================================== */
.woocart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.woocart-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ==========================================
   Side Cart
   ========================================== */
.woocart-side-cart {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    max-width: 420px;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.woocart-side-cart.open {
    transform: translateX(0);
}

/* Header */
.woocart-side-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #f1f1f1;
}

.woocart-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.woocart-header-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: #f3e8ff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.woocart-header-icon i {
    color: var(--woocart-primary);
    font-size: 1rem;
}

.woocart-side-cart-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.woocart-side-cart-header p {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.woocart-close-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.woocart-close-btn:hover {
    background: #f3f4f6;
}

.woocart-close-btn i {
    color: #6b7280;
    font-size: 1rem;
}

/* Shipping Progress */
.woocart-shipping-progress {
    padding: 1rem 1.5rem;
    background: linear-gradient(to right, #f3e8ff, #fae8ff);
}

.woocart-shipping-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.woocart-shipping-text span:first-child {
    color: #6b7280;
}

.woocart-shipping-remaining {
    font-weight: 500;
    color: var(--woocart-primary);
}

.woocart-progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.woocart-progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--woocart-primary), #a855f7);
    border-radius: 9999px;
    transition: width 0.5s ease;
}

/* Cart Items */
.woocart-side-cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.woocart-side-cart-items::-webkit-scrollbar {
    width: 6px;
}

.woocart-side-cart-items::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.woocart-side-cart-items::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.woocart-cart-item {
    display: flex;
    gap: 1rem;
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.75rem;
}

.woocart-item-image {
    flex-shrink: 0;
}

.woocart-item-image img {
    width: 5rem;
    height: 5rem;
    object-fit: cover;
    border-radius: 0.5rem;
}

.woocart-item-details {
    flex: 1;
    min-width: 0;
}

.woocart-item-details h4 {
    margin: 0 0 0.25rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woocart-item-price {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
    color: var(--woocart-primary);
}

.woocart-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.woocart-qty-btn {
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.woocart-qty-btn:hover {
    background: #f3f4f6;
}

.woocart-qty-btn i {
    font-size: 0.625rem;
    color: #4b5563;
}

.woocart-qty-value {
    width: 2rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
}

.woocart-remove-item {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    padding: 0.25rem;
    transition: color 0.2s;
    align-self: flex-start;
}

.woocart-remove-item:hover {
    color: #ef4444;
}

/* Empty Cart */
.woocart-empty-cart {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.woocart-empty-cart.hidden {
    display: none;
}

.woocart-empty-icon {
    width: 5rem;
    height: 5rem;
    background: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.woocart-empty-icon i {
    font-size: 2rem;
    color: #d1d5db;
}

.woocart-empty-cart h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.woocart-empty-cart p {
    margin: 0 0 1rem 0;
    color: #6b7280;
}

.woocart-browse-btn {
    color: var(--woocart-primary);
    font-weight: 500;
    text-decoration: none;
}

.woocart-browse-btn:hover {
    text-decoration: underline;
}

/* Footer */
.woocart-side-cart-footer {
    padding: 1.5rem;
    border-top: 1px solid #f1f1f1;
}

.woocart-side-cart-footer.hidden {
    display: none;
}

.woocart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.woocart-subtotal span:first-child {
    color: #6b7280;
}

.woocart-subtotal-amount {
    font-weight: 600;
    color: #1f2937;
}

.woocart-shipping-note {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1rem 0;
}

.woocart-view-cart-btn,
.woocart-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.woocart-view-cart-btn {
    background: var(--woocart-primary);
    color: #fff;
}

.woocart-view-cart-btn:hover {
    background: var(--woocart-primary-hover);
    color: #fff;
}

.woocart-checkout-btn {
    background: #111827;
    color: #fff;
}

.woocart-checkout-btn:hover {
    background: #1f2937;
    color: #fff;
}

.woocart-continue-btn {
    width: 100%;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s;
}

.woocart-continue-btn:hover {
    color: var(--woocart-primary);
}

/* ==========================================
   Success Popup
   ========================================== */
.woocart-success-popup {
    position: fixed;
    top: 6rem;
    right: 1rem;
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    z-index: 99999;
    overflow: hidden;
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease-in-out;
}

.woocart-success-popup.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.woocart-popup-content {
    padding: 1.5rem;
}

.woocart-popup-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.woocart-checkmark {
    flex-shrink: 0;
}

.woocart-checkmark svg {
    width: 3rem;
    height: 3rem;
}

.woocart-checkmark-circle {
    animation: woocart-scale-in 0.3s ease-in-out;
}

@keyframes woocart-scale-in {
    0% { transform: scale(0); transform-origin: center; }
    50% { transform: scale(1.2); transform-origin: center; }
    100% { transform: scale(1); transform-origin: center; }
}

.woocart-checkmark-path {
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: woocart-draw-check 0.4s ease-in-out 0.2s forwards;
}

@keyframes woocart-draw-check {
    to { stroke-dashoffset: 0; }
}

.woocart-popup-product {
    flex: 1;
}

.woocart-popup-product h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.woocart-popup-product-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.woocart-popup-product-info img {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: cover;
    border-radius: 0.5rem;
}

#woocart-popup-name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1f2937;
}

#woocart-popup-price {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--woocart-primary);
}

.woocart-popup-close {
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    padding: 0.25rem;
    transition: color 0.2s;
}

.woocart-popup-close:hover {
    color: #4b5563;
}

.woocart-popup-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.woocart-popup-continue,
.woocart-popup-view-cart {
    flex: 1;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.woocart-popup-continue {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #374151;
}

.woocart-popup-continue:hover {
    background: #f9fafb;
}

.woocart-popup-view-cart {
    background: var(--woocart-primary);
    border: none;
    color: #fff;
}

.woocart-popup-view-cart:hover {
    background: var(--woocart-primary-hover);
}

.woocart-popup-progress {
    height: 4px;
    background: #f3f4f6;
}

#woocart-popup-progress-bar {
    height: 100%;
    background: var(--woocart-primary);
    width: 100%;
    transition: width 0.1s linear;
}

/* ==========================================
   Cart Icon (for header)
   ========================================== */
.woocart-cart-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    cursor: pointer;
    border: none;
    background: transparent;
    transition: background 0.2s;
    border-radius: 50%;
}

.woocart-cart-icon:hover {
    background: #f3f4f6;
}

.woocart-cart-icon i {
    font-size: 1.25rem;
    color: #374151;
}

.woocart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 1.25rem;
    height: 1.25rem;
    background: var(--woocart-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.25rem;
}

/* ==========================================
   Add to Cart Button Override
   ========================================== */
.woocart-add-to-cart {
    position: relative;
}

.woocart-add-to-cart.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: woocart-spin 0.6s linear infinite;
}

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

/* ==========================================
   Responsive
   ========================================== */
@media (max-width: 480px) {
    .woocart-success-popup {
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
        width: auto;
    }
    
    .woocart-side-cart {
        max-width: 100%;
    }
}
