/* =================================================================
   FINAL COMPLETE STYLESHEET
   ================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- Global & Core --- */
#floating-tray, #chat-overlay {
    font-family: 'Inter', sans-serif;
}
.hidden {
    display: none !important;
}

/* --- Floating Tray Placement Classes --- */
#floating-tray {
    position: fixed;
    z-index: 999;
    display: flex;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}
#floating-tray.position-bottom-right { bottom: 20px; right: 20px; }
#floating-tray.position-top-center { top: 20px; left: 50%; transform: translateX(-50%); }
#floating-tray.position-top-left { top: 20px; left: 20px; }
.action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s ease;
}
.action-btn:hover { background-color: #e4e6eb; }
.action-btn svg, .action-btn .custom-icon {
    width: 22px;
    height: 22px;
    color: #111827;
}

/* --- Main Chat Pop-up --- */
#chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}
#chat-popup {
    background: #f9fafb;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 80vh;
    max-height: 720px;
}
#chat-header {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
#agent-avatar { width: 40px; height: 40px; border-radius: 50%; margin-right: 12px; object-fit: cover; }
#header-title-area { flex-grow: 1; }
#chat-title { font-weight: 600; font-size: 1.1em; color: #111827; }
#close-chat-btn { background: #f0f2f5; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border: none; cursor: pointer; color: #6b7280; }
#close-chat-btn:hover { background-color: #e4e6eb; }

/* --- Chat Body & Views --- */
#chat-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#search-view, #chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* --- Search View & Slide Animation --- */
#search-view {
    position: relative; /* Container for the animation panels */
    overflow: hidden;   /* Hides the panel that is off-screen */
    flex: 1;
}

#search-filters-panel, #search-results-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    background-color: #f9fafb;
}

#search-results-panel {
    transform: translateX(100%); /* Start with results panel off-screen */
    padding: 0;
}

#search-view.show-results #search-filters-panel {
    transform: translateX(-100%); /* Slide filters left and out */
}
#search-view.show-results #search-results-panel {
    transform: translateX(0);     /* Slide results in from the right */
}


/* --- Polished & Centered Search Filters --- */
#search-filters-panel {
    padding: 24px;
    align-items: center; /* Horizontally center all direct children */
    gap: 16px;
    justify-content: flex-start;
}

.filter-card {
    width: 100%;
    max-width: 400px; /* Give filters a consistent max width */
}
.filter-label {
    display: block;
    font-weight: 500;
    font-size: 0.9em;
    margin-bottom: 8px;
    color: #6b7280;
}
.filter-select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #d1d5db;
    background-color: #fff;
    font-size: 1em;
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1.5em 1.5em;
}

#perform-search-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 40px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    width: auto; /* Let button size to its content, not full-width */
}


/* --- Search Results & Rich Cards --- */
#search-results-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}
#back-to-filters-btn {
    background: #e5e7eb;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#search-results-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.listing-card-search {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.listing-card-search:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.listing-card-search img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid #f3f4f6;
}
.listing-card-search-info {
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.listing-card-search-title {
    font-weight: 600;
    font-size: 1.125rem;
    line-height: 1.4;
    color: #1f2937;
    margin: 0;
}
.listing-card-search-id {
    font-size: 0.85rem;
    color: #6b7280;
    margin-top: -4px;
    margin-bottom: 6px;
}
.listing-card-search-meta {
    display: flex;
    gap: 18px;
    padding-top: 10px;
    font-size: 0.9rem;
    color: #4b5563;
    border-top: 1px solid #e5e7eb;
}
.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.meta-item svg {
    width: 18px;
    height: 18px;
    color: #9ca3af;
    stroke-width: 1.4;
}

#search-results-list .placeholder {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

/* --- Chat View --- */
#chat-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#chat-messages { flex: 1; overflow-y: auto; padding: 20px; }
#chat-input-container { padding: 8px 16px 16px 16px; border-top: 1px solid #e5e7eb; }
#chat-input { width: 100%; padding: 12px 16px; border-radius: 25px; border: 1px solid #d1d5db; }







/* Fix visibility for all button SVGs */
.action-btn svg,
#close-chat-btn svg,
#back-to-filters-btn svg {
    stroke: #111827;
    color: #111827;
    width: 20px;
    height: 20px;
    display: block;
}

/* Ensure they don’t get overridden by global filters */
svg {
    stroke: currentColor;
    fill: none;
}
