/**
 * SmartWeb Core Chat Widget Styles
 */

/* Widget Container */
.smartweb-chat-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 350px;
}

.smartweb-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
}

.smartweb-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
}

.smartweb-chat-widget.top-right {
    top: 20px;
    right: 20px;
}

.smartweb-chat-widget.top-left {
    top: 20px;
    left: 20px;
}

/* Toggle Button */
.smartweb-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
}

.smartweb-chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.smartweb-chat-toggle .chat-icon,
.smartweb-chat-toggle .close-icon {
    transition: opacity 0.2s ease;
}

.smartweb-chat-widget.open .chat-icon {
    opacity: 0;
}

.smartweb-chat-widget.open .close-icon {
    opacity: 1;
}

.smartweb-chat-widget:not(.open) .close-icon {
    opacity: 0;
    position: absolute;
}

/* Chat Window */
.smartweb-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
}

.smartweb-chat-widget.open .smartweb-chat-window {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.smartweb-chat-header {
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.smartweb-chat-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 6px;
}

/* Messages */
.smartweb-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 350px;
}

.smartweb-chat-welcome {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.smartweb-chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

.smartweb-chat-message.user {
    justify-content: flex-end;
}

.smartweb-chat-message.user .message-content {
    background: #7c3aed;
    color: white;
    margin-left: 40px;
}

.smartweb-chat-message.assistant .message-content {
    background: #f3f4f6;
    color: #374151;
    margin-right: 40px;
}

.smartweb-chat-message.system .message-content {
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    margin: 0 20px;
    text-align: center;
}

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

.smartweb-chat-message.user .message-avatar {
    order: 2;
    margin-left: 8px;
    margin-right: 0;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 250px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: center;
}

/* Typing Indicator */
.smartweb-chat-typing {
    display: flex;
    margin-bottom: 16px;
}

.typing-indicator {
    display: flex;
    padding: 12px 16px;
    background: #f3f4f6;
    border-radius: 18px;
    margin-left: 40px;
}

.typing-indicator span {
    display: block;
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    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;
}

/* Input Form */
.smartweb-chat-form {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

.smartweb-chat-input-container {
    display: flex;
    align-items: center;
    background: #f9fafb;
    border-radius: 24px;
    padding: 4px;
}

.smartweb-chat-voice {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.smartweb-chat-voice:hover,
.smartweb-chat-voice.active {
    background: #e5e7eb;
    color: #374151;
}

.smartweb-chat-input {
    flex: 1;
    border: none;
    background: none;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    resize: none;
}

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

.smartweb-chat-send {
    background: #7c3aed;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: background 0.2s ease;
    margin-left: 8px;
}

.smartweb-chat-send:hover {
    background: #6d28d9;
}

.smartweb-chat-send:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Mobile Responsive */
@media (max-width: 480px) {
    .smartweb-chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .smartweb-chat-window {
        width: 100%;
        height: 400px;
        bottom: 70px;
        right: 0;
        left: 0;
    }
    
    .message-content {
        max-width: 200px;
    }
}

/* Scroll Styles */
.smartweb-chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

.smartweb-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

.smartweb-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}