/* FEF Search — "Search by photo": camera button, menu / slide-up sheet, camera modal, result chip. */

/* ── Camera button (mirrors the voice button so they sit side by side) ── */
.fef-search-photo-btn {
    background: none; border: none; color: #999; cursor: pointer; font-size: 18px; padding: 6px;
    transition: color .2s, background .2s; flex-shrink: 0; display: flex; align-items: center;
    position: relative; z-index: 2;
}
.fef-search-photo-btn:hover, .fef-search-photo-btn.is-open { color: #2271b1; }
.fef-search-photo-btn:focus-visible { outline: 2px solid #2271b1; outline-offset: 1px; border-radius: 6px; }
.fef-search-photo-btn svg, .fef-photo-opt-ico svg { width: 1em; height: 1em; fill: currentColor; }
.fef-search-photo-outside { margin-left: 8px; }
.fef-search-photo-outside_left { order: -1; margin-left: 0; margin-right: 8px; }

/* ── Menu: dropdown on desktop ── */
.fef-photo-menu {
    position: absolute; z-index: 100002; box-sizing: border-box;
    width: 260px; max-width: calc(100vw - 24px);
    background: #fff; border: 1px solid rgba(15, 23, 42, .06); border-radius: 14px; padding: 14px;
    box-shadow: 0 14px 40px rgba(15, 23, 42, .18);
    opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
    transition: opacity .18s ease, transform .18s ease;
}
.fef-photo-menu[hidden] { display: none; }
.fef-photo-menu.is-in { opacity: 1; transform: none; }
.fef-photo-menu-grab { display: none; }
.fef-photo-menu-title { font-weight: 700; font-size: 14px; line-height: 1.3; color: #0f172a; margin: 0 2px 10px; }
.fef-photo-menu-opts { display: flex; flex-direction: column; gap: 6px; }
.fef-photo-opt {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; box-sizing: border-box;
    background: transparent; border: 0; border-radius: 10px; padding: 11px 12px;
    font: inherit; font-size: 15px; color: #1e293b; cursor: pointer; transition: background .15s, color .15s;
}
.fef-photo-opt:hover, .fef-photo-opt:focus-visible { background: #f1f5f9; outline: none; }
.fef-photo-opt:focus-visible { box-shadow: 0 0 0 2px #2271b1 inset; }
.fef-photo-opt-ico { display: inline-flex; justify-content: center; width: 26px; font-size: 20px; color: #2271b1; flex: 0 0 auto; }
.fef-photo-cancel { display: none; }

/* ── Menu: slide-up sheet on mobile ── */
.fef-photo-backdrop {
    position: fixed; inset: 0; z-index: 100000; background: rgba(15, 23, 42, .5);
    opacity: 0; transition: opacity .22s ease;
}
.fef-photo-backdrop[hidden] { display: none; }
.fef-photo-backdrop.is-in { opacity: 1; }
.fef-photo-menu.is-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none; z-index: 100001;
    border: 0; border-radius: 20px 20px 0 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    opacity: 1; transform: translateY(100%); transform-origin: bottom center;
    transition: transform .26s cubic-bezier(.22, 1, .36, 1);
}
.fef-photo-menu.is-sheet.is-in { transform: none; }
.fef-photo-menu.is-sheet .fef-photo-menu-grab { display: block; width: 40px; height: 4px; border-radius: 2px; background: #cbd5e1; margin: 2px auto 12px; }
.fef-photo-menu.is-sheet .fef-photo-menu-title { text-align: center; font-size: 16px; margin-bottom: 12px; }
.fef-photo-menu.is-sheet .fef-photo-opt { padding: 15px 14px; font-size: 16px; background: #f8fafc; }
.fef-photo-menu.is-sheet .fef-photo-cancel {
    display: block; width: 100%; margin-top: 10px; padding: 14px; border: 0; border-radius: 12px;
    background: transparent; font: inherit; font-weight: 600; font-size: 16px; color: #475569; cursor: pointer;
}
.fef-photo-menu.is-sheet .fef-photo-cancel:hover { background: #f1f5f9; }
body.fef-photo-lock { overflow: hidden; }

/* ── Desktop camera modal ── */
.fef-photo-cam {
    position: fixed; inset: 0; z-index: 100010; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(2, 6, 23, .82);
}
.fef-photo-cam-box { position: relative; width: min(720px, 100%); overflow: hidden; border-radius: 16px; background: #000; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.fef-photo-cam-box video { display: block; width: 100%; aspect-ratio: 4 / 3; max-height: 70vh; object-fit: cover; background: #111; }
.fef-photo-cam-actions { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: #0b1220; }
.fef-photo-cam-shot {
    width: 62px; height: 62px; border-radius: 50%; border: 4px solid #fff; background: #e11d48; padding: 0; cursor: pointer;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); transition: transform .12s ease, opacity .2s;
}
.fef-photo-cam-shot:active { transform: scale(.92); }
.fef-photo-cam-shot:disabled { opacity: .4; cursor: not-allowed; }
.fef-photo-cam-cancel, .fef-photo-cam-switch {
    min-width: 64px; padding: 10px 12px; border: 0; background: transparent; color: #e2e8f0; font: inherit; font-size: 15px; cursor: pointer;
}
.fef-photo-cam-switch { font-size: 22px; }
.fef-photo-cam-switch[hidden], .fef-photo-cam-err[hidden] { display: none; }
.fef-photo-cam-err { position: absolute; left: 12px; right: 12px; top: 12px; padding: 12px 14px; border-radius: 10px; background: rgba(15, 23, 42, .92); color: #fff; font-size: 14px; line-height: 1.4; }
.fef-photo-cam-pick { margin-left: 6px; padding: 4px 10px; border: 0; border-radius: 6px; background: #fff; color: #0f172a; font: inherit; cursor: pointer; }

/* ── Result chip / notes / toast / % match ── */
.fef-photo-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: #f8fafc; border-bottom: 1px solid #eef2f7; font-size: 13px; color: #334155; }
.fef-photo-chip img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; }
.fef-photo-chip span { flex: 1; min-width: 0; }
.fef-photo-chip.is-loading span { color: #64748b; }
.fef-photo-chip-x { border: 0; background: none; padding: 4px 6px; font-size: 20px; line-height: 1; color: #94a3b8; cursor: pointer; }
.fef-photo-chip-x:hover { color: #dc2626; }
.fef-photo-note { padding: 9px 14px; font-size: 12px; color: #92400e; background: #fffbeb; }
.fef-photo-toast {
    position: absolute; left: 50%; top: 100%; z-index: 100003; margin-top: 8px; max-width: 92vw;
    display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px;
    background: #0f172a; color: #fff; font-size: 13px; white-space: nowrap;
    opacity: 0; transform: translate(-50%, -4px); pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.fef-photo-toast.is-in { opacity: 1; transform: translate(-50%, 0); }
.fef-search-item-match {
    display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px;
    background: #dcfce7; color: #166534; font-size: 11px; font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
    .fef-photo-menu, .fef-photo-backdrop, .fef-photo-menu.is-sheet, .fef-photo-toast { transition-duration: 1ms; }
}
