/* chatforge/chatforge/public/css/search_overlay.css
   Kersten UK AI Search — Premium Consultant UI
*/

/* ──────────────────────────────────────────────
   1. OVERLAY BACKDROP
────────────────────────────────────────────── */
.cf-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(14, 20, 18, 0.46);
    backdrop-filter: blur(10px) saturate(110%);
    -webkit-backdrop-filter: blur(10px) saturate(110%);
    z-index: 99999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 7vh;
}

.cf-search-overlay.active {
    display: flex;
    animation: cfSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cf-search-overlay.closing {
    animation: cfSlideOut 0.15s ease-in forwards;
}

@keyframes cfSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes cfSlideOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-8px); }
}

/* ──────────────────────────────────────────────
   2. MAIN CONTAINER
────────────────────────────────────────────── */
.cf-search-container {
    width: 100%;
    max-width: 700px;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ──────────────────────────────────────────────
   3. SEARCH BAR
────────────────────────────────────────────── */
.cf-search-bar-wrap {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(22px) saturate(135%);
    -webkit-backdrop-filter: blur(22px) saturate(135%);
    border: 1px solid rgba(255,255,255,0.72);
    border-radius: 16px;
    padding: 10px 18px;
    box-shadow: 0 18px 55px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.76);
    transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
    gap: 10px;
}

.cf-search-bar-wrap:focus-within {
    background: rgba(255,255,255,0.94);
    border-color: rgba(228, 77, 46, 0.42);
    box-shadow: 0 18px 55px rgba(0,0,0,0.20), 0 0 0 3px rgba(228,77,46,0.10), inset 0 1px 0 rgba(255,255,255,0.86);
}

.cf-search-icon {
    width: 20px;
    height: 20px;
    stroke: #aaa;
    flex-shrink: 0;
    transition: stroke 0.18s;
}

.cf-search-bar-wrap:focus-within .cf-search-icon {
    stroke: #E44D2E;
}

.cf-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #111;
    outline: none;
    caret-color: #E44D2E;
    font-family: inherit;
    min-width: 0;
}

.cf-search-input::placeholder { color: #bbb; font-size: 15px; }

.cf-clear-btn {
    display: none;
    background: none;
    border: none;
    color: #ccc;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}
.cf-clear-btn:hover { color: #E44D2E; }

.cf-enter-hint {
    display: none;
    background: rgba(228,77,46,0.09);
    border: 1px solid rgba(228,77,46,0.18);
    border-radius: 7px;
    padding: 4px 10px;
    font-size: 12px;
    color: #E44D2E;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.cf-esc-badge {
    background: rgba(255,255,255,0.52);
    border: 1px solid rgba(30,30,30,0.08);
    border-radius: 6px;
    padding: 4px 9px;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    white-space: nowrap;
}
.cf-esc-badge:hover { border-color: #E44D2E; color: #E44D2E; }

/* ──────────────────────────────────────────────
   4. RESULTS PANEL
────────────────────────────────────────────── */
.cf-results-wrap {
    background: rgba(255,255,255,0.90);
    backdrop-filter: blur(24px) saturate(135%);
    -webkit-backdrop-filter: blur(24px) saturate(135%);
    border: 1px solid rgba(255,255,255,0.68);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.20), inset 0 1px 0 rgba(255,255,255,0.68);
    display: none;
    flex-direction: column;
    overflow: hidden;
    max-height: 72vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #e0e0e0 transparent;
}

.cf-results-wrap::-webkit-scrollbar { width: 5px; }
.cf-results-wrap::-webkit-scrollbar-thumb { background: rgba(60,60,60,0.20); border-radius: 4px; }

/* ──────────────────────────────────────────────
   5. RECENT SEARCHES
────────────────────────────────────────────── */
.cf-recent-wrap {
    padding: 18px 20px;
    display: none;
}

.cf-recent-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #bbb;
    font-weight: 700;
    margin-bottom: 10px;
}

.cf-recent-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cf-recent-chip {
    background: rgba(255,255,255,0.58);
    border: 1px solid rgba(30,30,30,0.08);
    border-radius: 20px;
    color: #555;
    font-size: 12px;
    padding: 5px 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.cf-recent-chip:hover {
    background: rgba(255,245,243,0.90);
    border-color: #E44D2E;
    color: #E44D2E;
}

/* ──────────────────────────────────────────────
   6. LOADING / STATUS
────────────────────────────────────────────── */
.cf-status-wrap {
    display: none;
    flex-direction: column;
    gap: 0;
}

/* Skeleton rows */
.cf-skeleton-rows {
    display: flex;
    flex-direction: column;
}

.cf-skel-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0;
    border-bottom: 1px solid rgba(30,30,30,0.06);
    height: 70px;
}

.cf-skel-box {
    width: 70px;
    height: 70px;
    flex-shrink: 0;
    border-right: 1px solid rgba(30,30,30,0.06);
    background: linear-gradient(90deg, rgba(255,255,255,0.35) 25%, rgba(255,255,255,0.70) 50%, rgba(255,255,255,0.35) 75%);
    background-size: 200% 100%;
    animation: cfShimmer 1.5s infinite;
}

.cf-skel-lines {
    flex: 1;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cf-skel-line {
    height: 11px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.35) 25%, rgba(255,255,255,0.78) 50%, rgba(255,255,255,0.35) 75%);
    background-size: 200% 100%;
    animation: cfShimmer 1.5s infinite;
}
.cf-skel-line.short { width: 35%; }
.cf-skel-line.med   { width: 60%; }
.cf-skel-line.long  { width: 80%; }

@keyframes cfShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* Status message bar */
.cf-status-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid rgba(30,30,30,0.06);
    background: rgba(255,255,255,0.46);
}

.cf-status-dot {
    width: 8px;
    height: 8px;
    background: #E44D2E;
    border-radius: 50%;
    flex-shrink: 0;
    animation: cfDotPulse 1.4s ease-in-out infinite;
}

@keyframes cfDotPulse {
    0%, 100% { transform: scale(0.75); opacity: 0.5; }
    50%       { transform: scale(1.2);  opacity: 1; }
}

.cf-status-text {
    font-size: 13px;
    color: #888;
    font-weight: 500;
    animation: cfFadeText 0.35s ease-out;
}

@keyframes cfFadeText {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────────
   7. CONSULTANT ANSWER (AI response)
────────────────────────────────────────────── */
.cf-consultant-box {
    display: none;
    padding: 22px 26px 24px;
    border-left: 2px solid rgba(228,77,46,0.78);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.62) 0%, rgba(255,255,255,0.34) 100%),
        rgba(255,255,255,0.44);
    animation: cfFadeIn 0.3s ease-out;
}

@keyframes cfFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cf-consultant-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.cf-consultant-avatar {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(228,77,46,0.18);
    border-radius: 50%;
    background: #fff5f3;
    color: #E44D2E;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 800;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.06);
}

.cf-consultant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cf-consultant-kicker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #6d6d6d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.09em;
    line-height: 1;
    text-transform: uppercase;
}

.cf-consultant-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #E44D2E;
    box-shadow: 0 0 0 4px rgba(228,77,46,0.10);
}

.cf-consultant-answer {
    font-size: 15px;
    line-height: 1.72;
    color: #141414;
}

.cf-consultant-answer p {
    margin: 0 0 10px 0;
}

.cf-consultant-answer p:last-child {
    margin-bottom: 0;
}

.cf-consultant-answer strong {
    color: #E44D2E;
    font-weight: 600;
}

.cf-summary-link {
    color: #E44D2E;
    text-decoration: none;
    border-bottom: 1px solid rgba(228, 77, 46, 0.28);
    transition: border-color 0.15s, background 0.15s;
}

.cf-summary-link:hover {
    background: rgba(228, 77, 46, 0.08);
    border-bottom-color: rgba(228, 77, 46, 0.72);
}

.cf-hit {
    border-radius: 4px;
    background: rgba(255, 214, 102, 0.42);
    color: inherit;
    padding: 0 2px;
}

/* ──────────────────────────────────────────────
   8. PRODUCTS / RESULTS STRIP
────────────────────────────────────────────── */
.cf-results-header {
    display: none;
    align-items: center;
    gap: 7px;
    padding: 12px 20px 8px;
    background: rgba(255,255,255,0.42);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #9c9c9c;
    font-weight: 700;
    border-top: 1px solid rgba(30,30,30,0.07);
}

.cf-results-header svg {
    stroke: #bbb;
    width: 13px;
    height: 13px;
    fill: none;
}

.cf-results-list {
    display: flex;
    flex-direction: column;
}

/* ──────────────────────────────────────────────
   9. RESULT ITEMS
────────────────────────────────────────────── */
.cf-search-item {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding-left: 14px;
    border-bottom: 1px solid rgba(30,30,30,0.06);
    transition: background 0.12s, transform 0.12s;
    outline: none;
}

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

.cf-search-item:hover,
.cf-search-item.focused {
    background: rgba(255,247,245,0.76);
}

.cf-item-thumb {
    width: 58px;
    height: 58px;
    flex-shrink: 0;
    background: rgba(255,255,255,0.42);
    border: 1px solid rgba(30,30,30,0.06);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.cf-item-thumb svg {
    width: 22px;
    height: 22px;
    stroke: #E44D2E;
    fill: none;
    opacity: 0.5;
}

.cf-item-content {
    flex: 1;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.cf-item-badge {
    display: inline-block;
    align-self: flex-start;
    background: rgba(228, 77, 46, 0.08);
    border: 1px solid rgba(228, 77, 46, 0.18);
    color: #E44D2E;
    font-size: 9px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.06em;
    border-radius: 4px;
    padding: 2px 6px;
    margin-bottom: 4px;
}

.cf-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.cf-item-desc {
    font-size: 12px;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cf-item-arrow {
    padding: 0 18px;
    color: #e0e0e0;
    font-size: 20px;
    flex-shrink: 0;
    transition: color 0.15s;
}

.cf-search-item:hover .cf-item-arrow,
.cf-search-item.focused .cf-item-arrow { color: #E44D2E; }

/* ──────────────────────────────────────────────
   10. RESULTS COUNT & NO RESULTS
────────────────────────────────────────────── */
.cf-results-count {
    display: none;
    font-size: 11px;
    color: #9f9f9f;
    padding: 8px 20px 6px;
    letter-spacing: 0.02em;
}

.cf-contact-cta {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 14px 14px;
    padding: 10px 12px;
    border: 1px solid rgba(228,77,46,0.14);
    border-radius: 10px;
    background: rgba(255,255,255,0.52);
    color: #6f6f6f;
    font-size: 12px;
}

.cf-contact-link {
    color: #E44D2E;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.cf-contact-link:hover {
    text-decoration: underline;
}

.cf-no-results {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 52px 24px;
    text-align: center;
}

.cf-no-results svg {
    width: 38px;
    height: 38px;
    stroke: #e0e0e0;
    fill: none;
    margin-bottom: 14px;
}

.cf-no-results-title {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 8px;
}

.cf-no-results-sub {
    font-size: 13px;
    color: #E44D2E;
    text-decoration: none;
}

.cf-no-results-sub:hover { text-decoration: underline; }

/* ──────────────────────────────────────────────
   11. NAVBAR TRIGGER STYLING
   (makes the Frappe navbar search look like an AI trigger)
────────────────────────────────────────────── */
.navbar-modal-search[data-cf-hijacked],
input[name="query"][data-cf-hijacked] {
    cursor: pointer !important;
    caret-color: transparent !important;
    user-select: none !important;
}

.cf-navbar-search-trigger {
    min-width: 168px !important;
    max-width: 168px !important;
    padding-right: 34px !important;
    text-overflow: ellipsis !important;
}

.cf-navbar-search-trigger::placeholder {
    color: #777 !important;
    opacity: 1 !important;
}

.cf-navbar-search-wrap {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    width: 168px !important;
    min-width: 168px !important;
}

.cf-navbar-search-wrap .cf-navbar-search-trigger {
    width: 100% !important;
}

.cf-navbar-shortcut {
    position: absolute;
    right: 7px;
    top: 50%;
    width: 21px;
    height: 21px;
    transform: translateY(-50%);
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 6px;
    background: rgba(255,255,255,0.78);
    color: #777;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    padding: 0;
    text-align: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.cf-navbar-shortcut:hover,
.cf-navbar-shortcut:focus {
    border-color: rgba(228,77,46,0.36);
    background: rgba(255,245,243,0.96);
    color: #E44D2E;
    outline: none;
}

/* ──────────────────────────────────────────────
   12. RESPONSIVE
────────────────────────────────────────────── */
@media (max-width: 768px) {
    .cf-search-overlay { padding-top: 4vh; }
    .cf-search-container { padding: 0 10px; }
    .cf-search-container { max-width: 100%; }
    .cf-enter-hint { display: none !important; }
    .cf-results-wrap { max-height: 78vh; }
    .cf-contact-cta {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
}
