/**
 * File Name: frontend-compare-widget.css
 * File Location: /assets/css/frontend-compare-widget.css
 *
 * Purpose:
 * Styles the DAF Marketplace header compare dropdown widget, compare badge,
 * product loop compare icon, mini product list, sticky dropdown action buttons,
 * remove actions, empty state, and toast UI. Visual language matches wishlist
 * widget so header dropdowns feel consistent.
 *
 * Linked Files:
 * - /includes/frontend/class-frontend-compare-widget.php
 * - /assets/js/frontend-compare-widget.js
 * - /includes/frontend/class-frontend-compare-page.php
 * - /assets/css/frontend-compare-page.css
 * - /assets/icons/compare.svg
 */

/* ==========================================================================
   DAF Compare Widget - Header Hook / Badge
   ========================================================================== */

#daf-hook-compare {
    position: relative !important;
    overflow: visible !important;
}

#daf-hook-compare .daf-menu-svg {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
    object-fit: contain !important;
}

.daf-compare-count-badge {
    position: absolute !important;
    top: -2px !important;
    right: -5px !important;
    background: #8cc63f !important;
    color: #ffffff !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    min-width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #ffffff !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12) !important;
    padding: 0 !important;
    line-height: 1 !important;
    z-index: 10 !important;
}

/* ==========================================================================
   DAF Compare Widget - Dropdown Container
   ========================================================================== */

.daf-ghost-compare-widget {
    all: initial;
    display: block !important;
    position: absolute !important;
    top: 135% !important;
    right: 0 !important;
    width: 390px !important;
    max-width: calc(100vw - 24px) !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 24px 42px -12px rgba(15, 23, 42, 0.22), 0 10px 18px -12px rgba(15, 23, 42, 0.16) !important;
    border-radius: 14px !important;
    z-index: 999999999 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(12px) !important;
    transition: all 0.22s ease !important;
    pointer-events: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    padding: 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#daf-hook-compare.daf-compare-active .daf-ghost-compare-widget {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    pointer-events: auto !important;
}

/* ==========================================================================
   DAF Compare Widget - Dropdown Header
   ========================================================================== */

.daf-compare-dropdown-header {
    padding: 16px 18px !important;
    border-bottom: 1px solid #eef2f7 !important;
    background: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    box-sizing: border-box !important;
}

.daf-compare-dropdown-title {
    font-weight: 900 !important;
    font-size: 14px !important;
    color: #0f172a !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    display: block !important;
    line-height: 1.2 !important;
}

.daf-compare-dropdown-subtitle {
    margin-top: 4px !important;
    display: block !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    line-height: 1.2 !important;
}

.daf-compare-dropdown-view-link {
    color: #2271b1 !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

/* ==========================================================================
   DAF Compare Widget - Dropdown Body
   ========================================================================== */

.daf-compare-dropdown-body {
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

/* 3 products visible; remaining products scroll */
.daf-compare-widget-scroll {
    max-height: 246px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: #ffffff !important;
    box-sizing: border-box !important;
}

.daf-compare-widget-scroll::-webkit-scrollbar {
    width: 7px !important;
}

.daf-compare-widget-scroll::-webkit-scrollbar-track {
    background: #f8fafc !important;
}

.daf-compare-widget-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 999px !important;
}

.daf-compare-widget-scroll::-webkit-scrollbar-thumb:hover {
    background: #94a3b8 !important;
}

.daf-compare-widget-products {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
}

/* ==========================================================================
   DAF Compare Widget - Mini Product Item
   ========================================================================== */

.daf-compare-widget-item {
    min-height: 82px !important;
    display: grid !important;
    grid-template-columns: 72px minmax(0, 1fr) 34px !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 10px 16px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
}

.daf-compare-widget-item:hover {
    background: #fbfdff !important;
}

.daf-compare-widget-item:last-child {
    border-bottom: none !important;
}

.daf-compare-widget-thumb {
    width: 72px !important;
    height: 54px !important;
    display: block !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    background: #f1f5f9 !important;
    border: 1px solid #eef2f7 !important;
    box-sizing: border-box !important;
}

.daf-compare-widget-thumb img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
}

.daf-compare-widget-info {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 7px !important;
}

.daf-compare-widget-name {
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    line-height: 1.28 !important;
    text-decoration: none !important;
    white-space: normal !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.daf-compare-widget-name:hover {
    color: #2271b1 !important;
}

.daf-compare-widget-meta {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
}

.daf-compare-widget-type {
    color: #475569 !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    padding: 4px 8px !important;
    text-transform: uppercase !important;
    letter-spacing: 0.25px !important;
}

.daf-compare-widget-price {
    color: #8cc63f !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

/* ==========================================================================
   DAF Compare Widget - Remove Button
   ========================================================================== */

.daf-compare-widget-remove {
    width: 34px !important;
    height: 34px !important;
    border-radius: 10px !important;
    border: 1px solid #fecaca !important;
    background: #fff7f7 !important;
    color: #ef4444 !important;
    font-size: 0 !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.08) !important;
}

.daf-compare-widget-remove span {
    font-size: 20px !important;
    line-height: 1 !important;
    transform: translateY(-1px) !important;
}

.daf-compare-widget-remove:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 10px 18px rgba(239, 68, 68, 0.22) !important;
}

.daf-compare-widget-remove:active {
    transform: translateY(0) !important;
}

/* ==========================================================================
   DAF Compare Widget - View More Link
   ========================================================================== */

.daf-compare-widget-more {
    display: block !important;
    text-align: center !important;
    padding: 10px 16px !important;
    border-top: 1px solid #f1f5f9 !important;
    color: #2271b1 !important;
    background: #ffffff !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    text-decoration: none !important;
    flex: 0 0 auto !important;
}

/* ==========================================================================
   DAF Compare Widget - Sticky Actions
   ========================================================================== */

.daf-compare-widget-actions {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    padding: 14px 16px 16px !important;
    background: #f8fafc !important;
    border-top: 1px solid #e2e8f0 !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    z-index: 3 !important;
}

.daf-compare-widget-btn {
    height: 38px !important;
    border-radius: 8px !important;
    border: none !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    padding: 0 12px !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

.daf-compare-widget-btn:hover {
    transform: translateY(-1px) !important;
    opacity: 0.93 !important;
    color: #ffffff !important;
    text-decoration: none !important;
}

.daf-compare-widget-add-cart {
    background: #8cc63f !important;
}

.daf-compare-widget-clear {
    background: #ef4444 !important;
}

.daf-compare-widget-view {
    background: #0f172a !important;
    grid-column: 1 / -1 !important;
}

/* ==========================================================================
   DAF Compare Widget - Empty / Guest State
   ========================================================================== */

.daf-compare-widget-empty {
    padding: 38px 22px !important;
    text-align: center !important;
    color: #64748b !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 9px !important;
    box-sizing: border-box !important;
}

.daf-compare-widget-empty-icon {
    width: 54px !important;
    height: 54px !important;
    border-radius: 50% !important;
    background: #f1f5f9 !important;
    color: #8cc63f !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 30px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
}

.daf-compare-widget-empty strong {
    color: #0f172a !important;
    font-size: 15px !important;
    font-weight: 900 !important;
}

.daf-compare-widget-empty span {
    color: #64748b !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
    max-width: 260px !important;
}

.daf-compare-widget-empty a {
    margin-top: 8px !important;
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 10px 18px !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 900 !important;
}

/* ==========================================================================
   DAF Compare Loop Icon - Product Card Overlay
   ========================================================================== */

.daf-card-thumb {
    position: relative !important;
}

.daf-compare-loop-trigger {
    position: absolute !important;
    bottom: 15px !important;
    left: 61px !important;
    background: #ffffff !important;
    width: 31px !important;
    height: 31px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 11 !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
}

.daf-compare-loop-trigger:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.18) !important;
}

.daf-compare-loop-trigger .daf-compare-svg {
    width: 17px !important;
    height: 17px !important;
    transition: all 0.3s ease !important;
    filter: brightness(0) saturate(100%) !important;
}

.daf-compare-loop-trigger.active {
    background: #8cc63f !important;
    border-color: #8cc63f !important;
}

.daf-compare-loop-trigger.active .daf-compare-svg {
    filter: brightness(0) invert(1) !important;
    animation: dafComparePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.daf-compare-loop-trigger.daf-compare-loading {
    pointer-events: none !important;
    opacity: 0.72 !important;
}

@keyframes dafComparePop {
    0% {
        transform: scale(0.5);
    }

    50% {
        transform: scale(1.25);
    }

    100% {
        transform: scale(1);
    }
}

/* ==========================================================================
   DAF Compare Toast
   ========================================================================== */

#daf-compare-toast-container {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1000001 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    pointer-events: none !important;
}

.daf-compare-toast {
    background: #10b981 !important;
    color: #ffffff !important;
    padding: 14px 28px !important;
    border-radius: 50px !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    min-width: 280px !important;
    opacity: 0 !important;
    transform: scale(0.8) !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.daf-compare-toast.daf-compare-toast-visible {
    opacity: 1 !important;
    transform: scale(1) !important;
}

.daf-compare-toast.removed {
    background: #0f172a !important;
}

/* ==========================================================================
   DAF Compare Widget - Responsive
   ========================================================================== */

@media (max-width: 520px) {
    .daf-ghost-compare-widget {
        right: -14px !important;
        width: calc(100vw - 28px) !important;
    }

    .daf-compare-widget-actions {
        grid-template-columns: 1fr !important;
    }

    .daf-compare-widget-view {
        grid-column: auto !important;
    }
}