/* NearbyYou — Say It, Find It v2 */

/* ---- Pink card trigger ---- 
   Fully self-contained — no shared classes with TMA, Maze or Passport.
   Same visual style, zero conflict. */
.sifi-card-trigger {
    display: inline-block;
    width: 200px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #dc0866 0%, #ff0a75 100%);
    border: 2px dashed rgba(255,255,255,.4);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all .3s ease;
    box-shadow: 0 4px 15px rgba(220,8,102,.4);
    user-select: none;
}
.sifi-card-trigger:hover {
    transform: translateY(-5px);
    border-color: rgba(255,255,255,.8);
    box-shadow: 0 8px 25px rgba(220,8,102,.5);
}
.sifi-card-icon {
    width: 60px; height: 60px;
    margin: 0 auto 20px;
    background: rgba(255,255,255,.2);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,.3);
}
.sifi-card-icon svg { display: block; }
.sifi-card-title {
    font-size: 18px; font-weight: 700; color: #fff;
    margin: 0 0 8px; line-height: 1.3;
}
.sifi-card-tagline {
    font-size: 13px; color: rgba(255,255,255,.9);
    margin: 0 0 20px; line-height: 1.4;
}
.sifi-card-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 10px 20px;
    background: rgba(255,255,255,.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,.4);
    border-radius: 6px;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all .3s ease;
}
.sifi-card-trigger:hover .sifi-card-btn {
    background: #fff;
    color: #dc0866;
    border-color: #fff;
}

/* ---- Scroll lock (TMA pattern) ---- */
html.sifi-open, body.sifi-open { overflow: hidden !important; }

/* ---- Trigger button ---- */
.sifi-trigger {
    display: inline-flex; align-items: center; gap: 10px;
    background: var(--sifi-accent, #6C47FF); color: #fff;
    border: none; border-radius: 50px; padding: 14px 24px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    box-shadow: 0 4px 16px rgba(108,71,255,.35);
    transition: background .2s, transform .2s, box-shadow .2s;
}
.sifi-trigger:hover  { background: #5534e0; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,71,255,.45); }
.sifi-trigger:active { transform: scale(.97); }

/* ---- Modal ---- */
.sifi-modal {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    box-sizing: border-box;
}
.sifi-modal[hidden] { display: none !important; }

.sifi-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}

/* ---- Panel ---- */
.sifi-panel {
    position: relative; z-index: 1;
    background: #fff; border-radius: 24px;
    width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 25px 80px rgba(0,0,0,.5);
    transform: translateY(20px); opacity: 0;
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .25s ease;
}
.sifi-modal:not([hidden]) .sifi-panel { transform: translateY(0); opacity: 1; }

@media (max-width: 600px) {
    .sifi-modal { align-items: flex-end; padding: 0; }
    .sifi-panel {
        border-radius: 20px 20px 0 0; max-width: 100%;
        max-height: calc(95vh - env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* ---- Panel header (sticky) ---- */
.sifi-panel-header {
    position: sticky; top: 0; z-index: 2;
    background: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 20px 14px; border-bottom: 1px solid #f0f0f0;
}
.sifi-panel-title { font-size: 17px; font-weight: 700; color: #111; letter-spacing: -.3px; }

.sifi-close {
    background: #f3f3f5; border: none; border-radius: 50%;
    width: 36px; height: 36px; display: flex; align-items: center;
    justify-content: center; cursor: pointer; color: #555;
    transition: background .2s, transform .2s; flex-shrink: 0;
}
.sifi-close:hover { background: #e8e8ec; transform: rotate(90deg); }

/* ---- Mic area ---- */
.sifi-mic-area {
    display: flex; flex-direction: column; align-items: center;
    gap: 10px; padding: 24px 20px 16px;
}
.sifi-mic {
    width: 80px; height: 80px; border-radius: 50%;
    background: rgba(108,71,255,.1); border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--sifi-accent, #6C47FF);
    transition: background .2s, transform .2s;
}
.sifi-mic:hover          { background: rgba(108,71,255,.18); transform: scale(1.05); }
.sifi-mic.is-listening   { background: #fff0f0; color: #e03e3e; animation: sifi-pulse-red 1.2s infinite; }
.sifi-mic.is-thinking    { background: #fffbe6; color: #c8960c; animation: sifi-pulse-amber 1.4s infinite; }

@keyframes sifi-pulse-red   { 0%,100%{box-shadow:0 0 0 0 rgba(224,62,62,.35)} 70%{box-shadow:0 0 0 18px rgba(224,62,62,0)} }
@keyframes sifi-pulse-amber { 0%,100%{box-shadow:0 0 0 0 rgba(200,150,12,.3)} 70%{box-shadow:0 0 0 14px rgba(200,150,12,0)} }

.sifi-status     { font-size: 15px; font-weight: 600; color: #333; margin: 0; }
.sifi-transcript { font-size: 13px; color: #777; font-style: italic; margin: 0; text-align: center; min-height: 18px; }

/* ---- Intent tags ---- */
.sifi-tags {
    display: flex; flex-wrap: wrap; gap: 6px;
    justify-content: center; padding: 0 20px 12px; min-height: 24px;
}
.sifi-tag {
    background: rgba(108,71,255,.12); color: var(--sifi-accent, #6C47FF);
    font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 20px;
    animation: sifi-tag-in .2s ease;
}
@keyframes sifi-tag-in { from{opacity:0;transform:scale(.8)} to{opacity:1;transform:scale(1)} }

/* ---- Results ---- */
.sifi-results-wrap { padding: 0 14px; }
.sifi-results-count { font-size: 13px; color: #888; text-align: center; margin: 0 0 12px; }
.sifi-results-count strong { color: #111; }

.sifi-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
@media (max-width: 360px) { .sifi-grid { grid-template-columns: 1fr; } }

/* ---- Card ---- */
.sifi-card {
    display: block; text-decoration: none;
    border-radius: 12px; overflow: hidden;
    border: 1px solid #ebebeb; background: #fff;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    animation: sifi-card-in .25s ease both;
}
.sifi-card:hover { border-color: var(--sifi-accent, #6C47FF); box-shadow: 0 4px 14px rgba(108,71,255,.12); transform: translateY(-2px); }
@keyframes sifi-card-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.sifi-card-img-wrap {
    position: relative; width: 100%; padding-top: 62.5%; /* 16:10 */
    background: #f0eeff; overflow: hidden;
}
.sifi-card-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.sifi-card-no-img {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
}

/* Dark gradient caption over image */
.sifi-card-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 24px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
}
.sifi-card-cat {
    display: inline-block; background: var(--sifi-accent, #6C47FF); color: #fff;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    padding: 2px 7px; border-radius: 4px; margin-bottom: 4px;
}
.sifi-card-name {
    font-size: 13px; font-weight: 700; color: #fff;
    margin: 0 0 3px; line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0,0,0,.4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sifi-card-dist {
    display: flex; align-items: center; gap: 3px;
    font-size: 11px; color: rgba(255,255,255,.85);
}
.sifi-pin {
    width: 11px; height: 11px; flex-shrink: 0;
    stroke: rgba(255,255,255,.85);
}

/* ---- Footer ---- */
.sifi-footer {
    display: flex; justify-content: center; gap: 10px;
    padding: 16px 14px 20px;
}
.sifi-close-bottom {
    border-radius: 50px; width: auto; height: auto;
    padding: 10px 28px; font-size: 14px; font-weight: 600; color: #555;
}
.sifi-close-bottom:hover { transform: none; }

/* ---- Error ---- */
.sifi-error { text-align: center; padding: 16px 20px 24px; }
.sifi-error-msg { font-size: 14px; color: #c0392b; margin: 0 0 12px; }
.sifi-retry {
    background: none; border: 1.5px solid var(--sifi-accent, #6C47FF);
    color: var(--sifi-accent, #6C47FF); border-radius: 50px;
    padding: 9px 22px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .2s, color .2s;
}
.sifi-retry:hover { background: var(--sifi-accent, #6C47FF); color: #fff; }

.sifi-no-results { text-align: center; padding: 20px 0; font-size: 14px; color: #888; }

/* ============================================================
   SPONSORED SECTION
   ============================================================ */

/* Section headers */
.sifi-section-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px 8px;
}
.sifi-section-label {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; color: #b8860b;
}
.sifi-section-label svg { color: #b8860b; flex-shrink: 0; }
.sifi-section-label--results { color: #555; }

/* Divider between sections */
.sifi-sponsored-wrap + .sifi-results-wrap {
    border-top: 1px solid #f0f0f0;
    margin-top: 4px; padding-top: 4px;
}

/* Sponsored track wrapper */
.sifi-sponsored-track-wrap {
    position: relative;
    padding: 0 14px 14px;
}

.sifi-sponsored-track {
    display: flex; gap: 10px;
    overflow-x: auto; overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    padding-bottom: 2px;
}
.sifi-sponsored-track::-webkit-scrollbar { display: none; }

/* Sponsored card — same visual as .sifi-card but fixed width for horizontal scroll */
.sifi-sp-card {
    flex: 0 0 140px;
    display: block; text-decoration: none;
    border-radius: 12px; overflow: hidden;
    border: 1px solid #ebebeb; background: #fff;
    transition: border-color .2s, box-shadow .2s, transform .2s;
    scroll-snap-align: start;
    animation: sifi-card-in .25s ease both;
}
.sifi-sp-card:hover {
    border-color: var(--sifi-accent, #6C47FF);
    box-shadow: 0 4px 14px rgba(108,71,255,.12);
    transform: translateY(-2px);
}

/* Same image-with-caption structure as .sifi-card-img-wrap */
.sifi-sp-img-wrap {
    position: relative; width: 100%; padding-top: 62.5%;
    background: #f0eeff; overflow: hidden;
}
.sifi-sp-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.sifi-sp-no-img {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center; font-size: 24px;
}

/* Sponsored badge — top left corner */
.sifi-sp-badge {
    position: absolute; top: 6px; left: 6px;
    background: rgba(184,134,11,.85); color: #fff;
    font-size: 8px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .06em; padding: 2px 6px; border-radius: 3px;
    backdrop-filter: blur(4px);
}

/* Caption overlay — identical to .sifi-card-caption */
.sifi-sp-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 20px 8px 8px;
    background: linear-gradient(to top, rgba(0,0,0,.75) 0%, transparent 100%);
}
.sifi-sp-cat {
    display: inline-block; background: var(--sifi-accent, #6C47FF); color: #fff;
    font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    padding: 1px 6px; border-radius: 3px; margin-bottom: 3px;
}
.sifi-sp-name {
    font-size: 12px; font-weight: 700; color: #fff;
    margin: 0 0 2px; line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0,0,0,.4);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sifi-sp-dist {
    display: flex; align-items: center; gap: 2px;
    font-size: 10px; color: rgba(255,255,255,.85);
}
.sifi-sp-dist svg { flex-shrink: 0; stroke: rgba(255,255,255,.85); }

/* Arrow buttons */
.sifi-sp-arrow {
    display: none;
    position: absolute; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%; border: none;
    background: var(--sifi-accent, #6C47FF);
    box-shadow: 0 4px 12px rgba(108,71,255,.4);
    cursor: pointer; align-items: center; justify-content: center;
    z-index: 2; transition: background .2s, opacity .2s;
}
.sifi-sp-arrow.prev { left: 2px; }
.sifi-sp-arrow.next { right: 2px; }
.sifi-sp-arrow:disabled { opacity: .4; cursor: not-allowed; }
.sifi-sp-arrow:hover:not(:disabled) { background: #5534e0; }

/* Results count */
.sifi-results-count { font-size: 12px; color: #888; }
.sifi-results-count strong { color: #111; }

/* ---- Text input fallback (desktop / Firefox) ---- */
.sifi-text-fallback { width: 100%; padding: 0 4px; box-sizing: border-box; }
.sifi-fallback-label { font-size: 12px; color: #999; text-align: center; margin: 0 0 10px; }
.sifi-text-input-wrap {
    display: flex; gap: 8px; align-items: center;
    background: #f5f5f7; border-radius: 50px;
    padding: 6px 6px 6px 16px; border: 1.5px solid #e8e8ec;
    transition: border-color .2s;
}
.sifi-text-input-wrap:focus-within { border-color: var(--sifi-accent, #6C47FF); }
.sifi-text-input {
    flex: 1; border: none; background: transparent;
    font-size: 14px; color: #111; outline: none;
    min-width: 0;
}
.sifi-text-input::placeholder { color: #bbb; }
.sifi-text-submit {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: var(--sifi-accent, #6C47FF); border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #fff;
    transition: background .2s, transform .2s;
}
.sifi-text-submit:hover { background: #5534e0; transform: scale(1.05); }

/* Brave browser hint */
.sifi-brave-hint {
    font-size: 12px; color: #666; text-align: center;
    margin: 0 0 12px; line-height: 1.5;
    padding: 8px 12px; background: #fff8e6;
    border-radius: 8px; border: 1px solid #f0d060;
}
.sifi-brave-hint strong { color: #c8960c; }
