﻿/* ============================================
   WISHLIST UNIFIED STYLES
   Enterprise-Grade Design System for GroKarna
   Consolidated from 3 separate CSS files
   ============================================ */



/* ========== 1. WISHLIST PAGE OPTIMIZED ========== */
/* Source: wishlist-page-optimized.css */

/**
 * Optimized Wishlist Page Styles
 * High-performance CSS with minimal reflows and optimized animations
 */

/* Critical CSS - Load immediately */
.grokarna-wishlist-page-optimized {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    contain: layout style;
}

.wishlist-header {
    text-align: center;
    margin-bottom: 40px;
}

.wishlist-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #333;
    font-weight: 700;
}

.wishlist-header p {
    font-size: 1.1rem;
    color: #666;
    margin: 0;
}

/* Optimized loading state */
.wishlist-loading-optimized {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    will-change: opacity;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Optimized grid layout with CSS Grid - Match products page */
.wishlist-products-grid-optimized {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    list-style: none;
    padding: 0;
    margin: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    contain: layout;
}

.wishlist-products-grid-optimized.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Product card optimizations - Match products page styling */
.wishlist-product-card {
    position: relative;
    background: white;
    border-radius: 18px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    contain: layout style;
    will-change: transform;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
    padding: 0;
}

.wishlist-product-card:hover {
    transform: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    z-index: 5;
}

/* Remove button optimization */
.wishlist-product-card .remove-wishlist-heart {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    will-change: transform;
}

.wishlist-product-card .remove-wishlist-heart:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.wishlist-product-card .remove-wishlist-heart .heart-icon {
    font-size: 18px;
    line-height: 1;
    color: #e74c3c;
}

/* Product image optimization — CONTAIN the product photo on a light background
   so non-square images (e.g. the ghee jar) are shown in full rather than being
   scaled-up and cropped (`object-fit:cover`). Higher-specificity + !important so
   the shared `.shop-product-card .shop-product-image img` cover rule in style.css
   can never re-crop the wishlist image. */
.wishlist-product-card .shop-product-image {
    position: relative;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    height: 220px;
    max-height: 220px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.wishlist-product-card .shop-product-image img {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    object-fit: contain !important;
    transition: transform 0.35s ease;
    transform: none !important;
}

.wishlist-product-card:hover .shop-product-image img {
    transform: none !important;
}

/* Badge optimization */
.wishlist-product-card .product-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
}

.wishlist-product-card .badge {
    display: inline-block;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 0.6875rem;
    font-weight: bold;
    margin-right: 3px;
    margin-bottom: 3px;
}

.wishlist-product-card .badge-organic {
    background: #66CC66;
    color: white;
}

.wishlist-product-card .badge-off {
    background: #ff6b35;
    color: white;
}

/* Product info optimization - Match products page padding */
.wishlist-product-card .shop-product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.wishlist-product-card .gk-product-title {
    margin: 0 0 4px 0;
    padding: 0;
    line-height: 1.35;
    min-height: 40px;
}

.wishlist-product-card .gk-product-title .en {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 600;
    color: #111827;
    font-size: 15px;
    margin: 0;
    text-align: left;
    line-height: 1.35;
}

.wishlist-product-card .gk-product-title .kn {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    margin: 2px 0 0 0;
    line-height: 1.3;
    display: block;
}

.wishlist-product-card .product-meta-row {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
}

.wishlist-product-card .product-rating {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 2px;
}

.wishlist-product-card .product-local {
    font-size: 0.75rem;
    color: #666;
}

/* Price optimization - Match products page styling */
.wishlist-product-card .shop-product-price {
    margin: 8px 0 12px 0;
    font-weight: 700;
    color: #222;
    opacity: 1;
    visibility: visible;
    display: block;
}

.wishlist-product-card .current-price {
    font-weight: 800;
    font-size: 1.05rem;
    color: #2d6e3e;
    text-decoration: none;
    text-shadow: none;
    line-height: 1.3;
    display: block;
    margin: 6px 0 2px;
}

.wishlist-product-card .prime-price,
.wishlist-product-card .member-price {
    font-size: 0.85rem;
    font-weight: 600;
    color: #f05c0c;
    text-decoration: none;
    margin-top: 2px;
    display: block;
    line-height: 1.3;
}

/* Controls optimization - Match products page styling */
.wishlist-product-card .shop-product-controls {
    margin-top: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 20;
    width: 100%;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

.wishlist-product-card .shop-gk-weight-select,
.wishlist-product-card .gk-weight-select {
    width: 100%;
    padding: 8px 30px 8px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.875em;
    cursor: pointer;
    transition: border-color 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1em;
}

.wishlist-product-card .shop-gk-weight-select:focus {
    outline: none;
    border-color: #2d6e3e;
    box-shadow: 0 0 0 3px rgba(45, 110, 62, 0.1);
}

/* Button optimization - Match products page styling.
   NOTE: the wishlist button no longer carries the `gk-add-to-cart-btn` class
   (removed so shop-card JS can't hijack it), so this rule is scoped solely to
   `.wishlist-move-to-cart-btn`. `max-width` is unconstrained so the full
   "Move to Cart" label is never clipped. */
.wishlist-product-card .wishlist-move-to-cart-btn {
    background: #f05c0c;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-width: 80px;
    max-width: none;
    white-space: nowrap;
    text-decoration: none;
    z-index: 21;
    position: relative;
}

/* Cart glyph for the Move-to-Cart button. Previously supplied by the
   `.gk-add-to-cart-btn .icon` rule in product-unified.css; the wishlist button no
   longer carries that class, so reproduce the icon here scoped to the wishlist
   button. */
.wishlist-product-card .wishlist-move-to-cart-btn .icon {
    display: inline-block;
    width: 18px;
    height: 18px;
}

.wishlist-product-card .wishlist-move-to-cart-btn .icon::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2S15.9 22 17 22s2-.9 2-2-.9-2-2-2zM7.17 14h9.66c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1 1 0 0 0 21.34 5H6.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2z"/></svg>') no-repeat center / contain;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="black"><path d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2S15.9 22 17 22s2-.9 2-2-.9-2-2-2zM7.17 14h9.66c.75 0 1.41-.41 1.75-1.03l3.58-6.49A1 1 0 0 0 21.34 5H6.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2z"/></svg>') no-repeat center / contain;
    background: currentColor;
}

.wishlist-product-card .wishlist-move-to-cart-btn:hover {
    background: #f05c0c;
}

.wishlist-product-card .wishlist-move-to-cart-btn:active {
    transform: translateY(0);
}

.wishlist-product-card .wishlist-move-to-cart-btn.loading {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Empty state optimization */
.wishlist-empty-optimized {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    will-change: opacity;
}

.wishlist-empty-optimized h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5rem;
}

.wishlist-empty-optimized p {
    color: #666;
    margin-bottom: 20px;
    font-size: 1rem;
}

.wishlist-empty-optimized .btn {
    display: inline-block;
    background: #ff6b35;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.2s ease, transform 0.2s ease;
    will-change: background, transform;
}

.wishlist-empty-optimized .btn:hover {
    background: #e55a2b;
    transform: translateY(-1px);
}

/* Error state */
.wishlist-error-optimized {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.wishlist-error-optimized h3 {
    margin-bottom: 15px;
    color: #e74c3c;
    font-size: 1.5rem;
}

.wishlist-error-optimized p {
    color: #666;
    margin-bottom: 20px;
}

.wishlist-error-optimized .btn {
    display: inline-block;
    background: #ff6b35;
    color: white;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.2s ease;
}

.wishlist-error-optimized .btn:hover {
    background: #e55a2b;
}

/* Responsive optimizations */
@media (max-width: 768px) {
    .grokarna-wishlist-page-optimized {
        padding: 10px;
    }
    
    .wishlist-products-grid-optimized {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
    
    .wishlist-header h1 {
        font-size: 2rem;
    }
    
    .wishlist-product-card .shop-product-image {
        height: 200px;
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .wishlist-products-grid-optimized {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .wishlist-header h1 {
        font-size: 1.75rem;
    }
}

/* Performance optimizations */
.wishlist-product-card * {
    box-sizing: border-box;
}

.wishlist-product-card img {
    max-width: 100%;
    height: auto;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .wishlist-product-card,
    .wishlist-product-card .remove-wishlist-heart,
    .wishlist-product-card .wishlist-move-to-cart-btn,
    .wishlist-empty-optimized .btn {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
    }
    
    .wishlist-products-grid-optimized {
        transition: none;
    }
}

/* Print styles */
@media print {
    .wishlist-product-card .remove-wishlist-heart,
    .wishlist-product-card .shop-product-controls {
        display: none;
    }
    
    .wishlist-product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}


/* ========== 2. WISHLIST REDESIGN ========== */
/* Source: wishlist-redesign.css */



/* =============================================
   UNIFIED WISHLIST SYSTEM - RED BASKET DESIGN
   Universal Basket Icons with Consistent Behavior
   ============================================= */

/* Universal Basket Styles - Works for all wishlist selectors */
.wishlist-heart-redesign,
.wishlist-heart-btn,
.wishlist-heart-container {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    width: 32px !important;
    height: 32px !important;
    cursor: pointer !important;
    z-index: 2147483647 !important;

    /* HOVER EFFECT: Hidden by default for non-wishlisted items */
    opacity: 0 !important;
    visibility: hidden !important;

    /* NO BACKGROUND - Just the basket icon */
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;

    /* Smooth transitions */
    transition: all 0.3s ease !important;

    /* Reset any inherited styles */
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    
    /* Use SVG basket icon as background */
    background-image: url('../icons/basket-inactive.svg') !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

/* Hide the heart icon span - we're using SVG background instead */
.wishlist-heart-redesign .heart-icon,
.wishlist-heart-btn .heart-icon,
.wishlist-heart-container .heart-icon {
    display: none !important;
}

/* Show basket on hover (full opacity — the faded 0.375 looked washed out) */
.product-card:hover .wishlist-heart-redesign,
.product-card:hover .wishlist-heart-btn,
.product-card:hover .wishlist-heart-container,
.shop-product-card:hover .wishlist-heart-redesign,
.shop-product-card:hover .wishlist-heart-btn,
.shop-product-card:hover .wishlist-heart-container,
.featured-products .product-card:hover .wishlist-heart-redesign,
.featured-products .product-card:hover .wishlist-heart-btn,
.featured-products .product-card:hover .wishlist-heart-container {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Always show basket when wishlisted */
.wishlist-heart-redesign.wishlisted,
.wishlist-heart-redesign.in-wishlist,
.wishlist-heart-btn.wishlisted,
.wishlist-heart-btn.in-wishlist,
.wishlist-heart-container.wishlisted,
.wishlist-heart-container.in-wishlist,
.featured-products .wishlist-heart-redesign.wishlisted,
.featured-products .wishlist-heart-redesign.in-wishlist,
.featured-products .wishlist-heart-btn.wishlisted,
.featured-products .wishlist-heart-btn.in-wishlist,
.featured-products .wishlist-heart-container.wishlisted,
.featured-products .wishlist-heart-container.in-wishlist {
    opacity: 1 !important;
    visibility: visible !important;
    background-image: url('../icons/basket-active.svg') !important;
}

/* Hover effect - scale up */
.wishlist-heart-redesign:hover,
.wishlist-heart-btn:hover,
.wishlist-heart-container:hover {
    transform: scale(1.15) !important;
}

/* Single product page wishlist - positioning only. Visibility is
   hover-controlled (hidden until the image is hovered) by the rules in
   wishlist-redesign.css, matching the shop/front-page card behavior. */
.single-product-wishlist {
    top: 15px !important;
    right: 15px !important;
    position: absolute !important;
    z-index: 100 !important;
}

/* Reveal on image hover / when already wishlisted (mirrors card behavior) */
.product-images-wrapper:hover .single-product-wishlist,
.single-product-wishlist.wishlisted,
.single-product-wishlist.in-wishlist {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Touch devices have no hover: keep it visible */
@media (hover: none) {
    .single-product-wishlist {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Ensure product images wrapper has relative positioning for single product pages */
.single-product .product-images-wrapper {
    position: relative !important;
}

/* Wishlist page - Move to Cart button basket icon */
.wishlist-page .wishlist-heart-redesign {
    position: relative !important;
    top: 0 !important;
    right: 0 !important;
    opacity: 0.375 !important;
    visibility: visible !important;
    display: inline-flex !important;
    width: 24px !important;
    height: 24px !important;
    margin-right: 8px !important;
}

/* Remove white padding from product cards on /products/ page */
.shop-product-card {
    padding: 0 !important;
    margin: 0 !important;
}

.shop-product-card .shop-product-image {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
}

.shop-product-card .shop-product-info {
    padding: 16px !important;
}

/* Ensure featured product cards also have no extra padding */
.featured-products .product-card {
    padding: 0 !important;
    margin: 0 !important;
}

.featured-products .product-card .product-image {
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
}

.featured-products .product-card .product-info {
    padding: 12px 12px 58px !important;
}



/* ========== 3. WISHLIST PAGE FIXES (REMOVED) ========== */
/* Source: wishlist-page-fixes.css
 *
 * The previous "compact overrides" here targeted `.wishlist-products-grid ...`,
 * but the wishlist grid is actually rendered as `.wishlist-products-grid-optimized`
 * (see assets/js/wishlist-unified.js renderAllProducts()), so every rule below was
 * dead CSS that never applied. Its intent (compact padding, title/price sizing) is
 * now owned correctly by the redesigned card rules in section 1 above, scoped to
 * `.wishlist-product-card`. The only live rule in the old block — a global
 * `.wishlist-move-to-cart-btn { background:#ff6b35 !important }` — has been dropped
 * in favour of the brand-consistent, card-scoped button rule in section 1
 * (`.wishlist-product-card .wishlist-move-to-cart-btn`). Removed to stop misleading
 * future edits. */
