/**
 * favorites.css
 *
 * Styles for favorites system (buttons, grid, tooltips).
 *
 * @package           Kiya_Helper_WooCommerce
 * @author            Kiya Holding <KiyaHolding@gmail.com>
 * @copyright         2026 Kiya Holding
 * @license           GPL-2.0-or-later
 * @link              https://KiyaHolding.com
 */

/* ===== Favorites Grid ===== */
.kh-favorites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin: 20px 0;
    background: transparent;
}

/* ===== Favorite Card ===== */

/* ===== جلوگیری از برش توسط والدین ===== */
.kh-fav-card,
.kh-fav-card-link,
.woocommerce-loop-product__link,
li.product,
.product,
ul.products li.product {
    overflow: visible !important;
}

/* ===== Tooltip Fixed (جدید) ===== */
.kh-tooltip-fixed {
    position: fixed;
    background: var(--kh-primary, #C9A86A);
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 999999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.kh-tooltip-fixed .kh-tooltip-arrow {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: var(--kh-primary, #C9A86A);
}

.kh-fav-card {
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s ease;
    position: relative;
    overflow: visible !important;
}

.kh-fav-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ===== Card Link ===== */
.kh-fav-card-link {
    display: block;
    position: relative;
    overflow: visible !important;
}

.kh-fav-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* ===== Actions Overlay ===== */
.kh-fav-card-actions {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 2;
    pointer-events: none;
}

.kh-fav-card-actions .kh-fav-wrapper {
    pointer-events: auto;
}

/* ===== Stock Status ===== */
.kh-fav-card-stock {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 2;
}

/* ===== Card Content ===== */
.kh-fav-card-content {
    padding: 12px;
    background: #fff;
}

.kh-fav-card-title {
    font-size: 16px;
    margin: 0 0 8px;
    line-height: 1.4;
}

.kh-fav-card-title a {
    color: var(--kh-titles, #2B2723);
    text-decoration: none;
}

.kh-fav-card-title a:hover {
    color: var(--kh-primary, #C9A86A);
}

/* ===== Prices ===== */
.kh-fav-card-prices {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.kh-fav-card-price-regular {
    font-size: 13px;
    color: #999;
    text-decoration: line-through;
}

.kh-fav-card-price-sale {
    font-size: 16px;
    color: var(--kh-primary, #C9A86A);
    font-weight: bold;
}

.kh-fav-card-price {
    font-size: 16px;
    color: var(--kh-primary, #C9A86A);
    font-weight: bold;
}

/* ===== Favorite Button ===== */
.kh-fav-btn {
    display: inline-block;
    width: 28px;
    height: 28px;
    background: url('../images/heart.svg') no-repeat center / contain;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.kh-fav-btn.favorited {
    background-image: url('../images/heart-filled.svg');
}

.kh-fav-btn:hover {
    opacity: 0.8;
}

/* ===== Tooltip (پایین آیکون) ===== */
.kh-fav-wrapper {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.kh-tooltip .kh-tooltip-text {
    visibility: hidden;
    width: 140px;
    background-color: var(--kh-primary, #C9A86A);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 6px 10px;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    z-index: 9999;
    white-space: nowrap;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.kh-tooltip .kh-tooltip-text::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent var(--kh-primary, #C9A86A) transparent;
}

.kh-tooltip:hover .kh-tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ===== Discount Badge ===== */
.kh-discount-badge {
    display: inline-block;
    background: var(--kh-discount-bg, #e74c3c);
    color: var(--kh-discount-text, #ffffff);
    padding: var(--kh-discount-padding, 4px 10px);
    font-size: var(--kh-discount-font-size, 13px);
    font-weight: bold;
    line-height: var(--kh-discount-line-height, 1.5);
    border-radius: 4px;
    text-align: center;
    pointer-events: none;
}

/* ===== Stock Status ===== */
.kh-stock-status {
    display: inline-block;
    padding: var(--kh-stock-padding, 4px 12px);
    border-radius: 4px;
    font-size: var(--kh-stock-font-size, 12px);
    font-weight: bold;
    line-height: var(--kh-stock-line-height, 1.5);
    transition: all 0.3s ease;
}

.kh-stock-status.in-stock {
    background-color: var(--kh-stock-in-stock-bg, #4CAF50);
    color: var(--kh-stock-in-stock-text, #ffffff);
}

.kh-stock-status.out-of-stock {
    background-color: var(--kh-stock-out-stock-bg, #f44336);
    color: var(--kh-stock-out-stock-text, #ffffff);
}

.kh-no-favorites {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    background: var(--kh-white, #FAF8F4);
    border-radius: 12px;
    color: var(--kh-text, #5F5A54);
    font-size: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .kh-favorites-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .kh-fav-card-image {
        height: 150px;
    }

    .kh-fav-card-actions {
        top: 6px;
        left: 6px;
        right: 6px;
    }

    .kh-fav-card-stock {
        bottom: 6px;
        left: 6px;
    }

    .kh-fav-card-content {
        padding: 8px;
    }

    .kh-fav-card-title {
        font-size: 14px;
    }
}