/* AI Search Chat Widget Styles */

/* =================================
   Chat Widget Base Styles
   ================================= */

#aiSearchChatWidget {
    font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* =================================
   Floating Chat Button
   ================================= */

#aiSearchChatButton {
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.5), 0 8px 10px -6px rgba(59, 130, 246, 0.3);
}

#aiSearchChatButton:hover {
    transform: scale(1.1);
    box-shadow: 0 20px 35px -5px rgba(59, 130, 246, 0.6), 0 10px 20px -6px rgba(59, 130, 246, 0.4);
}

#aiSearchChatButton:active {
    transform: scale(1.05);
}

#aiSearchChatButton svg {
    transition: transform 0.3s ease;
}

#aiSearchChatButton:hover svg {
    transform: scale(1.1);
}

/* Pulse animation for the button */
@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

#aiSearchChatButton::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: #3b82f6;
    opacity: 0;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
}

/* Badge styles */
#aiSearchChatBadge {
    animation: badge-pop 0.3s ease-out;
}

@keyframes badge-pop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* =================================
   Chat Window
   ================================= */

#aiSearchChatWindow {
    z-index: 9999;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slide-up-fade 0.3s ease-out;
}

@keyframes slide-up-fade {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =================================
   Chat Header
   ================================= */

#aiSearchChatWindow .rounded-t-2xl {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* =================================
   Chat Messages Area
   ================================= */

#aiSearchChatMessages {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
    scroll-behavior: smooth;
}

#aiSearchChatMessages::-webkit-scrollbar {
    width: 6px;
}

#aiSearchChatMessages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

#aiSearchChatMessages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.2s;
}

#aiSearchChatMessages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Message animations */
#aiSearchChatMessages > div {
    animation: message-appear 0.3s ease-out;
}

@keyframes message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* User message styles */
.bg-blue-600 {
    background-color: #3b82f6;
}

/* AI message styles */
#aiSearchChatMessages .bg-white {
    transition: all 0.2s ease;
}

#aiSearchChatMessages .bg-white:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* =================================
   Property Cards in Chat
   ================================= */

#aiSearchChatMessages a[href^="/Projects/"] {
    transition: all 0.2s ease;
}

#aiSearchChatMessages a[href^="/Projects/"]:hover {
    transform: translateX(2px);
}

#aiSearchChatMessages a[href^="/Projects/"] img {
    transition: transform 0.3s ease;
}

#aiSearchChatMessages a[href^="/Projects/"]:hover img {
    transform: scale(1.05);
}

/* Line clamp utilities */
.line-clamp-1 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
}

.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

/* =================================
   Quick Action Chips
   ================================= */

#aiSearchChatMessages button[onclick^="sendAiSearchMessage"] {
    transition: all 0.2s ease;
}

#aiSearchChatMessages button[onclick^="sendAiSearchMessage"]:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#aiSearchChatMessages button[onclick^="sendAiSearchMessage"]:active {
    transform: translateY(0);
}

/* =================================
   Typing Indicator
   ================================= */

#aiSearchTypingIndicator .animate-bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

/* =================================
   Chat Input Area
   ================================= */

#aiSearchChatInput {
    transition: all 0.2s ease;
    resize: none;
    overflow-y: auto;
}

#aiSearchChatInput:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#aiSearchChatInput::-webkit-scrollbar {
    width: 4px;
}

#aiSearchChatInput::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

#aiSearchChatSendBtn {
    transition: all 0.2s ease;
}

#aiSearchChatSendBtn:hover:not(:disabled) {
    transform: translateY(-1px);
}

#aiSearchChatSendBtn:active:not(:disabled) {
    transform: translateY(0);
}

#aiSearchChatSendBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#aiSearchChatSendBtn svg {
    transition: transform 0.2s ease;
}

#aiSearchChatSendBtn:hover:not(:disabled) svg {
    transform: translateX(2px);
}

/* =================================
   Mobile Responsive Styles
   ================================= */

@media (max-width: 640px) {
    #aiSearchChatWindow {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        animation: mobile-slide-up 0.3s ease-out;
    }

    @keyframes mobile-slide-up {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    #aiSearchChatButton {
        bottom: 1.5rem !important;
        right: 1.5rem !important;
        width: 3.5rem !important;
        height: 3.5rem !important;
    }

    #aiSearchChatButton svg {
        width: 1.75rem !important;
        height: 1.75rem !important;
    }

    #aiSearchChatMessages {
        padding: 1rem;
    }

    #aiSearchChatInput {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Tablet styles */
@media (min-width: 641px) and (max-width: 1024px) {
    #aiSearchChatWindow {
        width: 380px !important;
        height: 550px !important;
    }
}

/* =================================
   Accessibility Enhancements
   ================================= */

/* Focus styles for keyboard navigation */
#aiSearchChatButton:focus,
#aiSearchChatSendBtn:focus,
#aiSearchChatInput:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

button:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    #aiSearchChatWidget *,
    #aiSearchChatWidget *::before,
    #aiSearchChatWidget *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #aiSearchChatButton::before {
        animation: none !important;
    }
}

/* =================================
   Dark Mode Support (Optional)
   ================================= */

@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode support */
    /*
    #aiSearchChatWindow {
        background: #1f2937;
        color: #f9fafb;
    }

    #aiSearchChatMessages {
        background: #111827;
    }

    #aiSearchChatMessages .bg-white {
        background: #374151 !important;
        color: #f9fafb;
        border-color: #4b5563 !important;
    }

    #aiSearchChatInput {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    #aiSearchChatInput::placeholder {
        color: #9ca3af;
    }
    */
}

/* =================================
   Utility Classes
   ================================= */

.shadow-3xl {
    box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.3);
}

/* Hidden utility override for flex display */
#aiSearchChatWindow.hidden {
    display: none !important;
}

#aiSearchChatWindow.flex {
    display: flex !important;
}

/* =================================
   Loading States
   ================================= */

.ai-search-loading {
    pointer-events: none;
    opacity: 0.6;
}

.ai-search-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =================================
   Print Styles
   ================================= */

@media print {
    #aiSearchChatWidget {
        display: none !important;
    }
}
