/* ================================================================
   BAJRA BOOKSTORE SMART SEARCH — STYLESHEET
   Accents: #8E1616 (Crimson), #D4AF37 (Gold), #140305 (Dark)
   ================================================================ */

.bajra-smart-search-form {
    position: relative;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
}

.bajra-search-input-wrap {
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    padding: 2px 4px 2px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.25s ease;
}

.bajra-search-input-wrap:focus-within {
    border-color: #8E1616;
    box-shadow: 0 0 0 3px rgba(142, 22, 22, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
}

.bajra-search-icon {
    font-size: 16px;
    color: #8E1616;
    margin-right: 10px;
}

.bajra-search-field {
    flex: 1;
    width: 100% !important;
    border: 1.5px solid #CBD5E1 !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04) !important;
    background: #ffffff !important;
    font-size: 14.5px !important;
    font-family: inherit !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
    opacity: 1 !important;
    caret-color: #601320 !important;
    padding: 10px 44px 10px 16px !important;
    height: 44px !important;
    line-height: normal !important;
    border-radius: 24px !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    min-width: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.bajra-search-field:focus {
    border-color: #601320 !important;
    box-shadow: 0 0 0 3px rgba(96, 19, 32, 0.12), 0 3px 10px rgba(0, 0, 0, 0.06) !important;
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

.bajra-search-field::placeholder {
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
    font-size: 13.5px !important;
    opacity: 1 !important;
}

.bajra-search-input-wrap .bajra-search-field {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 8px 10px !important;
    height: auto !important;
}

/* Dark mode theme compatibility */
body.bb-dark .bajra-search-field,
[data-theme="dark"] .bajra-search-field,
.bb-redesign.bb-dark .bajra-search-field {
    background: #1f1819 !important;
    border-color: #4a3437 !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
    caret-color: #E8B96A !important;
}

body.bb-dark .bajra-search-field::placeholder,
[data-theme="dark"] .bajra-search-field::placeholder,
.bb-redesign.bb-dark .bajra-search-field::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
}

.bajra-search-clear {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 14px;
    padding: 6px 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.bajra-search-clear:hover {
    color: #8E1616;
}

.bajra-search-submit {
    background: #8E1616 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 18px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease, transform 0.1s ease !important;
    white-space: nowrap;
}

.bajra-search-submit:hover {
    background: #D4AF37 !important;
    color: #140305 !important;
}

/* --- LIVE SEARCH DROPDOWN --- */
.bajra-live-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bb-surface, #ffffff);
    border: 1px solid var(--bb-border, #edf2f7);
    border-radius: var(--bb-radius-lg, 16px);
    box-shadow: var(--bb-shadow-lg, 0 16px 40px rgba(0, 0, 0, 0.16));
    z-index: 100000;
    overflow: hidden;
    max-height: 480px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.bajra-dropdown-header {
    padding: 11px 18px;
    background: var(--bb-surface-subtle, #fdfcfb);
    border-bottom: 1px solid var(--bb-border, #f1f5f9);
    font-size: 12px;
    font-weight: 600;
    color: var(--bb-text-muted, #64748b);
}

.bajra-dropdown-header strong {
    color: var(--bb-crimson, #9E1B32);
}

.bajra-dropdown-list {
    overflow-y: auto;
    max-height: 380px;
}

.bajra-search-result-item {
    display: flex;
    align-items: center;
    padding: 10px 18px;
    border-bottom: 1px solid var(--bb-border, #f8fafc);
    text-decoration: none !important;
    color: inherit !important;
    transition: background-color 0.15s ease;
    gap: 14px;
}

.bajra-search-result-item:last-child {
    border-bottom: none;
}

.bajra-search-result-item:hover,
.bajra-search-result-item.is-selected {
    background-color: var(--bb-surface-subtle, rgba(225, 29, 72, 0.05));
}

.bajra-item-thumb {
    width: 44px;
    height: 60px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bb-surface-subtle, #f1f5f9);
    border: 1px solid var(--bb-border, rgba(0,0,0,0.06));
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.bajra-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bajra-item-details {
    flex: 1;
    min-width: 0;
}

.bajra-item-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--bb-text, #1e293b);
    margin: 0 0 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.bajra-search-result-item:hover .bajra-item-title,
.bajra-search-result-item.is-selected .bajra-item-title {
    color: var(--bb-crimson, #9E1B32);
}

.bb-search-mark,
.bajra-item-title mark {
    background: rgba(229, 169, 60, 0.28);
    color: inherit;
    font-weight: 800;
    border-radius: 3px;
    padding: 0 2px;
}

[data-theme="dark"] .bb-search-mark,
.dark-mode .bb-search-mark,
[data-theme="dark"] .bajra-item-title mark,
.dark-mode .bajra-item-title mark {
    background: rgba(245, 158, 11, 0.35);
    color: #FBBF24;
}

.bajra-item-author {
    font-size: 12px;
    color: var(--bb-text-muted, #64748b);
    margin: 0 0 4px 0;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bajra-item-cat {
    display: inline-block;
    font-size: 10.5px;
    background: var(--bb-surface-subtle, #f1f5f9);
    color: var(--bb-text-muted, #475569);
    border: 1px solid var(--bb-border, transparent);
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.bajra-item-meta {
    text-align: right;
    flex-shrink: 0;
}

.bajra-item-price,
.bajra-item-price .bb-price-current,
.bajra-item-price .bb-price-ins,
.bajra-item-price strong {
    display: block;
    font-family: var(--bb-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--bb-crimson, #9E1B32);
    letter-spacing: normal !important;
    line-height: 1.2 !important;
}

.bajra-item-price ins {
    text-decoration: none;
    color: var(--bb-crimson, #9E1B32);
    font-size: 13px !important;
    font-weight: 700 !important;
}

.bajra-item-price del,
.bajra-item-price .bb-price-del {
    font-family: var(--bb-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    color: var(--bb-text-muted, #94a3b8) !important;
    margin-right: 4px;
    text-decoration: line-through !important;
}

.bajra-item-stock {
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.bajra-item-stock.in-stock {
    color: #16a34a;
}

.bajra-item-stock.out-of-stock {
    color: #dc2626;
}

.bajra-dropdown-footer {
    padding: 12px 18px;
    background: var(--bb-surface-subtle, #fdfcfb);
    border-top: 1px solid var(--bb-border, #f1f5f9);
    text-align: center;
}

.bajra-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--bb-crimson, #9E1B32) !important;
    text-decoration: none !important;
    transition: transform 0.15s ease;
}

.bajra-view-all-btn:hover {
    color: var(--bb-gold, #D4AF37) !important;
    transform: translateX(3px);
}

.bajra-search-loading,
.bajra-dropdown-empty {
    padding: 24px 18px;
    text-align: center;
    color: var(--bb-text-muted, #64748b);
    font-size: 13.5px;
}

.bajra-dropdown-empty p {
    margin: 0 0 10px 0;
}

/* Category Pill Styling for Zero-Result View */
.bajra-cat-pill {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bb-surface, #ffffff);
    border: 1.5px solid var(--bb-border, #e2e8f0);
    border-radius: 24px;
    color: var(--bb-text, #1e293b) !important;
    text-decoration: none !important;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
}

.bajra-cat-pill:hover {
    border-color: var(--bb-crimson, #8E1616);
    background: var(--bb-crimson, #8E1616);
    color: #ffffff !important;
    transform: translateY(-2px);
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    .bajra-smart-search-form {
        max-width: 100%;
    }
    
    .bajra-search-submit {
        padding: 6px 12px !important;
        font-size: 12px !important;
    }

    .bajra-search-field {
        font-size: 13px !important;
    }

    .bajra-item-thumb {
        width: 36px;
        height: 52px;
    }

    .bajra-item-title {
        font-size: 13px;
    }

    .bajra-item-price {
        font-size: 12px !important;
    }

    .bajra-item-stock {
        font-size: 8.5px !important;
    }
}

/* ================================================================
   SLIDE-DOWN MOBILE SEARCH BAR & GENRE DRAWER STYLES
   ================================================================ */
.bb-mobile-search-dropdown-bar {
    background: #1a1a1a;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.bb-mobile-search-dropdown-bar .bajra-smart-search-form {
    max-width: 100%;
}

.bb-mobile-search-dropdown-bar .bajra-search-input-wrap {
    background: #ffffff;
    border-radius: 20px;
    padding: 2px 6px 2px 14px;
}

/* Slide-out Genre Drawer */
.bb-genre-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1000000;
    display: flex;
    justify-content: flex-end;
}

.bb-genre-drawer-content {
    width: 300px;
    max-width: 85vw;
    height: 100%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.25);
    animation: bbSlideInRight 0.25s ease-out;
}

@keyframes bbSlideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.bb-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #fdfcfb;
    border-bottom: 1px solid #eef2f6;
}

.bb-drawer-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
}

.bb-drawer-close:hover {
    color: #8E1616;
}

.bb-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.bb-drawer-cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.bb-drawer-cat-list li {
    margin-bottom: 8px;
}

.bb-drawer-cat-list a {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.bb-drawer-cat-list a:hover {
    background: #8E1616;
    color: #ffffff !important;
    transform: translateX(4px);
}

/* ================================================================
   SMART SEARCH — HIGHLIGHT, MATCH-FIELD BADGE & DARK MODE STYLES
   ================================================================ */

/* Highlight matched text in result titles */
.bb-search-mark,
.bajra-item-title mark {
    background: rgba(229, 169, 60, 0.28);
    color: inherit;
    font-weight: 800;
    border-radius: 2px;
    padding: 0 2px;
}

[data-theme="dark"] .bb-search-mark,
.dark-mode .bb-search-mark,
.bb-dark .bb-search-mark,
[data-theme="dark"] .bajra-item-title mark,
.dark-mode .bajra-item-title mark,
.bb-dark .bajra-item-title mark {
    background: rgba(245, 158, 11, 0.35) !important;
    color: #FBBF24 !important;
}

/* Match-field badge (Author match / Publisher / Category / ISBN) */
.bb-match-badge {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

.bb-match-author    { background: #dbeafe; color: #1d4ed8; }
.bb-match-publisher { background: #d1fae5; color: #065f46; }
.bb-match-category  { background: #ede9fe; color: #5b21b6; }
.bb-match-isbn      { background: #fef3c7; color: #92400e; }

/* ── Comprehensive Dark Mode Rules for Search Dropdown ── */
[data-theme="dark"] .bajra-live-search-dropdown,
.dark-mode .bajra-live-search-dropdown,
.bb-dark .bajra-live-search-dropdown {
    background: #111827 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75) !important;
}

[data-theme="dark"] .bajra-dropdown-header,
.dark-mode .bajra-dropdown-header,
.bb-dark .bajra-dropdown-header {
    background: rgba(255, 255, 255, 0.04) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #9CA3AF !important;
}

[data-theme="dark"] .bajra-dropdown-header strong,
.dark-mode .bajra-dropdown-header strong,
.bb-dark .bajra-dropdown-header strong {
    color: #FB7185 !important;
}

[data-theme="dark"] .bajra-search-result-item,
.dark-mode .bajra-search-result-item,
.bb-dark .bajra-search-result-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #F3F4F6 !important;
}

[data-theme="dark"] .bajra-search-result-item:hover,
.dark-mode .bajra-search-result-item:hover,
.bb-dark .bajra-search-result-item:hover,
[data-theme="dark"] .bajra-search-result-item.is-selected,
.dark-mode .bajra-search-result-item.is-selected,
.bb-dark .bajra-search-result-item.is-selected {
    background: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="dark"] .bajra-item-title,
.dark-mode .bajra-item-title,
.bb-dark .bajra-item-title,
[data-theme="dark"] .bajra-search-result-item .bajra-item-title,
.dark-mode .bajra-search-result-item .bajra-item-title,
.bb-dark .bajra-search-result-item .bajra-item-title {
    color: #F9FAFB !important; /* Crystal clear bright white */
}

[data-theme="dark"] .bajra-search-result-item:hover .bajra-item-title,
.dark-mode .bajra-search-result-item:hover .bajra-item-title,
.bb-dark .bajra-search-result-item:hover .bajra-item-title,
[data-theme="dark"] .bajra-search-result-item.is-selected .bajra-item-title,
.dark-mode .bajra-search-result-item.is-selected .bajra-item-title,
.bb-dark .bajra-search-result-item.is-selected .bajra-item-title {
    color: #FB7185 !important;
}

[data-theme="dark"] .bajra-item-author,
.dark-mode .bajra-item-author,
.bb-dark .bajra-item-author {
    color: #9CA3AF !important;
}

[data-theme="dark"] .bajra-item-cat,
.dark-mode .bajra-item-cat,
.bb-dark .bajra-item-cat {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #D1D5DB !important;
}

[data-theme="dark"] .bajra-item-price,
.dark-mode .bajra-item-price,
.bb-dark .bajra-item-price,
[data-theme="dark"] .bajra-item-price ins,
.dark-mode .bajra-item-price ins,
.bb-dark .bajra-item-price ins,
[data-theme="dark"] .bajra-item-price .bb-price-ins,
.dark-mode .bajra-item-price .bb-price-ins,
.bb-dark .bajra-item-price .bb-price-ins,
[data-theme="dark"] .bajra-item-price .bb-price-current,
.dark-mode .bajra-item-price .bb-price-current,
.bb-dark .bajra-item-price .bb-price-current {
    color: #FBBF24 !important; /* Glowing warm gold price */
    font-family: var(--bb-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
}

[data-theme="dark"] .bajra-item-price del,
.dark-mode .bajra-item-price del,
.bb-dark .bajra-item-price del,
[data-theme="dark"] .bajra-item-price .bb-price-del,
.dark-mode .bajra-item-price .bb-price-del,
.bb-dark .bajra-item-price .bb-price-del {
    color: #9CA3AF !important;
    font-family: var(--bb-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif) !important;
    font-size: 11px !important;
    font-weight: 400 !important;
}

[data-theme="dark"] .bajra-dropdown-footer,
.dark-mode .bajra-dropdown-footer,
.bb-dark .bajra-dropdown-footer {
    background: rgba(255, 255, 255, 0.04) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .bajra-view-all-btn,
.dark-mode .bajra-view-all-btn,
.bb-dark .bajra-view-all-btn {
    color: #FB7185 !important;
}

[data-theme="dark"] .bajra-item-thumb,
.dark-mode .bajra-item-thumb,
.bb-dark .bajra-item-thumb {
    background: #1F2937 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

