/* AI Chatbot Widget Styles */

.aichat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Toggle Button */
.aichat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.aichat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.aichat-toggle svg {
    width: 28px;
    height: 28px;
    color: white;
    position: absolute;
    transition: all 0.3s ease;
}

.aichat-toggle .aichat-icon-chat {
    opacity: 1;
    transform: rotate(0deg);
}

.aichat-toggle .aichat-icon-close {
    opacity: 0;
    transform: rotate(180deg);
}

.aichat-toggle.active .aichat-icon-chat {
    opacity: 0;
    transform: rotate(-180deg);
}

.aichat-toggle.active .aichat-icon-close {
    opacity: 1;
    transform: rotate(0deg);
}

/* Chat Window */
.aichat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: aichat-slide-up 0.3s ease;
}

.aichat-window.show {
    display: flex;
}

@keyframes aichat-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.aichat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aichat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aichat-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.aichat-avatar svg {
    width: 28px;
    height: 28px;
}

.aichat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aichat-status {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aichat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    animation: aichat-pulse 2s infinite;
}

@keyframes aichat-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.aichat-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.aichat-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
}

.aichat-minimize svg {
    width: 20px;
    height: 20px;
}

/* Messages */
.aichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aichat-messages::-webkit-scrollbar {
    width: 6px;
}

.aichat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aichat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.aichat-message {
    display: flex;
    gap: 10px;
    animation: aichat-message-appear 0.3s ease;
}

@keyframes aichat-message-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aichat-user-message {
    flex-direction: row-reverse;
}

.aichat-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aichat-user-message .aichat-message-avatar {
    background: #e5e7eb;
}

.aichat-message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.aichat-user-message .aichat-message-avatar svg {
    color: #6b7280;
}

.aichat-message-content {
    max-width: 70%;
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.aichat-user-message .aichat-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.aichat-message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Typing Indicator */
.aichat-typing {
    padding: 0 20px 10px;
    background: #f9fafb;
}

.aichat-typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.aichat-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #667eea;
    animation: aichat-typing 1.4s infinite;
}

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

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

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

/* Input Form */
.aichat-input-form {
    padding: 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.aichat-input-wrapper {
    display: flex;
    gap: 8px;
    background: #f3f4f6;
    padding: 8px;
    border-radius: 24px;
}

.aichat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
    color: #1f2937;
}

.aichat-input::placeholder {
    color: #9ca3af;
}

.aichat-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aichat-send-button:hover {
    transform: scale(1.05);
}

.aichat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aichat-send-button svg {
    width: 20px;
    height: 20px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aichat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .aichat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
    }
    
    .aichat-toggle {
        width: 55px;
        height: 55px;
    }
}
