/**
 * WooCommerce Hover Actions - Styles
 * Modern Design Quick View Popup
 */

/* ═══════════════════════════════════════════════════════════════
   CSS VARIABLES
   ═══════════════════════════════════════════════════════════════ */
:root {
    --wha-primary: #c9a96e;
    --wha-primary-dark: #b8954d;
    --wha-primary-light: #e0c89a;
    --wha-text: #333333;
    --wha-text-light: #666666;
    --wha-text-muted: #999999;
    --wha-border: #e5e5e5;
    --wha-bg: #ffffff;
    --wha-bg-light: #fafafa;
    --wha-bg-dark: #f0f0f0;
    --wha-success: #22c55e;
    --wha-error: #ef4444;
    --wha-warning: #f59e0b;
    --wha-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --wha-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --wha-radius: 16px;
    --wha-radius-sm: 8px;
    --wha-icon-spacing: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL OVERLAY
   ═══════════════════════════════════════════════════════════════ */
#wha-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#wha-modal-overlay.wha-active {
    opacity: 1;
    visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL CONTAINER
   ═══════════════════════════════════════════════════════════════ */
#wha-modal-content {
    background: var(--wha-bg);
    border-radius: var(--wha-radius);
    max-width: 960px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--wha-shadow);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

#wha-modal-overlay.wha-active #wha-modal-content {
    transform: scale(1) translateY(0);
}

/* Close Button */
.wha-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: var(--wha-shadow-sm);
}

.wha-modal-close:hover {
    background: var(--wha-primary);
    transform: rotate(90deg);
}

.wha-modal-close svg {
    width: 20px;
    height: 20px;
    stroke: var(--wha-text);
    transition: stroke 0.2s ease;
}

.wha-modal-close:hover svg {
    stroke: white;
}

/* ═══════════════════════════════════════════════════════════════
   QUICK VIEW LAYOUT - 2 Columns
   ═══════════════════════════════════════════════════════════════ */
.wha-qv-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
}

/* Gallery Section - Left */
.wha-qv-gallery {
    background: var(--wha-bg-light);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

/* Main Image */
.wha-qv-main-img-wrap {
    position: relative;
    border-radius: var(--wha-radius-sm);
    overflow: hidden;
    background: white;
    aspect-ratio: 1;
    box-shadow: var(--wha-shadow-sm);
}

.wha-qv-main-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* Sale Badge */
.wha-qv-sale-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: linear-gradient(135deg, var(--wha-primary), var(--wha-primary-dark));
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    z-index: 5;
    box-shadow: 0 4px 12px rgba(201, 169, 110, 0.4);
}

/* Thumbnails */
.wha-qv-thumbs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--wha-primary) var(--wha-bg-light);
}

.wha-qv-thumbs::-webkit-scrollbar {
    height: 6px;
}

.wha-qv-thumbs::-webkit-scrollbar-track {
    background: var(--wha-bg-light);
    border-radius: 3px;
}

.wha-qv-thumbs::-webkit-scrollbar-thumb {
    background: var(--wha-primary);
    border-radius: 3px;
}

.wha-qv-thumb {
    flex-shrink: 0;
    width: 70px;
    height: 70px;
    border-radius: var(--wha-radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    opacity: 0.7;
}

.wha-qv-thumb:hover {
    opacity: 1;
    border-color: var(--wha-primary-light);
}

.wha-qv-thumb.active {
    opacity: 1;
    border-color: var(--wha-primary);
    box-shadow: 0 0 0 2px var(--wha-primary-light);
}

.wha-qv-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Details Section - Right */
.wha-qv-details {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    max-height: 90vh;
}

/* Product Title */
.wha-qv-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wha-text);
    margin: 0;
    line-height: 1.3;
}

/* SKU */
.wha-qv-sku {
    font-size: 13px;
    color: var(--wha-text-muted);
    margin-top: -12px;
}

/* Price */
.wha-qv-price-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wha-qv-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--wha-primary-dark);
}

.wha-qv-price del {
    font-size: 18px;
    color: var(--wha-text-muted);
    font-weight: 400;
    margin-right: 8px;
}

.wha-qv-price ins {
    text-decoration: none;
}

/* Rating */
.wha-qv-rating {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wha-qv-stars {
    display: flex;
    gap: 2px;
}

.wha-qv-stars svg {
    width: 16px;
    height: 16px;
    fill: var(--wha-primary);
    stroke: none;
}

.wha-qv-stars svg.empty {
    fill: var(--wha-border);
}

.wha-qv-rating-count {
    font-size: 13px;
    color: var(--wha-text-light);
}

/* Stock Status */
.wha-qv-stock {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 50px;
    width: fit-content;
}

.wha-qv-stock.in-stock {
    background: rgba(34, 197, 94, 0.1);
    color: var(--wha-success);
}

.wha-qv-stock.out-of-stock {
    background: rgba(239, 68, 68, 0.1);
    color: var(--wha-error);
}

.wha-qv-stock .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Short Description */
.wha-qv-desc {
    font-size: 14px;
    line-height: 1.7;
    color: var(--wha-text-light);
    border-top: 1px solid var(--wha-border);
    padding-top: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   ADD TO CART FORM
   ═══════════════════════════════════════════════════════════════ */
.wha-qv-cart-form {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--wha-border);
}

/* Quantity */
.wha-qv-qty-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.wha-qv-qty-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--wha-text);
}

.wha-qty-control {
    display: flex;
    align-items: center;
    background: var(--wha-bg-light);
    border-radius: var(--wha-radius-sm);
    overflow: hidden;
    border: 1px solid var(--wha-border);
}

.wha-qty-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--wha-text);
}

.wha-qty-btn:hover {
    background: var(--wha-primary);
    color: white;
}

.wha-qty-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.wha-qty-input {
    width: 50px;
    height: 40px;
    border: none;
    background: transparent;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--wha-text);
    -moz-appearance: textfield;
}

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

/* Add to Cart Button */
.wha-qv-addtocart-btn {
    width: 100%;
    height: 52px;
    border: none;
    border-radius: var(--wha-radius-sm);
    background: linear-gradient(135deg, var(--wha-primary), var(--wha-primary-dark));
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(201, 169, 110, 0.4);
}

.wha-qv-addtocart-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(201, 169, 110, 0.5);
}

.wha-qv-addtocart-btn:active:not(:disabled) {
    transform: translateY(0);
}

.wha-qv-addtocart-btn:disabled {
    background: var(--wha-border);
    color: var(--wha-text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

.wha-qv-addtocart-btn.wha-loading {
    pointer-events: none;
}

.wha-qv-addtocart-btn.wha-added {
    background: var(--wha-success);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}

.wha-qv-addtocart-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
}

.wha-qv-addtocart-btn .wha-spin {
    animation: wha-spin 0.7s linear infinite;
}

@keyframes wha-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* View Details Link */
.wha-qv-view-details {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 14px;
    color: var(--wha-text-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.wha-qv-view-details:hover {
    color: var(--wha-primary-dark);
}

/* ═══════════════════════════════════════════════════════════════
   VARIATION SELECTORS (for variable products)
   ═══════════════════════════════════════════════════════════════ */
.wha-qv-variations {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 16px;
}

.wha-qv-var-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wha-qv-var-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--wha-text);
}

.wha-qv-var-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wha-qv-var-option {
    padding: 8px 16px;
    border: 1px solid var(--wha-border);
    border-radius: var(--wha-radius-sm);
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.wha-qv-var-option:hover {
    border-color: var(--wha-primary);
}

.wha-qv-var-option.selected {
    border-color: var(--wha-primary);
    background: var(--wha-primary);
    color: white;
}

/* ═══════════════════════════════════════════════════════════════
   LOADING STATE
   ═══════════════════════════════════════════════════════════════ */
.wha-modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 20px;
    color: var(--wha-text-light);
}

.wha-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--wha-border);
    border-top-color: var(--wha-primary);
    border-radius: 50%;
    animation: wha-spin 0.8s linear infinite;
}

.wha-modal-loading span {
    font-size: 14px;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════════════════════════ */
#wha-cart-toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: white;
    padding: 16px 24px;
    border-radius: var(--wha-radius-sm);
    box-shadow: var(--wha-shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100001;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 4px solid var(--wha-success);
}

#wha-cart-toast.wha-toast-show {
    transform: translateY(0);
    opacity: 1;
}

#wha-cart-toast.wha-toast-wishlist {
    border-left-color: #e94560;
}

#wha-cart-toast.wha-toast-compare {
    border-left-color: #3b82f6;
}

#wha-cart-toast svg {
    width: 24px;
    height: 24px;
    stroke: var(--wha-success);
    fill: none;
    flex-shrink: 0;
}

#wha-cart-toast .wha-toast-msg {
    font-size: 14px;
    font-weight: 500;
    color: var(--wha-text);
}

/* ═══════════════════════════════════════════════════════════════
   COMPARE BAR
   ═══════════════════════════════════════════════════════════════ */
#wha-compare-bar {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 16px 24px;
    border-radius: var(--wha-radius);
    box-shadow: var(--wha-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100000;
    transition: bottom 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#wha-compare-bar.wha-visible {
    bottom: 30px;
}

.wha-compare-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wha-compare-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--wha-text);
}

.wha-compare-limit {
    font-size: 14px;
    color: var(--wha-text-muted);
}

.wha-compare-btn-group {
    display: flex;
    gap: 8px;
}

.wha-compare-view-btn,
.wha-compare-clear-btn {
    padding: 10px 20px;
    border-radius: var(--wha-radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wha-compare-view-btn {
    background: linear-gradient(135deg, var(--wha-primary), var(--wha-primary-dark));
    color: white;
    border: none;
}

.wha-compare-view-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wha-compare-clear-btn {
    background: transparent;
    color: var(--wha-text-light);
    border: 1px solid var(--wha-border);
}

.wha-compare-clear-btn:hover {
    border-color: var(--wha-error);
    color: var(--wha-error);
}

.wha-compare-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--wha-text-muted);
    transition: color 0.2s ease;
}

.wha-compare-close:hover {
    color: var(--wha-text);
}

/* ═══════════════════════════════════════════════════════════════
   HOVER ACTION BUTTONS
   ═══════════════════════════════════════════════════════════════ */
.wha-actions-wrapper {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: var(--wha-icon-spacing);
    z-index: 20;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wha-pos-right {
    right: 12px;
    top: 50%;
    transform: translateY(-50%) translateX(10px);
}

.wha-pos-left {
    left: 12px;
    top: 50%;
    transform: translateY(-50%) translateX(-10px);
}

.wha-pos-bottom {
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
}

.wha-anim-fade .wha-actions-wrapper {
    opacity: 0;
}

.wha-anim-fade:hover .wha-actions-wrapper,
.wha-actions-wrapper:hover {
    opacity: 1;
}

.wha-anim-fade:hover .wha-pos-right,
.wha-pos-right:hover { transform: translateY(-50%) translateX(0); }
.wha-anim-fade:hover .wha-pos-left,
.wha-pos-left:hover { transform: translateY(-50%) translateX(0); }
.wha-anim-fade:hover .wha-pos-bottom,
.wha-pos-bottom:hover { transform: translateX(-50%) translateY(0); }

.wha-anim-slide .wha-actions-wrapper {
    opacity: 1;
}

.wha-anim-slide .wha-pos-right { transform: translateY(-50%) translateX(20px); }
.wha-anim-slide .wha-pos-left { transform: translateY(-50%) translateX(-20px); }
.wha-anim-slide .wha-pos-bottom { transform: translateX(-50%) translateY(20px); }
.wha-anim-slide:hover .wha-pos-right { transform: translateY(-50%) translateX(0); }
.wha-anim-slide:hover .wha-pos-left { transform: translateY(-50%) translateX(0); }
.wha-anim-slide:hover .wha-pos-bottom { transform: translateX(-50%) translateY(0); }

.wha-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.wha-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.wha-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--wha-icon-color, #333);
    fill: none;
}

.wha-btn:hover svg {
    stroke: var(--wha-icon-hover, var(--wha-primary));
}

.wha-btn.wha-wishlist-btn.active svg {
    fill: #e94560;
    stroke: #e94560;
}

.wha-btn.wha-wishlist-btn.animate-heart {
    animation: wha-heart-beat 0.4s ease;
}

@keyframes wha-heart-beat {
    0%, 100% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1); }
    75% { transform: scale(1.2); }
}

.wha-btn.wha-compare-btn.active svg {
    stroke: #3b82f6;
}

.wha-btn.wha-compare-btn.wha-limit-reached {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tooltip */
.wha-tooltip {
    position: absolute;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.wha-pos-right .wha-tooltip { right: 50px; top: 50%; transform: translateY(-50%); }
.wha-pos-left .wha-tooltip { left: 50px; top: 50%; transform: translateY(-50%); }
.wha-pos-bottom .wha-tooltip { bottom: 50px; left: 50%; transform: translateX(-50%); }

.wha-btn:hover .wha-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Size Classes */
.wha-size-small .wha-btn { width: 32px; height: 32px; }
.wha-size-small .wha-btn svg { width: 14px; height: 14px; }

.wha-size-large .wha-btn { width: 48px; height: 48px; }
.wha-size-large .wha-btn svg { width: 22px; height: 22px; }

/* Added State Animation */
.wha-btn.wha-added {
    background: var(--wha-success);
}

.wha-btn.wha-added svg {
    stroke: white;
    fill: none;
}

/* Loading State */
.wha-btn.wha-loading {
    pointer-events: none;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════
   FLATSOME THEME INTEGRATION
   ═══════════════════════════════════════════════════════════════ */
.image-tools.top.right .wha-actions-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    left: auto;
    bottom: auto;
    transform: none !important;
    flex-direction: row;
}

.image-tools.top.right .wha-tools-host .wha-actions-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    :root {
        --wha-radius: 12px;
        --wha-radius-sm: 8px;
    }
    
    #wha-modal-overlay {
        padding: 10px;
        align-items: flex-end;
    }
    
    #wha-modal-content {
        max-height: 95vh;
        border-radius: var(--wha-radius) var(--wha-radius) 0 0;
        transform: translateY(100%);
    }
    
    #wha-modal-overlay.wha-active #wha-modal-content {
        transform: translateY(0);
    }
    
    .wha-qv-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .wha-qv-gallery {
        padding: 20px;
    }
    
    .wha-qv-main-img-wrap {
        max-height: 300px;
    }
    
    .wha-qv-thumb {
        width: 60px;
        height: 60px;
    }
    
    .wha-qv-details {
        padding: 20px;
    }
    
    .wha-qv-title {
        font-size: 20px;
    }
    
    .wha-qv-price {
        font-size: 24px;
    }
    
    .wha-modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    #wha-cart-toast {
        left: 20px;
        right: 20px;
        bottom: 20px;
    }
    
    #wha-compare-bar {
        left: 20px;
        right: 20px;
        transform: none;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .wha-btn {
        width: 36px;
        height: 36px;
    }
    
    .wha-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .wha-qv-thumb {
        width: 50px;
        height: 50px;
    }
    
    .wha-qty-control {
        width: 100%;
    }
    
    .wha-qty-input {
        flex: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ADDITIONAL UTILITIES
   ═══════════════════════════════════════════════════════════════ */
.wha-hidden {
    display: none !important;
}

.wha-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
