/**
 * Smart Match — front.css
 * Kafelki akcesoriów z checkboxami (styl selektora atrybutów PS)
 * @author 4VIP for WelesCode
 */

/* -----------------------------------------------------------------------
   Wrapper
----------------------------------------------------------------------- */
#vip-smartmatch-wrapper {
    margin: 1rem 0 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e8e8e8;
}

/* -----------------------------------------------------------------------
   Sekcja
----------------------------------------------------------------------- */
.vip-smartmatch-section {
    margin-bottom: 1rem;
}

.vip-smartmatch-section__header {
    margin-bottom: 0.5rem;
}

.vip-smartmatch-section__title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #555;
}

/* Rząd kafelków — domyślnie wrap; JS kolapsuje do jednej linii jeśli jest więcej */
.vip-smartmatch-section__options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch; /* równa wysokość wszystkich kafelków w rzędzie */
}

/* Przycisk „Więcej / Mniej" */
.vip-smartmatch-more {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 0.68rem;
    color: #555;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    line-height: 1.8;
}
.vip-smartmatch-more:hover { background: #ebebeb; }

/* -----------------------------------------------------------------------
   Kafelek (label = cały klikalny element)
----------------------------------------------------------------------- */
.vip-smartmatch-option {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    cursor: pointer;
    width: 90px;
    flex-shrink: 0;
    user-select: none;
    touch-action: manipulation; /* iOS: first tap = click, not hover */
    -webkit-tap-highlight-color: transparent;
}

/* Ukryj natywny checkbox */
.vip-smartmatch-option input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Wewnętrzna ramka */
.vip-smartmatch-option__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex-grow: 1; /* wypełnia całą wysokość rzędu */
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 4px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
    background: #fff;
    position: relative;
}

.vip-smartmatch-option:hover .vip-smartmatch-option__inner {
    border-color: #aaa;
}

/* Zaznaczony */
.vip-smartmatch-option.is-checked .vip-smartmatch-option__inner {
    border-color: #3d9142;
    background-color: #f0faf1;
}

/* -----------------------------------------------------------------------
   Zdjęcie
----------------------------------------------------------------------- */
.vip-smartmatch-option__img-wrap {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.vip-smartmatch-option__img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 3px;
}

/* Lupka quick view — widoczna przy hover na cały kafelek */
.vip-smartmatch-option__qv {
    position: absolute;
    top: 0px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.30);
    border: 1.5px solid rgba(0,0,0,0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s ease;
    color: #555;
    text-decoration: none;
    z-index: 2;
}

.vip-smartmatch-option__qv .material-icons {
    font-size: 18px;
    line-height: 1;
    color: rgba(0,0,0,0.5);
}

.vip-smartmatch-option:hover .vip-smartmatch-option__qv {
    opacity: 1;
}

/* Touch devices: QV zawsze widoczna, nie zasłania zdjęcia */
@media (hover: none) {
    .vip-smartmatch-option__qv {
        opacity: 1;
        width: 31px;
        height: 31px;
        border: 1.5px solid rgba(0,0,0,0.3);
        box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    }
    .vip-smartmatch-option__qv .material-icons {
        font-size: 19px;
        color: rgba(0,0,0,0.5);
    }
    /* Wyłącz hover-border żeby iOS nie robił double-tap */
    .vip-smartmatch-option:hover .vip-smartmatch-option__inner {
        border-color: #ddd;
    }
    .vip-smartmatch-option.is-checked:hover .vip-smartmatch-option__inner {
        border-color: #3d9142;
    }
}

/* -----------------------------------------------------------------------
   Nazwa i cena
----------------------------------------------------------------------- */
.vip-smartmatch-option__name {
    margin-top: 4px;
    font-size: 0.65rem;
    line-height: 1.3;
    text-align: center;
    color: #333;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-height: 2.6em;
    width: 100%;
    flex-grow: 1; /* wypycha cenę na dół */
}

.vip-smartmatch-option__price {
    font-size: 0.65rem;
    color: #777;
    margin-top: 2px;
    text-align: center;
}

/* -----------------------------------------------------------------------
   Checkmark (zielony krążek w prawym górnym rogu)
----------------------------------------------------------------------- */
.vip-smartmatch-option__checkmark {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: #3d9142;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    z-index: 3;
}

.vip-smartmatch-option__checkmark .material-icons {
    font-size: 12px;
    color: #fff;
    line-height: 1;
}

.vip-smartmatch-option.is-checked .vip-smartmatch-option__checkmark {
    opacity: 1;
    transform: scale(1);
}

/* -----------------------------------------------------------------------
   Pasek podsumowania
----------------------------------------------------------------------- */
.vip-smartmatch-summary {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 6px 10px;
    background: #f0faf1;
    border: 1px solid #c6e6c8;
    border-radius: 6px;
    font-size: 0.75rem;
    color: #2e7d32;
}

.vip-smartmatch-summary .material-icons {
    font-size: 15px;
    color: #3d9142;
    flex-shrink: 0;
}
