/* AI Assistant Chat Styles */

/* Ask AI Button - Desktop */
#askAIButtonDesktop {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 14px 0px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.18);
}

#askAIButtonDesktop:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.26);
}

#askAIButtonIcon {
    width: 18px;
    height: 18px;
    fill: white;
}

#askAIButtonTextDiv {
    white-space: nowrap;
    line-height: 1;
}

/* Ask AI Button - Mobile */
.askAIContactButton {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    border: none !important;
}

/* AI Chat Modal Overlay */
#aiChatModalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

/* AI Chat Modal */
#aiChatModal {
    background: linear-gradient(180deg, #ffffff 0%, #fbfbff 100%);
    width: 100%;
    max-width: 640px;
    height: 90vh;
    /* fallback */
    max-height: 720px;
    /* fallback */
    height: min(720px, 90vh);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    box-shadow: 0 28px 90px rgba(2, 6, 23, 0.28);
    animation: aiModalFadeIn 200ms ease;
}

/* AI Chat Modal Header */
#aiChatModalHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.12);
}

#aiChatModalHeaderInfo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#aiChatModalTitle {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

#aiChatModalSubtitle {
    font-size: 13px;
    opacity: 0.9;
}

#closeAIChatModal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#closeAIChatModal:hover {
    background: rgba(255, 255, 255, 0.3);
}

#closeAIChatModal svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* AI Chat Disclaimer */
#aiChatDisclaimer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #fff7e6;
    color: #92400e;
    font-size: 12px;
    line-height: 1.45;
    border-bottom: 1px solid #fde68a;
    border-left: 3px solid #f59e0b;
}

/* Preview Questions */
#aiChatPreviewQuestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.aiChatPreviewQuestion {
    padding: 8px 14px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    max-width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.04);
}

.aiChatPreviewQuestion:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

/* Messages Container */
#aiChatMessagesContainer {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px;
    background: radial-gradient(1200px 600px at 50% -120px, rgba(99, 102, 241, 0.12) 0%, rgba(99, 102, 241, 0) 55%),
        linear-gradient(180deg, #f8fafc 0%, #f6f7fb 100%);
    border-top: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    scroll-behavior: smooth;
}

#aiChatMessages {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Individual Messages */
.aiChatMessage {
    display: flex;
    width: fit-content;
    max-width: 82%;
}

.aiChatMessage.user {
    align-self: flex-end;
    margin-left: auto;
}

.aiChatMessage.assistant {
    align-self: flex-start;
    margin-right: auto;
}

.aiChatMessageContent {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.08);
}

.aiChatMessage.user .aiChatMessageContent {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.aiChatMessage.assistant .aiChatMessageContent {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.aiChatMessage.assistant.streaming .aiChatMessageContent {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(229, 231, 235, 0.9);
}

/* Typing Indicator */
.typingIndicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typingIndicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typingIndicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typingIndicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Container */
#aiChatInputContainer {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 16px 22px;
    background: #ffffff;
    border-top: 1px solid #eef2f7;
    box-shadow: 0 -6px 24px rgba(15, 23, 42, 0.08);
}

#aiChatInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d9ddea;
    border-radius: 24px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    background: #f8fafc;
}

#aiChatInput:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
    background: #ffffff;
}

#aiChatInput::placeholder {
    color: #94a3b8;
}

#aiChatSendButton {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

#aiChatSendButton:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

#aiChatSendButton:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#aiChatSendButton svg {
    width: 20px;
    height: 20px;
    color: white;
    margin-left: 2px;
}

#aiChatMessagesContainer::-webkit-scrollbar {
    width: 10px;
}

#aiChatMessagesContainer::-webkit-scrollbar-track {
    background: transparent;
}

#aiChatMessagesContainer::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 2px solid #f6f7fb;
}

#aiChatMessagesContainer::-webkit-scrollbar-thumb:hover {
    background: #a5b4fc;
}

@keyframes aiModalFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    #aiChatModalOverlay {
        padding: 0;
    }

    #aiChatModal {
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    #askAIButtonDesktop {
        display: none;
    }
}

@media screen and (max-width: 500px) {
    #aiChatModalHeader {
        padding: 14px 16px;
    }

    #aiChatModalTitle {
        font-size: 16px;
    }

    #aiChatModalSubtitle {
        font-size: 12px;
    }

    #aiChatDisclaimer {
        padding: 10px 16px;
        font-size: 11px;
    }

    #aiChatPreviewQuestions {
        padding: 12px 16px;
    }

    .aiChatPreviewQuestion {
        font-size: 12px;
        padding: 6px 12px;
    }

    #aiChatMessagesContainer {
        padding: 16px;
    }

    .aiChatMessageContent {
        font-size: 13px;
        padding: 10px 14px;
    }

    #aiChatInputContainer {
        padding: 12px 16px;
        gap: 10px;
    }

    #aiChatInput {
        padding: 10px 14px;
        font-size: 14px;
    }

    #aiChatSendButton {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }
}

/* Desktop: Show Ask AI button below share */
@media screen and (min-width: 769px) {
    #shareProfileAndFavoriteButtonsOuterDiv {
        flex-direction: column;
        gap: 12px;
    }
}