/**
 * Listeo AI Chat Styles
 *
 * Copied 1:1 from test-api.php for consistency
 */

/* Chat Wrapper */
.listeo-ai-chat-wrapper {
    width: 100%;
    margin: 0 auto;
}

.listeo-ai-chat-wrapper i {
    font-family: "Font Awesome 6 Free" !important;
}

/* Chat Container */
.listeo-ai-chat-container {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.1);
}

/* Chat Header */
.listeo-ai-chat-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.listeo-ai-chat-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.listeo-ai-chat-clear-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.listeo-ai-chat-clear-btn:hover {
    color: #333;
}

.listeo-ai-chat-clear-btn i {
    display: inline-block;
}

/* Messages Area */
.listeo-ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f8f8;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}


/* Individual Messages */
.listeo-ai-chat-message {
    line-height: 24px;
    display: flex;
    width: 100%;
}

.listeo-ai-chat-message-user {
    color: var(--listeo-primary-color);
    background: var(--listeo-primary-color-light);
    padding: 12px 16px;
    border-radius: 6px;
    max-width: 80%;
    width: fit-content;
    margin-left: auto;
}

.listeo-ai-chat-message.listeo-ai-chat-message-system,
.listeo-ai-chat-message-assistant {
    color: #444;
    background: #f6f6f6;
    padding: 12px 16px;
    border-radius: 6px;
    max-width: 100%;
    width: fit-content;
    margin-right: auto;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    background: #fff;
}

.listeo-ai-chat-message-assistant.chat-message-results {
padding: 0;
    background: transparent;
    box-shadow: none; 
}

.listeo-ai-chat-message-system {
    color: #666;
    /* font-size: 14px; */
    /* font-style: italic; */
}

.listeo-ai-chat-message-label {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.listeo-ai-chat-message-content {
    line-height: 23px;
    font-size: 14px;
}

.listeo-ai-chat-message-content p {
    margin: 0 0 15px 0;
    font-size: 14px;
    line-height: 23px;
}

.listeo-ai-chat-message-content p:last-child {
    margin-bottom: 0;
}

.listeo-ai-chat-message-content strong {
    font-weight: 600;
}

.listeo-ai-chat-message-content a {
    color: var(--listeo-primary-color);
    text-decoration: underline;
}

.listeo-ai-chat-message-content a:hover {
    color: #1a252f;
}

/* Listing Grid Styles */
.listeo-ai-results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 0;
}

.elementor .listeo-ai-listing-item,
.listeo-ai-listing-item {
    background: white;
    border-radius: 6px;
    border: none;
    display: flex;
    align-items: stretch;
    min-height: 90px;
    text-decoration: none !important;
    color: inherit;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
}
.elementor .listeo-ai-listing-item:hover,
.listeo-ai-listing-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    border-color: #d0d0d0;
}

.listeo-ai-listing-hidden {
    display: none;
}

.listeo-ai-listing-thumbnail {
    width: 90px;
    height: 90px;
    flex-shrink: 0;
    overflow: hidden;
    padding: 10px;
}

body .listeo-ai-listing-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.listeo-ai-listing-details {
    flex: 1;
    display: flex;
    padding: 12px 16px;
    padding-left: 0;
    align-items: stretch;
    gap: 0;
    text-decoration: none;
    word-break: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.listeo-ai-listing-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
    color: #333;
}

body p.listeo-ai-listing-excerpt {
    color: #666;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listeo-ai-listing-meta {
    display: flex;
    gap: 0;
    font-size: 13px;
    color: #888;
    flex-wrap: wrap;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listeo-ai-listing-meta span {
    display: flex;
    align-items: baseline;
    gap: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.listeo-ai-listing-meta i {
    width: 12px;
    text-align: center;
    font-size: 11px;
    color: #b4b4b4;
}

.listeo-ai-listing-rating {
    color: #f59e0b;
    font-weight: 500;
}

.listeo-ai-listing-rating i {
    color: #f59e0b !important;
}

/* Show More Button */
.listeo-ai-show-more-btn {
    display: block;
    width: auto;
    margin-top: 12px;
    padding: 6px 16px;
    background: white;
    border:none;
    color: var(--listeo-primary-color);
    background: var(--listeo-primary-color-light);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    margin: 0 auto;
    margin-top: 15px;
    border-radius: 50px;
}

.listeo-ai-show-more-btn:hover {

}

/* Loading Spinner */
.listeo-ai-chat-loading {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e5e5e5;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 5px;
    vertical-align: middle;
    top: -1px;
    position: relative;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

div.listeo-ai-chat-message.listeo-ai-chat-message-assistant[id^="loading"] {
    background: none;
    box-shadow: none;
    padding: 0;
    font-weight: 500;
    color: #666;
}

/* Input Area */
.listeo-ai-chat-input-wrapper {
    border-top: 1px solid #e5e5e5;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
}

.listeo-ai-chat-input {
    flex: 1;
    padding: 12px 15px;
    border: none !important;
    border-radius: 6px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    min-height: 48px;
    height: 48px;
    min-width: auto;
    margin-bottom: 0;
    background: #f5f5f5;
    box-shadow: none !important;
    border-radius: 50px;
    padding-right: 50px;
    line-height: 22px;
}

.listeo-ai-chat-input:focus {
    outline: none;
    border-color: #d0d0d0;
}

.listeo-ai-chat-send-btn {
    background: #222;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    flex-shrink: 0;
    font-weight: 500;
    align-self: stretch;
    transition: 0.2s;
    position: absolute;
    right: 24px;
    line-height: 24px;
    top: 50%;
    border-radius: 50px;
    height: 34px;
    width: 34px;
    transform: translateY(-50%);
}

.listeo-ai-chat-send-btn:hover {
    background: #222;
}

.listeo-ai-chat-send-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Best Match Badge - Simple and Clean (matches frontend) */
.match-badge.best {
    font-weight: 600;
    font-size: 12px;
    padding: 0px 8px;
    line-height: 16px;
    text-shadow: none;
    border-radius: 50px;
    background: #00b54d21;
    display: flex;
    justify-content: center;
    align-content: center;
    flex-wrap: wrap;
    color: #27ae60;
    height: 21px;
    position: relative;
    top: -1px;
    display: inline-block;
}

/* Listing structure adjustments for sidebar */
.listeo-ai-listing-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.listeo-ai-listing-sidebar {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
    gap: 4px;
    min-width: 100px;
}

.listeo-ai-listing-sidebar:empty {
    display: none;
}

/* Disabled State */
.listeo-ai-chat-disabled {
    background: #fff3cd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: #856404;
}
.listeo-ai-chat-disabled p { margin: 0}
/* Listing items without thumbnails */
.listeo-ai-listing-item:not(:has(.listeo-ai-listing-thumbnail)) .listeo-ai-listing-details {
    padding-left: 16px;
}

/* Listing Context Load Button */
.listeo-ai-chat-message-listing-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 15px 0;
}

.listeo-ai-listing-context-title {
    font-size: 16px;
    color: #333;
    font-weight: 500;
    margin: 0 0 12px 0;
    text-align: center;
}
#listing-context-btn { text-align: center;}
.listeo-ai-load-listing-btn {
    background: #222;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.listeo-ai-load-listing-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.listeo-ai-load-listing-btn:active {
    transform: scale(0.98);
}

.listeo-ai-load-listing-btn svg {
    flex-shrink: 0;
}

.listeo-ai-load-listing-btn.loading {
    opacity: 0.7;
    cursor: wait;
}

.listeo-ai-load-listing-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}



/*--------------------------------------
# Popular Searches
---------------------------------------*/
.listeo-ai-popular-searches {
    margin-top: 30px;
    padding: 0;
}

.popular-searches-header {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.popular-searches-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.popular-search-tag {
    background: var(--listeo-primary-color-light);
    border-radius: 50px;
    padding: 5px 13px;
    font-size: 13px;
    color: var(--listeo-primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    border: none;
    line-height: 22px;
}

.popular-search-tag:hover {
    background: var(--listeo-primary-color, #222);
    color: white;
    border-color: var(--listeo-primary-color, #222);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.popular-search-tag:active {
    transform: translateY(0);
}

/*--------------------------------------
# Elementor Custom Styles
---------------------------------------*/
.elementor-chat-style .listeo-ai-chat-wrapper { height: auto !important;}

.elementor-chat-style .listeo-ai-chat-wrapper .listeo-ai-chat-messages {
    max-height: 0;
    height: 400px;
    padding: 0 20px; /* Keep horizontal padding, remove vertical */
    transition: max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.elementor-chat-style .listeo-ai-chat-wrapper.expanded .listeo-ai-chat-messages {
    max-height: 400px;
    padding: 20px;
}
.elementor-chat-style .listeo-ai-chat-container {
    border: none;
    zoom: 1.12;
    position: relative;
}

.elementor-chat-style .listeo-ai-chat-container {border-radius: 10px; transition: 0.3s;}
.elementor-chat-style .listeo-ai-chat-wrapper.expanded .listeo-ai-chat-container {border-radius: 10px;}

.elementor-chat-style .listeo-ai-chat-messages {
    background: transparent;
}

.elementor-chat-style .listeo-ai-chat-wrapper.expanded .listeo-ai-chat-messages {

}

.elementor-chat-style .listeo-ai-chat-input {
    background: transparent;
}

.elementor-chat-style .listeo-ai-chat-input-wrapper {
    border: none;
    background: transparent;
    border-radius: 10px;
    padding: 12px;
}

.elementor-chat-style .listeo-ai-chat-input-wrapper {
}

.elementor-chat-style .listeo-ai-chat-message.listeo-ai-chat-message-system, 
.elementor-chat-style .listeo-ai-chat-message-assistant {
box-shadow: none;
background: transparent;
padding: 12px 0;
}

.elementor-chat-style .listeo-ai-chat-title {
    display: none;
}

.elementor-chat-style .listeo-ai-chat-header {
    border: none;
    background: transparent;
    position: absolute;
    width: 20px;
    height: 25px;
    opacity: 0;transition: 0.3s;z-index: 111;
    right: 62px;bottom: 23px;
    display: none;overflow: hidden;padding: 0;
}

.elementor-chat-style .listeo-ai-chat-wrapper.expanded  .listeo-ai-chat-header{
    opacity: 1;
    display: block;
}

.elementor-chat-style .listeo-ai-chat-message-system { display: none; }

.elementor-chat-style .listeo-ai-chat-message-user {
    padding: 8px 15px; border-radius: 30px;
}

.elementor .elementor-chat-style  .listeo-ai-listing-item {
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.07);
}

.elementor .elementor-chat-style  .listeo-ai-listing-item:hover {
    border: 1px solid #ddd;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
}
.elementor-chat-style .listeo-ai-chat-clear-btn { position: absolute; top: 0;}

.elementor .listeo-ai-listing-item.listeo-ai-listing-item.listeo-ai-listing-hidden { display: none; }