/**
 * FFGroup Pins - Frontend Styles
 * 11 Presets from Design Mockup + Responsive & Ecomall integration
 */

/* Container positioning */
.woocommerce .product .thumbnail-wrapper,
.woocommerce-product-gallery {
    position: relative;
}

.ff-pins-container {
    position: absolute;
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    z-index: 4;
    pointer-events: auto;
}

.ff-pins-container--top-left {
    top: 12px;
    left: 12px;
}

.ff-pins-container--top-right {
    top: 12px;
    right: 12px;
    align-items: flex-end;
}

.ff-pins-container--bottom-left {
    bottom: 12px;
    left: 12px;
}

.ff-pins-container--bottom-right {
    bottom: 12px;
    right: 12px;
    align-items: flex-end;
}

/* Offset when ecomall product-label (sale flash, out-of-stock, etc.) is present */
.woocommerce .product .thumbnail-wrapper:has(.product-label:not(:empty)) .ff-pins-container--top-left {
    top: 44px;
}

.woocommerce .product .thumbnail-wrapper:has(.product-label > span:nth-child(2)) .ff-pins-container--top-left {
    top: 74px;
}

.woocommerce-product-gallery:has(.product-label:not(:empty)) .ff-pins-container--top-left {
    top: 54px;
}

.woocommerce-product-gallery:has(.product-label > span:nth-child(2)) .ff-pins-container--top-left {
    top: 92px;
}

/* Base Badge */
.ff-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none !important;
    font-family: inherit;
    font-weight: 600;
    line-height: 1.2;
    box-sizing: border-box;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    user-select: none;
    cursor: default;
    position: relative;
}

a.ff-pin {
    cursor: pointer;
}

a.ff-pin:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.ff-pin__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.ff-pin__svg {
    display: block;
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.ff-pin__svg--flag {
    width: 16px;
    height: 11px;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.3);
}

.ff-pin__text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

/* ==========================================================================
   11 Style Presets
   ========================================================================== */

/* 1. Класичний (Classic Pill) */
.ff-pin--classic-pill {
    background-color: #1b8e4b;
    color: #ffffff;
    border: 1px solid #1b8e4b;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(27, 142, 75, 0.25);
}

/* 2. Мінімалістичний (Minimalist Pill) */
.ff-pin--minimal-pill {
    background-color: #eaf7ee;
    color: #1b8e4b;
    border: 1px solid #7bc592;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
}

/* 3. Кутовий (Corner Ribbon) */
.ff-pins-container:has(.ff-pin--corner-ribbon) {
    top: 0 !important;
    left: 0 !important;
}

.ff-pin--corner-ribbon {
    background-color: #107338;
    color: #ffffff;
    border: none;
    border-radius: 0 0 12px 0;
    padding: 6px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* 4. Знак якості (Round Seal) */
.ff-pin--round-seal {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background-color: #106834;
    color: #ffffff;
    border: 2px dashed rgba(255, 255, 255, 0.85);
    box-shadow: 0 3px 8px rgba(16, 104, 52, 0.35);
    padding: 3px;
    text-align: center;
}

.ff-pin--round-seal .ff-pin__seal-outer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.ff-pin--round-seal .ff-pin__seal-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.ff-pin--round-seal .ff-pin__seal-text {
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    text-align: center;
}

.ff-pin--round-seal .ff-pin__icon .ff-pin__svg {
    width: 14px;
    height: 14px;
}

/* 5. З акцентом на країну (Country / UA Flag) */
.ff-pin--country-pill {
    background-color: #f4f8ff;
    color: #1a3b5c;
    border: 1px solid #d2e3fc;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* 6. Компактний (Compact Pill) */
.ff-pin--compact-pill {
    background-color: #1b8e4b;
    color: #ffffff;
    border: 1px solid #1b8e4b;
    border-radius: 14px;
    padding: 2px 8px;
    font-size: 11px;
}

.ff-pin--compact-pill .ff-pin__svg {
    width: 12px;
    height: 12px;
}

/* 7. Альтернативний текст (Alt Text) */
.ff-pin--alt-text-pill {
    background-color: #ffffff;
    color: #1b8e4b;
    border: 1.5px solid #27ae60;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* 8. З іконкою шестерня (Tech / Industrial) */
.ff-pin--tech-pill {
    background-color: #e8f5e9;
    color: #1b8e4b;
    border: 1px solid #81c784;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
}

/* 9. Для СТМ (Private Brand) */
.ff-pin--brand-pill {
    background-color: #f0f9f2;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    padding: 3px 9px;
    font-size: 11px;
}

/* 10. Нейтральний (Outline) */
.ff-pin--outline-pill {
    background-color: rgba(255, 255, 255, 0.95);
    color: #1b8e4b;
    border: 1.5px solid #1b8e4b;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* 11. Преміум (Gold Accent) */
.ff-pin--premium-gold {
    background-color: #fff9e6;
    color: #936306;
    border: 1px solid #f9d877;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    box-shadow: 0 2px 5px rgba(249, 216, 119, 0.3);
}

/* Single Product Summary inline block */
.ff-pins-summary-wrapper {
    margin-bottom: 12px;
}

.ff-pins-container--single-summary {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* ==========================================================================
   Tooltips (Hover Explainer)
   ========================================================================== */
.ff-pin[data-ff-tooltip] {
    cursor: help;
}

.ff-pin-tooltip-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background-color: #1e293b;
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.ff-pin-tooltip-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #1e293b transparent transparent transparent;
}

.ff-pin-tooltip-bubble.is-active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Responsive (Mobile & Tablets)
   ========================================================================== */
@media (max-width: 767px) {
    .ff-pins-container--top-left {
        top: 8px;
        left: 8px;
    }
    .woocommerce .product .thumbnail-wrapper:has(.product-label:not(:empty)) .ff-pins-container--top-left {
        top: 36px;
    }
    .woocommerce .product .thumbnail-wrapper:has(.product-label > span:nth-child(2)) .ff-pins-container--top-left {
        top: 62px;
    }
    .woocommerce-product-gallery:has(.product-label:not(:empty)) .ff-pins-container--top-left {
        top: 44px;
    }
    .woocommerce-product-gallery:has(.product-label > span:nth-child(2)) .ff-pins-container--top-left {
        top: 76px;
    }
    .ff-pin {
        font-size: 10px !important;
        padding: 3px 7px !important;
    }
    .ff-pin__svg {
        width: 12px !important;
        height: 12px !important;
    }
    .ff-pin__text {
        max-width: 130px;
    }
    .ff-pin--round-seal {
        width: 44px !important;
        height: 44px !important;
    }
    .ff-pin--round-seal .ff-pin__seal-text {
        font-size: 7px !important;
    }
}
