/* AI Chat Widget Styles */

/* Chat Button */
.chat-widget-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: chatButtonPulse 2s ease-in-out infinite;
}

.chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
}

.chat-widget-button svg {
    width: 28px;
    height: 28px;
    fill: #ffffff;
}

@keyframes chatButtonPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(102, 126, 234, 0.7);
    }
}

/* Greeting Popup */
.chat-greeting-popup {
    position: fixed;
    bottom: 100px;
    right: 100px;
    width: 340px;
    background: linear-gradient(135deg, rgba(10, 10, 26, 0.98) 0%, rgba(20, 20, 40, 0.98) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 16px 48px rgba(102, 126, 234, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 9997;
    opacity: 0;
    transform: translateX(20px) translateY(10px);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    overflow: hidden;
}

.chat-greeting-popup.show {
    opacity: 1;
    transform: translateX(0) translateY(0);
    pointer-events: auto;
}

.chat-greeting-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-greeting-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(240, 147, 251, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    padding: 0;
}

.chat-greeting-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.chat-greeting-info {
    flex: 1;
}

.chat-greeting-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: #ffffff;
    margin-bottom: 3px;
    letter-spacing: 0.3px;
}

.chat-greeting-role {
    font-size: 0.85rem;
    color: #38f9d7;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-greeting-role::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38f9d7;
    animation: statusPulse 2s ease-in-out infinite;
}

.chat-greeting-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-greeting-close:hover {
    background: rgba(255, 87, 108, 0.2);
    border-color: rgba(255, 87, 108, 0.4);
    transform: scale(1.05);
}

.chat-greeting-message {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 18px 20px;
}

/* Chat Window */
.chat-widget-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatWindowSlideIn 0.3s ease-out;
}

.chat-widget-window.open {
    display: flex;
}

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

/* Chat Header */
.chat-widget-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-widget-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.3);
    overflow: hidden;
}

.chat-widget-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-widget-info {
    flex: 1;
}

.chat-widget-name {
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
    margin-bottom: 2px;
}

.chat-widget-status {
    font-size: 0.8rem;
    color: #38f9d7;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-widget-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #38f9d7;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.chat-widget-minimize {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
}

.chat-widget-minimize:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.chat-widget-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.5);
    border-radius: 3px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    overflow: hidden;
}

.chat-message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-message.bot .chat-message-avatar {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

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

.chat-message-content {
    max-width: 75%;
}

.chat-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.bot .chat-message-bubble {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message.user .chat-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-message-time {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    padding: 0 4px;
}

.chat-message.user .chat-message-time {
    text-align: right;
}

/* Typing Indicator */
.chat-typing-indicator {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 75%;
}

.chat-typing-indicator.show {
    display: flex;
}

.chat-typing-dots {
    display: flex;
    gap: 4px;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b0b0c0;
    animation: typingDot 1.4s ease-in-out infinite;
}

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

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Quick Replies */
.chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chat-quick-reply {
    padding: 8px 14px;
    background: rgba(102, 126, 234, 0.15);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 20px;
    color: #ffffff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-quick-reply:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

/* Chat Input */
.chat-widget-input-area {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.02);
}

.chat-widget-input-form {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.chat-widget-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: all 0.2s ease;
}

.chat-widget-input:focus {
    border-color: rgba(102, 126, 234, 0.5);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-widget-input::placeholder {
    color: #888;
}

.chat-widget-send {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-widget-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.chat-widget-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.chat-widget-send svg {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-widget-button {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chat-greeting-popup {
        bottom: 90px;
        right: 20px;
        left: 20px;
        width: auto;
        max-width: none;
    }
    
    .chat-widget-window {
        bottom: 90px;
        right: 20px;
        width: calc(100vw - 40px);
        max-width: 380px;
        height: calc(100vh - 140px);
        max-height: 550px;
    }
}

@media (max-width: 480px) {
    .chat-widget-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chat-widget-button {
        bottom: 16px;
        right: 16px;
    }
    
    .chat-greeting-popup {
        bottom: 80px;
        right: 16px;
        left: 16px;
        width: auto;
        max-width: none;
    }
}
