/**
 * WC Quick Cart Styles
 * Universal modern design - works with any theme
 *
 * @package WC_Quick_Cart
 */

/* Wrapper */
.wc-quick-cart-wrapper {
    --wcqc-primary: #2ecc71;
    --wcqc-primary-hover: #27ae60;
    --wcqc-primary-active: #229954;
    --wcqc-radius: 8px;
    --wcqc-border: rgba(0, 0, 0, 0.12);
    --wcqc-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --wcqc-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --wcqc-focus: 0 0 0 3px rgba(46, 204, 113, 0.2);
    --wcqc-bg: #ffffff;
    --wcqc-text: #2c3e50;
    --wcqc-text-light: #7f8c8d;

    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.wc-quick-cart-wrapper,
.wc-quick-cart-wrapper * {
    box-sizing: border-box;
}

/* Quantity Selector */
.wc-quick-cart-qty {
    display: inline-flex;
    align-items: center;
    background: var(--wcqc-bg);
    border: 1.5px solid var(--wcqc-border);
    border-radius: var(--wcqc-radius);
    overflow: hidden;
    box-shadow: var(--wcqc-shadow);
    transition: all 0.2s ease;
}

.wc-quick-cart-qty:hover {
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: var(--wcqc-shadow-hover);
}

.wc-quick-cart-qty-btn {
    width: 36px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--wcqc-text);
    cursor: pointer;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wc-quick-cart-qty-btn:hover {
    background: rgba(46, 204, 113, 0.1);
    color: var(--wcqc-primary);
}

.wc-quick-cart-qty-btn:active {
    background: rgba(46, 204, 113, 0.2);
    transform: scale(0.95);
}

.wc-quick-cart-qty-btn:focus-visible {
    outline: none;
    box-shadow: inset var(--wcqc-focus);
}

.wc-quick-cart-qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.wc-quick-cart-qty-input {
    width: 50px;
    height: 40px;
    border: none;
    border-left: 1.5px solid var(--wcqc-border);
    border-right: 1.5px solid var(--wcqc-border);
    background: var(--wcqc-bg);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--wcqc-text);
    -moz-appearance: textfield;
    padding: 0;
    margin: 0;
    transition: all 0.15s ease;
}

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

.wc-quick-cart-qty-input:focus {
    outline: none;
    background: rgba(46, 204, 113, 0.05);
    color: var(--wcqc-primary);
}

.wc-quick-cart-qty-input:focus-visible {
    box-shadow: inset var(--wcqc-focus);
}

/* Add to Cart Button */
.wc-quick-cart-wrapper .wc-quick-cart-add-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    height: 40px;
    line-height: 1;
    font-family: inherit;
    text-decoration: none;
    -webkit-appearance: none;
    background: var(--wcqc-primary);
    color: #ffffff !important;
    border: none;
    border-radius: var(--wcqc-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: var(--wcqc-shadow);
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn:hover {
    background: var(--wcqc-primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--wcqc-shadow-hover);
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn:hover::before {
    opacity: 1;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn:active {
    transform: translateY(0);
    box-shadow: var(--wcqc-shadow);
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn:focus-visible {
    outline: none;
    box-shadow: var(--wcqc-focus), var(--wcqc-shadow);
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn.loading {
    pointer-events: none;
    background: var(--wcqc-primary);
}

.wc-quick-cart-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    position: relative;
}

.wcqc-icon {
    display: none;
    position: absolute;
}

.wcqc-icon-cart {
    display: block;
    position: static;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn.loading .wcqc-icon-cart,
.wc-quick-cart-wrapper .wc-quick-cart-add-btn.success .wcqc-icon-cart {
    display: none;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn.loading .wcqc-icon-spinner {
    display: block;
    animation: spin 0.6s linear infinite;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn.success .wcqc-icon-check {
    display: block;
    animation: checkmark-pop 0.3s ease;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn.success {
    background: #3498db;
}

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

@keyframes checkmark-pop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

/* Select Options / View Products Links */
.wc-quick-cart-select-options,
.wc-quick-cart-view-products {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    height: 40px;
    background: var(--wcqc-bg);
    color: var(--wcqc-text) !important;
    border: 1.5px solid var(--wcqc-border);
    border-radius: var(--wcqc-radius);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: var(--wcqc-shadow);
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.wc-quick-cart-select-options:hover,
.wc-quick-cart-view-products:hover {
    background: rgba(46, 204, 113, 0.08);
    color: var(--wcqc-primary) !important;
    border-color: var(--wcqc-primary);
    transform: translateY(-2px);
    box-shadow: var(--wcqc-shadow-hover);
}

.wc-quick-cart-select-options:active,
.wc-quick-cart-view-products:active {
    transform: translateY(0);
}

/* Toast Notification */
.wc-quick-cart-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 24px;
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border-radius: var(--wcqc-radius);
    font-size: 14px;
    font-weight: 500;
    z-index: 999999;
    animation: toast-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    max-width: min(90vw, 400px);
    text-align: center;
    line-height: 1.4;
}

.wc-quick-cart-toast.success {
    background: rgba(46, 204, 113, 0.95);
}

.wc-quick-cart-toast.error {
    background: rgba(231, 76, 60, 0.95);
}

.wc-quick-cart-toast.info {
    background: rgba(52, 152, 219, 0.95);
}

.wc-quick-cart-toast.hiding {
    animation: toast-slide-down 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toast-slide-up {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

@keyframes toast-slide-down {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }
}

/* Cart Count Animation */
.wc-quick-cart-bounce {
    animation: bounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.15); }
}

/* Accessibility & Motion Preferences */
@media (prefers-reduced-motion: reduce) {
    .wc-quick-cart-qty-btn,
    .wc-quick-cart-add-btn,
    .wc-quick-cart-toast,
    .wc-quick-cart-select-options,
    .wc-quick-cart-view-products {
        transition: none !important;
    }

    .wc-quick-cart-add-btn.loading .wcqc-icon-spinner,
    .wc-quick-cart-bounce,
    .wc-quick-cart-toast,
    .wc-quick-cart-toast.hiding,
    .wcqc-icon-check {
        animation: none !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wc-quick-cart-wrapper {
        gap: 8px;
        width: 100%;
    }

    .wc-quick-cart-qty {
        flex: 0 0 auto;
    }

    .wc-quick-cart-qty-btn {
        width: 40px;
        height: 44px;
        font-size: 22px;
    }

    .wc-quick-cart-qty-input {
        width: 55px;
        height: 44px;
        font-size: 16px;
    }

    .wc-quick-cart-add-btn {
        flex: 1 1 auto;
        min-width: 0;
        height: 44px;
        font-size: 15px;
        padding: 0 16px;
    }

    .wc-quick-cart-select-options,
    .wc-quick-cart-view-products {
        width: 100%;
        height: 44px;
        font-size: 15px;
    }

    .wc-quick-cart-toast {
        bottom: 20px;
        left: 15px;
        right: 15px;
        transform: none;
        max-width: none;
    }

    .wc-quick-cart-toast.hiding {
        animation: toast-fade-down 0.25s ease forwards;
    }

    @keyframes toast-fade-down {
        from { opacity: 1; transform: translateY(0); }
        to { opacity: 0; transform: translateY(20px); }
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .wc-quick-cart-wrapper {
        flex-direction: column;
        gap: 10px;
    }

    .wc-quick-cart-qty {
        width: 100%;
        justify-content: center;
    }

    .wc-quick-cart-add-btn {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .wc-quick-cart-wrapper {
        --wcqc-border: rgba(255, 255, 255, 0.15);
        --wcqc-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
        --wcqc-shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.5);
        --wcqc-focus: 0 0 0 3px rgba(46, 204, 113, 0.3);
        --wcqc-bg: rgba(255, 255, 255, 0.08);
        --wcqc-text: rgba(255, 255, 255, 0.95);
        --wcqc-text-light: rgba(255, 255, 255, 0.7);
    }

    .wc-quick-cart-qty {
        background: var(--wcqc-bg);
        border-color: var(--wcqc-border);
    }

    .wc-quick-cart-qty:hover {
        border-color: rgba(255, 255, 255, 0.25);
        background: rgba(255, 255, 255, 0.12);
    }

    .wc-quick-cart-qty-input {
        background: transparent;
        color: var(--wcqc-text);
        border-left-color: var(--wcqc-border);
        border-right-color: var(--wcqc-border);
    }

    .wc-quick-cart-qty-btn {
        color: var(--wcqc-text);
    }

    .wc-quick-cart-qty-btn:hover {
        background: rgba(46, 204, 113, 0.15);
        color: var(--wcqc-primary);
    }

    .wc-quick-cart-select-options,
    .wc-quick-cart-view-products {
        background: var(--wcqc-bg);
        color: var(--wcqc-text) !important;
        border-color: var(--wcqc-border);
    }
}

/* WooCommerce Theme Compatibility */
.woocommerce ul.products li.product .wc-quick-cart-wrapper {
    margin-top: 12px;
}

.woocommerce ul.products li.product .wc-quick-cart-add-btn {
    margin: 0;
}

/* Force override theme styles */
.wc-quick-cart-wrapper .wc-quick-cart-add-btn,
.wc-quick-cart-wrapper .wc-quick-cart-add-btn:visited {
    color: #ffffff !important;
    text-decoration: none !important;
}

.wc-quick-cart-wrapper .wc-quick-cart-add-btn:hover,
.wc-quick-cart-wrapper .wc-quick-cart-add-btn:focus {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Variation Selector Styles */
.wc-quick-cart-variation-wrapper {
    margin-top: 12px;
    padding: 16px;
    background: var(--wcqc-bg, #ffffff);
    border: 1.5px solid var(--wcqc-border, rgba(0, 0, 0, 0.12));
    border-radius: var(--wcqc-radius, 8px);
    box-shadow: var(--wcqc-shadow, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.wc-quick-cart-variation-selectors {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.wc-quick-cart-variation-select {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wc-quick-cart-variation-select label {
    font-size: 13px;
    font-weight: 600;
    color: var(--wcqc-text, #2c3e50);
}

.wc-quick-cart-variation-select select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--wcqc-border, rgba(0, 0, 0, 0.12));
    border-radius: 6px;
    background: var(--wcqc-bg, #ffffff);
    color: var(--wcqc-text, #2c3e50);
    font-size: 14px;
    transition: all 0.2s ease;
}

.wc-quick-cart-variation-select select:focus {
    outline: none;
    border-color: var(--wcqc-primary, #2ecc71);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.wc-quick-cart-variation-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin-bottom: 12px;
    border-top: 1px solid var(--wcqc-border, rgba(0, 0, 0, 0.08));
    border-bottom: 1px solid var(--wcqc-border, rgba(0, 0, 0, 0.08));
}

.wc-quick-cart-variation-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--wcqc-primary, #2ecc71);
}

.wc-quick-cart-variation-stock {
    font-size: 13px;
    font-weight: 600;
}

.wc-quick-cart-variation-stock .in-stock {
    color: #27ae60;
}

.wc-quick-cart-variation-stock .low-stock {
    color: #f39c12;
}

.wc-quick-cart-variation-stock .out-of-stock {
    color: #e74c3c;
}

/* Stock Info Styles */
.wc-quick-cart-stock-info {
    display: inline-block;
    padding: 4px 10px;
    margin-top: 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.wc-quick-cart-stock-info.in-stock {
    background: rgba(46, 204, 113, 0.1);
    color: #27ae60;
}

.wc-quick-cart-stock-info.low-stock {
    background: rgba(243, 156, 18, 0.1);
    color: #f39c12;
}

.wc-quick-cart-stock-info.out-of-stock {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

/* Cart Preview Modal */
.wc-quick-cart-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wc-quick-cart-preview-modal {
    background: var(--wcqc-bg, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    animation: modal-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modal-slide-up {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.wc-quick-cart-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1.5px solid var(--wcqc-border, rgba(0, 0, 0, 0.08));
}

.wc-quick-cart-preview-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--wcqc-text, #2c3e50);
}

.wc-quick-cart-preview-close {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--wcqc-text-light, #7f8c8d);
    transition: all 0.2s ease;
    border-radius: 6px;
}

.wc-quick-cart-preview-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--wcqc-text, #2c3e50);
}

.wc-quick-cart-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    position: relative;
}

.wc-quick-cart-preview-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.wc-quick-cart-spinner {
    animation: spin 0.6s linear infinite;
    color: var(--wcqc-primary, #2ecc71);
}

.wc-quick-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--wcqc-text-light, #7f8c8d);
    font-size: 15px;
}

.wc-quick-cart-items {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wc-quick-cart-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.wc-quick-cart-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.wc-quick-cart-item-image {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: 6px;
    overflow: hidden;
}

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

.wc-quick-cart-item-details {
    flex: 1;
    min-width: 0;
}

.wc-quick-cart-item-details h4 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--wcqc-text, #2c3e50);
}

.wc-quick-cart-item-variation {
    font-size: 12px;
    color: var(--wcqc-text-light, #7f8c8d);
    margin-bottom: 6px;
}

.wc-quick-cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--wcqc-primary, #2ecc71);
}

.wc-quick-cart-item-remove {
    flex-shrink: 0;
}

.wc-quick-cart-remove-item {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--wcqc-text-light, #7f8c8d);
    transition: all 0.2s ease;
    border-radius: 4px;
}

.wc-quick-cart-remove-item:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.wc-quick-cart-preview-footer {
    padding: 20px 24px;
    border-top: 1.5px solid var(--wcqc-border, rgba(0, 0, 0, 0.08));
}

.wc-quick-cart-preview-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 16px;
}

.wc-quick-cart-preview-total-amount {
    font-size: 20px;
    font-weight: 700;
    color: var(--wcqc-primary, #2ecc71);
}

.wc-quick-cart-preview-actions {
    display: flex;
    gap: 10px;
}

.wc-quick-cart-preview-actions .button {
    flex: 1;
    padding: 12px 20px;
    text-align: center;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.wc-quick-cart-view-cart {
    background: rgba(0, 0, 0, 0.05);
    color: var(--wcqc-text, #2c3e50) !important;
    border: 1.5px solid var(--wcqc-border, rgba(0, 0, 0, 0.12));
}

.wc-quick-cart-view-cart:hover {
    background: rgba(0, 0, 0, 0.08);
}

.wc-quick-cart-checkout {
    background: var(--wcqc-primary, #2ecc71);
    color: #ffffff !important;
    border: none;
}

.wc-quick-cart-checkout:hover {
    background: var(--wcqc-primary-hover, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

@media (max-width: 768px) {
    .wc-quick-cart-preview-modal {
        max-height: 90vh;
    }

    .wc-quick-cart-variation-wrapper {
        padding: 12px;
    }

    .wc-quick-cart-preview-actions {
        flex-direction: column;
    }
}
