/**
 * Quick-filter chip thumbs + tooltips (shared by /ads family and explore pages).
 * Keep this file lean — do not pull in dashboard-filters-explore.css on explore pages.
 */

/* Dual preview thumbs */
.qf-thumbs {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    width: 30px;
    height: 24px;
}

.qf-thumbs.is-empty {
    display: none;
}

/* Empty / loading placeholders (two gray cards) — no old icons */
.qf-thumbs:not(.is-ready)::before,
.qf-thumbs:not(.is-ready)::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    background: #e5e7eb;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.qf-thumbs:not(.is-ready)::before {
    left: 0;
    z-index: 1;
    transform: rotate(-4deg);
}

.qf-thumbs:not(.is-ready)::after {
    left: 8px;
    z-index: 2;
    transform: rotate(3deg);
}

.dashboard-quick-filter-pill.has-qf-thumbs .qf-fallback-icon,
.filter-preset-card.has-qf-thumbs .qf-fallback-icon,
.filter-preset-card.has-qf-thumbs .filter-preset-icon::before,
.dashboard-quick-filter-pill.qf-awaiting-thumbs .qf-fallback-icon,
.filter-preset-card.qf-awaiting-thumbs .qf-fallback-icon,
.filter-preset-card.qf-awaiting-thumbs .filter-preset-icon::before {
    display: none !important;
}

.qf-thumbs__img {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    object-fit: cover;
    background: #e2e8f0;
    border: 1.5px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
}

.qf-thumbs__img.is-broken {
    display: none !important;
}

.qf-thumbs__img--1 {
    left: 0;
    z-index: 1;
    transform: rotate(-4deg);
}

.qf-thumbs__img--2 {
    left: 8px;
    z-index: 2;
    transform: rotate(3deg);
}

.dashboard-quick-filter-pill:hover .qf-thumbs__img--1,
.filter-preset-card:hover .qf-thumbs__img--1 {
    transform: rotate(-8deg) translate(-1px, -1px);
}

.dashboard-quick-filter-pill:hover .qf-thumbs__img--2,
.filter-preset-card:hover .qf-thumbs__img--2 {
    transform: rotate(7deg) translate(2px, -1px);
}

.qf-label {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qf-active-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2563eb;
    flex-shrink: 0;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.preset-filters .dashboard-quick-filter-pill.active-pill .qf-active-dot,
.preset-filters .dashboard-quick-filter-pill[data-active="true"] .qf-active-dot,
.filter-preset-card.active .qf-active-dot {
    opacity: 1;
    transform: scale(1);
}

/* Tooltips are portaled to body as fixed — open downward with fade/slide only */
.qf-tooltip {
    width: 300px;
    max-width: min(300px, calc(100vw - 24px));
    padding: 12px 14px;
    text-align: left;
    font-weight: 400;
    font-size: 12px;
    line-height: 1.45;
    border-radius: 10px;
    z-index: 10050;
    pointer-events: none;
    background-color: #0a0a0a !important;
    border: 1px solid #262626;
    color: #f5f5f5;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.04);
    opacity: 0;
    transform: translateY(-4px);
    /* Never transition left/top — that causes the fly-from-corner bug */
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.qf-tooltip.hidden {
    display: none !important;
}

.qf-tooltip.qf-tooltip--fixed {
    position: fixed !important;
    right: auto;
    bottom: auto;
    margin: 0;
    display: block !important;
    z-index: 10050 !important;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.qf-tooltip.qf-tooltip--open {
    opacity: 1;
    transform: translateY(0);
}

.qf-tooltip__title {
    font-size: 13px;
    font-weight: 650;
    color: #fff;
    margin: 0 0 6px;
}

.qf-tooltip__desc {
    margin: 0;
    color: #c4c4c4;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-wrap: wrap;
    white-space: normal;
}

.qf-tooltip__divider {
    height: 1px;
    background: #262626;
    margin: 10px 0 8px;
}

.qf-tooltip__filters-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #737373;
    margin-bottom: 6px;
}

.qf-tooltip__filters {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.qf-tooltip__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.qf-tooltip__key {
    color: #a3a3a3;
    flex: 1 1 auto;
    min-width: 0;
}

.qf-tooltip__val {
    color: #f5f5f5;
    font-weight: 600;
    text-align: right;
    flex: 0 1 auto;
}

/* Explore cards: match /ads chip height + thumb scale */
.filter-preset-card[data-qf-chip],
.filter-preset-card.has-popup,
.filter-preset-card.qf-awaiting-thumbs {
    min-height: 36px;
    height: auto;
    padding: 6px 12px 6px 8px;
    gap: 8px;
    flex: 0 1 auto;
    min-width: 152px;
    max-width: 260px;
}

.filter-preset-card[data-qf-chip] .filter-preset-icon,
.filter-preset-card.qf-awaiting-thumbs .filter-preset-icon,
.filter-preset-card.has-qf-thumbs .filter-preset-icon {
    width: 32px !important;
    height: 26px !important;
    margin-right: 0;
}

.filter-preset-card[data-qf-chip] .qf-thumbs {
    width: 32px;
    height: 26px;
}

.filter-preset-card[data-qf-chip] .qf-thumbs__img,
.filter-preset-card[data-qf-chip] .qf-thumbs:not(.is-ready)::before,
.filter-preset-card[data-qf-chip] .qf-thumbs:not(.is-ready)::after {
    width: 24px;
    height: 24px;
    border-radius: 5px;
}

.filter-preset-card[data-qf-chip] .qf-thumbs__img--2,
.filter-preset-card[data-qf-chip] .qf-thumbs:not(.is-ready)::after {
    left: 9px;
}

.filter-preset-card .filter-preset-title {
    font-size: 12px;
    line-height: 1.2;
}

.filter-preset-card .qf-active-dot {
    margin-left: 2px;
}

/* Selected state — quiet: white chip, blue border, dark label, small status dot */
.filter-preset-card[data-qf-chip].active,
.filter-preset-card.active {
    border-color: #225aea !important;
    border-width: 1px !important;
    background: #fff !important;
    box-shadow: none !important;
}

.filter-preset-card[data-qf-chip].active .filter-preset-title,
.filter-preset-card.active .filter-preset-title {
    color: #111827 !important;
    font-weight: 600 !important;
}

.filter-preset-card[data-qf-chip].active .qf-active-dot,
.filter-preset-card.active .qf-active-dot {
    opacity: 1 !important;
    transform: scale(1) !important;
    background: #225aea !important;
    width: 6px;
    height: 6px;
}

.filter-preset-card[data-qf-chip].active:hover,
.filter-preset-card.active:hover {
    background: #fff !important;
    border-color: #1d4ed8 !important;
}

html[data-theme="dark"] .filter-preset-card[data-qf-chip].active,
html[data-theme="dark"] .filter-preset-card.active {
    background: var(--dk-surface, #1a1c22) !important;
    border-color: rgba(96, 165, 250, 0.55) !important;
    box-shadow: none !important;
}

html[data-theme="dark"] .filter-preset-card[data-qf-chip].active .filter-preset-title,
html[data-theme="dark"] .filter-preset-card.active .filter-preset-title {
    color: var(--dk-text, #e8eaed) !important;
}

html[data-theme="dark"] .qf-thumbs:not(.is-ready)::before,
html[data-theme="dark"] .qf-thumbs:not(.is-ready)::after {
    background: var(--dk-surface-3, #2a2d35);
    border-color: var(--dk-surface, #1a1c22);
}

html[data-theme="dark"] .qf-thumbs__img {
    border-color: var(--dk-surface, #1a1c22) !important;
}

html[data-theme="dark"] .qf-active-dot {
    background: #60a5fa !important;
}

/* Never let pill display:inline-flex beat Tailwind .hidden */
.dashboard-quick-filter-pill.hidden,
.dashboard-quick-filter-pill[hidden] {
    display: none !important;
}

/* Favorites: always use dual thumbs (hide legacy star glyph) */
.filter-preset-card[data-filter="landers-favorites"].qf-awaiting-thumbs .filter-preset-icon::before,
.filter-preset-card[data-filter="advertisers-favorites"].qf-awaiting-thumbs .filter-preset-icon::before,
.filter-preset-card[data-filter="landers-favorites"].has-qf-thumbs .filter-preset-icon::before,
.filter-preset-card[data-filter="advertisers-favorites"].has-qf-thumbs .filter-preset-icon::before {
    display: none !important;
}

/* Match Save filters + Tile view to preset chip height on explore pages */
.explore-shops-filter-preset-save,
.explore-shops-view-toggle-btn {
    height: 36px !important;
    min-height: 36px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 0 12px !important;
    box-sizing: border-box;
}

.explore-shops-filter-preset-save__icon {
    width: 14px !important;
    height: 14px !important;
}
