/* ======================================
   Enhanced Search & Bot Interface Styles
   ====================================== */

/* Search Modal Styles */
.modal-search-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-search-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
    padding-left: 16px;
    padding-right: 16px;
}

.search-modal-content {
    background-color: #ffffff;
    border-radius: 12px;
    width: 100%;
    max-width: 960px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
}

/* Search Header */
.search-modal-header {
    padding: 20px 28px 12px;
    border-bottom: 1px solid #eef0f3;
    background: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #2f5597;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-close-btn {
    background: transparent;
    border: none;
    color: #666;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.search-close-btn:hover {
    color: #333;
}

/* Search Input Container */
.search-input-container {
    padding: 14px 24px 22px;
    background: #f7f8fb;
    border-bottom: 1px solid #eef0f3;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-input-wrapper:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.search-input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(47, 85, 151, 0.12);
}

.search-input-wrapper .search-icon {
    color: #7a8499;
    font-size: 18px;
    margin-right: 12px;
    flex-shrink: 0;
}

.search-input-wrapper:focus-within .search-icon {
    color: #2f5597;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    padding: 2px 0;
    background: transparent;
    color: #2b3140;
}

.search-input-wrapper input::placeholder {
    color: #9aa3b5;
}

.search-loading-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #2f5597;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    flex-shrink: 0;
}

.search-loading-spinner.active {
    display: block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Search Results Container */
.search-results-container {
    padding: 20px 28px 24px;
    overflow-y: auto;
    max-height: calc(85vh - 210px);
    min-height: 260px;
    background: #ffffff;
}

.search-results-container::-webkit-scrollbar {
    width: 8px;
}

.search-results-container::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.search-results-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Search Result Item */
.search-result-item {
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    background: #f9f9f9;
    transition: all 0.2s ease;
    cursor: pointer;
}

.search-result-item:hover {
    background: #ffffff;
    border-color: #2f5597;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.search-result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.search-result-title {
    font-size: 15px;
    font-weight: 600;
    color: #2f5597;
    margin: 0;
}

.search-result-page-badge {
    background: #e8f0f7;
    color: #2f5597;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.search-result-snippet {
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    margin: 8px 0;
}

.search-result-snippet mark {
    background: #ffd966;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
    color: #333;
}

.search-result-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: #999;
}

.search-result-location {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-result-location i {
    color: #2f5597;
    font-size: 11px;
}

.search-result-link {
    color: #2f5597;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.search-result-link:hover {
    color: #1e3a6b;
    text-decoration: underline;
}

/* Empty State */
.search-empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #8a93a5;
}

.search-empty-state i {
    font-size: 64px;
    color: #d4d8e1;
    margin-bottom: 18px;
    display: block;
}

.search-empty-state h4 {
    font-size: 20px;
    color: #3a4150;
    margin-bottom: 10px;
    font-weight: 700;
}

.search-empty-state p {
    font-size: 14px;
    color: #8a93a5;
}

/* No Results State */
.search-no-results {
    text-align: center;
    padding: 35px 20px;
}

.search-no-results i {
    font-size: 44px;
    color: #ddd;
    margin-bottom: 12px;
    display: block;
}

.search-no-results h4 {
    font-size: 16px;
    color: #666;
    margin-bottom: 6px;
}

.search-no-results p {
    font-size: 13px;
    color: #999;
    margin: 0;
}

/* Search Stats */
.search-stats {
    padding: 12px 25px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    font-size: 12px;
    color: #666;
}

.search-stats strong {
    color: #333;
    font-weight: 600;
}

/* ======================================
   Bot Interface Styles
   ====================================== */

/* Help Popup */
.help-popup {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    background: #fff;
    width: 260px;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.help-popup .popup-inner h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2f5597;
}

.help-popup p {
    margin: 4px 0 12px 0;
    font-size: 13px;
    color: #666;
}

.popup-btn {
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    border: none;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.popup-btn.main {
    background: #2f5597;
    color: #fff;
}

.popup-btn.main:hover {
    background: #1e3a6b;
    box-shadow: 0 2px 8px rgba(47, 85, 151, 0.3);
}

.popup-btn.secondary {
    background: #f0f0f0;
    color: #333;
}

.popup-btn.secondary:hover {
    background: #e0e0e0;
}

.help-popup .agent-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: absolute;
    bottom: -15px;
    right: -15px;
}

/* Chat Bubble */
.chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #2f5597;
    color: #fff;
    padding: 12px 16px;
    border-radius: 20px;
    display: none;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(47, 85, 151, 0.3);
    z-index: 99990;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
}

.chat-bubble:hover {
    box-shadow: 0 8px 20px rgba(47, 85, 151, 0.4);
}

.chat-bubble img.agent-img-small {
    width: 35px;
    height: 35px;
    border-radius: 50%;
}

/* Modal Chat */
.modal-chat {
    display: none;
    position: fixed;
    z-index: 99998;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content-chat {
    background-color: #fff;
    margin: 0;
    padding: 0;
    border: none;
    height: 90%;
    max-height: 90vh;
    width: 95%;
    max-width: 450px;
    overflow: hidden;
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content-chat .close {
    position: absolute;
    right: 12px;
    top: 12px;
    color: #999;
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s ease;
    line-height: 1;
}

.modal-content-chat .close:hover {
    color: #333;
}

.modal-content-chat iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ======================================
   Responsive Design
   ====================================== */

@media (max-width: 768px) {
    .search-modal-content {
        width: 95%;
        max-height: 90vh;
    }

    .search-modal-header {
        padding: 16px 20px;
    }

    .search-modal-header h3 {
        font-size: 16px;
    }

    .search-input-container {
        padding: 16px 20px;
    }

    .search-results-container {
        padding: 12px 20px;
        max-height: calc(90vh - 170px);
    }

    .search-result-item {
        padding: 10px;
    }

    .search-result-title {
        font-size: 14px;
    }

    .modal-content-chat {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        right: 0;
        border-radius: 0;
    }

    .help-popup {
        width: 240px;
        right: 20px;
        bottom: 20px;
    }

    .chat-bubble {
        right: 20px;
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .search-modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .search-input-wrapper {
        padding: 8px 12px;
    }

    .help-popup {
        width: calc(100vw - 40px);
        max-width: 280px;
    }

    .search-result-snippet {
        font-size: 12px;
    }
}
