/* Chat Widget Styles - Matches Portfolio Theme */

#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Chat Button */
#chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0077ff 0%, #0055cc 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 119, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 119, 255, 0.4);
}

#chat-button img {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
}

/* Chat Container */
#chat-container {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

#chat-container.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
#chat-header {
    background: linear-gradient(135deg, #0077ff 0%, #0055cc 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

#chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#chat-close:hover {
    opacity: 1;
}

/* Chat Messages */
#chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-items: flex-end;
}

.chat-message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: #0077ff;
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Styling for markdown elements inside chat bubbles */
.message-bubble p {
    margin: 0 0 8px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble em {
    font-style: italic;
}

.message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-bubble ul, .message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin-bottom: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    min-width: 70px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.typing-indicator.active {
    display: block;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Chat Input */
#chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: #0077ff;
}

#chat-send {
    /*still can't get my mobile button correct -.-*/
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: #0077ff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#chat-send:hover:not(:disabled) {
    background: #0055cc;
    transform: scale(1.05);
}

#chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#chat-send img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
    position: relative;
    left: 1px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #chat-container {
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for better mobile support */
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
        max-height: 100dvh;
    }
    
    #chat-widget {
        bottom: 20px;
        right: 20px;
    }
    
    #chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Scrollbar Styling */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Suggested Questions Styles */
.chat-suggestions {
    padding: 15px;
    margin: 10px 0;
    max-width: 100%;
    overflow: hidden;
}

.suggestions-header {
    font-size: 0.95rem;
    margin-bottom: 15px;
    color: #555;
    font-weight: 500;
}

.featured-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
    overflow: hidden;
}

.suggestion-chip {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 16px;
    padding: 8px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    font-family: inherit;
    text-align: left;
    line-height: 1.3;
    max-width: 100%;
    word-wrap: break-word;
}

.suggestion-chip:hover {
    background: #e8e8e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.suggestion-chip.featured {
    background: linear-gradient(135deg, #0077ff 0%, #0055cc 100%);
    color: white;
    border: none;
    font-weight: 500;
}

.suggestion-chip.featured:hover {
    background: linear-gradient(135deg, #0066ee 0%, #0044bb 100%);
    box-shadow: 0 3px 10px rgba(0, 119, 255, 0.3);
}

.categories-header {
    font-size: 0.9rem;
    margin: 15px 0 10px 0;
    color: #666;
    font-weight: 500;
}

.categorized-questions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-section {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    background: #fafafa;
}

.category-section summary {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #444;
    list-style: none;
    user-select: none;
    font-size: 0.9rem;
}

.category-section summary::-webkit-details-marker {
    display: none;
}

.category-section summary:hover {
    color: #0077ff;
}

.category-icon {
    font-size: 1.1rem;
}

.category-name {
    flex: 1;
}

.category-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .chat-suggestions {
        padding: 10px;
    }
    
    .suggestions-header {
        font-size: 0.9rem;
    }
    
    .suggestion-chip {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}
