/* ═══════════════════════════════════════════════════════════
   Enhanced Search – Text, Voice & Image Search
   ═══════════════════════════════════════════════════════════ */

/* ── Search Wrapper ──────────────────────────────────────── */
.ebs-search-wrap {
    position: relative;
    width: 100%;
}

.ebs-search-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #e2e5ea;
    border-radius: 28px;
    padding: 0 3px 0 16px;
    transition: border-color .25s, box-shadow .25s;
    gap: 2px;
}

.ebs-search-group:focus-within {
    border-color: var(--bs-primary, #5b6abf);
    box-shadow: 0 0 0 4px rgba(91, 106, 191, .12);
}

.ebs-search-group input[type="text"] {
    border: none;
    outline: none;
    background: transparent;
    flex: 1;
    min-width: 0;
    font-size: .95rem;
    padding: 10px 0;
    color: #1a1a2e;
}

.ebs-search-group input::placeholder { color: #99a0ad; }

/* ── Action Buttons (inside the bar) ─────────────────────── */
.ebs-search-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #7b8498;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .2s, color .2s, transform .15s;
    padding: 0;
    position: relative;
}

.ebs-search-action:hover {
    background: #f0f2f5;
    color: #3d4663;
}

.ebs-search-action:active { transform: scale(.92); }

.ebs-search-action.ebs-submit {
    background: var(--bs-primary, #5b6abf);
    color: #fff;
    width: 36px;
    height: 36px;
    margin: 0;
}

.ebs-search-action.ebs-submit:hover {
    background: #4a59ae;
    color: #fff;
}

/* Divider between voice/camera and submit */
.ebs-search-divider {
    width: 1px;
    height: 22px;
    background: #e2e5ea;
    margin: 0 4px;
    flex-shrink: 0;
}

/* ── Voice Recording State ───────────────────────────────── */
.ebs-search-action.ebs-voice.listening {
    background: #fee2e2;
    color: #dc2626;
    animation: ebs-pulse 1.2s ease-in-out infinite;
}

@keyframes ebs-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .3); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

/* ── Suggestions Dropdown ────────────────────────────────── */
.ebs-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(26, 26, 46, .12);
    z-index: 1060;
    max-height: 340px;
    overflow-y: auto;
    display: none;
    padding: 6px 0;
}

.ebs-suggestions.show { display: block; }

.ebs-suggestion-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background .15s;
    gap: 10px;
    text-decoration: none;
    color: inherit;
}

.ebs-suggestion-item:hover,
.ebs-suggestion-item.active {
    background: #f5f6fa;
}

.ebs-suggestion-item i {
    color: #99a0ad;
    font-size: 1rem;
    flex-shrink: 0;
}

.ebs-suggestion-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
    color: #1a1a2e;
}

.ebs-suggestion-cat {
    font-size: .75rem;
    color: #99a0ad;
    flex-shrink: 0;
    background: #f0f2f5;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── Image Search Modal ──────────────────────────────────── */
.ebs-img-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 46, .55);
    z-index: 1080;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.ebs-img-modal-overlay.show { display: flex; }

.ebs-img-modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 460px;
    padding: 28px;
    position: relative;
    box-shadow: 0 20px 60px rgba(26, 26, 46, .25);
    animation: ebs-modal-in .3s ease;
}

@keyframes ebs-modal-in {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ebs-img-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f0f2f5;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #7b8498;
    transition: background .2s;
    font-size: 1.1rem;
}

.ebs-img-modal-close:hover { background: #e2e5ea; }

.ebs-img-modal h5 {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 1.15rem;
    color: #1a1a2e;
}

.ebs-img-modal .ebs-img-subtitle {
    color: #7b8498;
    font-size: .875rem;
    margin-bottom: 20px;
}

/* Drop zone */
.ebs-drop-zone {
    border: 2px dashed #cdd1da;
    border-radius: 16px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafbfc;
    position: relative;
}

.ebs-drop-zone:hover,
.ebs-drop-zone.drag-over {
    border-color: var(--bs-primary, #5b6abf);
    background: rgba(91, 106, 191, .04);
}

.ebs-drop-zone .ebs-drop-icon {
    font-size: 2.5rem;
    color: #b0b7c8;
    margin-bottom: 8px;
}

.ebs-drop-zone .ebs-drop-text {
    font-size: .9rem;
    color: #7b8498;
    margin-bottom: 12px;
}

.ebs-drop-zone .ebs-drop-text strong { color: var(--bs-primary, #5b6abf); }

.ebs-drop-zone .ebs-drop-hint {
    font-size: .8rem;
    color: #99a0ad;
}

.ebs-drop-zone .btn { position: relative; z-index: 2; }

/* Image preview inside drop zone */
.ebs-img-preview {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ebs-img-preview img {
    max-width: 200px;
    max-height: 160px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
}

.ebs-img-preview .ebs-analyzing {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .9rem;
    color: var(--bs-primary, #5b6abf);
    font-weight: 500;
}

.ebs-img-error {
    display: none;
    color: #dc2626;
    font-size: .875rem;
    text-align: center;
    margin-top: 12px;
}

/* Camera button row */
.ebs-img-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.ebs-img-actions .btn {
    flex: 1;
    border-radius: 12px;
    padding: 10px;
    font-weight: 600;
    font-size: .9rem;
}

/* ── Voice Listening Overlay (inline feedback) ───────────── */
.ebs-voice-feedback {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e2e5ea;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(26, 26, 46, .12);
    z-index: 1060;
    padding: 16px 20px;
    display: none;
    align-items: center;
    gap: 12px;
}

.ebs-voice-feedback.show { display: flex; }

.ebs-voice-bars {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.ebs-voice-bar {
    width: 3px;
    border-radius: 2px;
    background: #dc2626;
    animation: ebs-bar-bounce .5s ease-in-out infinite alternate;
}

.ebs-voice-bar:nth-child(1) { height: 8px; animation-delay: 0s; }
.ebs-voice-bar:nth-child(2) { height: 16px; animation-delay: .1s; }
.ebs-voice-bar:nth-child(3) { height: 24px; animation-delay: .2s; }
.ebs-voice-bar:nth-child(4) { height: 16px; animation-delay: .3s; }
.ebs-voice-bar:nth-child(5) { height: 8px; animation-delay: .4s; }

@keyframes ebs-bar-bounce {
    from { height: 4px; }
    to { height: 20px; }
}

.ebs-voice-feedback-text {
    flex: 1;
    font-size: .9rem;
    color: #1a1a2e;
}

.ebs-voice-feedback-text em {
    font-style: normal;
    color: #99a0ad;
}

/* ── Hero Search Enhancements ────────────────────────────── */
.hero-search-enhanced .ebs-search-group {
    border-width: 0;
    box-shadow: 0 4px 24px rgba(26, 26, 46, .12);
    padding: 2px 4px 2px 20px;
}

.hero-search-enhanced .ebs-search-group input[type="text"] {
    font-size: 1.1rem;
    padding: 14px 0;
}

.hero-search-enhanced .ebs-search-action { width: 40px; height: 40px; }
.hero-search-enhanced .ebs-search-action.ebs-submit { width: 42px; height: 42px; }

.hero-search-enhanced .ebs-suggestions {
    border-radius: 16px;
    top: calc(100% + 6px);
}

/* ── Mobile Search Bar (below navbar) ────────────────────── */
.ebs-mobile-search-bar {
    background: #fff;
    padding: 10px 0;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 56px;
    z-index: 1019;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}

.ebs-mobile-search-bar .ebs-search-group {
    border-width: 1.5px;
}

.ebs-mobile-search-bar .ebs-search-group input[type="text"] {
    font-size: .9rem;
    padding: 8px 0;
}

.ebs-mobile-search-bar .ebs-search-action {
    width: 30px;
    height: 30px;
}

.ebs-mobile-search-bar .ebs-search-action.ebs-submit {
    width: 32px;
    height: 32px;
}

[data-bs-theme="dark"] .ebs-mobile-search-bar {
    background: #1a1a2e;
    border-bottom-color: rgba(255, 255, 255, .06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

/* ── Dark Mode ───────────────────────────────────────────── */
[data-bs-theme="dark"] .ebs-search-group {
    background: #2a2a3e;
    border-color: #3a3a4e;
}

[data-bs-theme="dark"] .ebs-search-group:focus-within {
    border-color: #7b8abf;
    box-shadow: 0 0 0 4px rgba(123, 138, 191, .15);
}

[data-bs-theme="dark"] .ebs-search-group input[type="text"] {
    color: #e5e5f0;
}

[data-bs-theme="dark"] .ebs-search-group input::placeholder {
    color: #6b6b80;
}

[data-bs-theme="dark"] .ebs-search-action:hover {
    background: #3a3a4e;
    color: #c5c5d5;
}

[data-bs-theme="dark"] .ebs-search-divider {
    background: #3a3a4e;
}

[data-bs-theme="dark"] .ebs-suggestions {
    background: #22223a;
    border-color: #3a3a4e;
}

[data-bs-theme="dark"] .ebs-suggestion-item:hover,
[data-bs-theme="dark"] .ebs-suggestion-item.active {
    background: #2a2a3e;
}

[data-bs-theme="dark"] .ebs-suggestion-text {
    color: #e5e5f0;
}

[data-bs-theme="dark"] .ebs-voice-feedback {
    background: #22223a;
    border-color: #3a3a4e;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 575.98px) {
    .ebs-mobile-search-bar { top: 52px; padding: 8px 0; }
    .ebs-search-group { padding: 0 3px 0 12px; }
    .ebs-search-group input[type="text"] { font-size: .875rem; padding: 9px 0; }
    .ebs-search-action { width: 30px; height: 30px; }
    .ebs-search-action.ebs-submit { width: 32px; height: 32px; }
    .ebs-search-divider { height: 18px; margin: 0 2px; }
    .ebs-suggestions { border-radius: 12px; }
    .ebs-suggestion-item { padding: 8px 12px; }
    .ebs-img-modal { padding: 20px; border-radius: 16px; }
    .ebs-drop-zone { padding: 24px 16px; }
}
