/* Genset Chatbot Frontend Styles */

#genset-chatbot-container {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Position variants */
.genset-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

.genset-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

.genset-chatbot-top-right {
    top: 20px;
    right: 20px;
}

.genset-chatbot-top-left {
    top: 20px;
    left: 20px;
}

/* Chat toggle button */
.genset-chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.genset-chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.4);
}

.genset-chatbot-toggle:active {
    transform: scale(0.95);
}

.genset-chatbot-toggle svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s ease;
}

.genset-chatbot-toggle:hover svg {
    transform: scale(1.1);
}

/* Notification dot */
.genset-chatbot-toggle::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 12px;
    height: 12px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: pulse 2s infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.genset-chatbot-toggle.has-notification::after {
    opacity: 1;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
    }
}

/* Chat window */
.genset-chatbot-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    border: 1px solid #e1e5e9;
}

.genset-chatbot-top-right .genset-chatbot-window,
.genset-chatbot-top-left .genset-chatbot-window {
    bottom: auto;
    top: 80px;
}

.genset-chatbot-bottom-left .genset-chatbot-window,
.genset-chatbot-top-left .genset-chatbot-window {
    right: auto;
    left: 0;
}

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

/* Chat header */
.genset-chatbot-header {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.genset-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.genset-chatbot-header h3::before {
    content: '🤖';
    font-size: 20px;
}

.genset-chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.genset-chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Chat messages */
.genset-chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.genset-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.genset-chatbot-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.genset-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.message.typing {
    background: white;
    color: #666;
    align-self: flex-start;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 6px;
    padding: 16px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

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

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    opacity: 0.7;
}

.message.user .message-time {
    color: rgba(255, 255, 255, 0.8);
}

/* Input area */
.genset-chatbot-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e1e5e9;
    border-radius: 0 0 12px 12px;
    display: flex;
    gap: 10px;
    align-items: center;
}

#genset-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: #f8f9fa;
}

#genset-chatbot-input:focus {
    border-color: #0073aa;
    background: white;
}

#genset-chatbot-input::placeholder {
    color: #999;
}

#genset-chatbot-send {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#genset-chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

#genset-chatbot-send:active {
    transform: scale(0.95);
}

#genset-chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

#genset-chatbot-send::before {
    content: '➤';
    font-size: 16px;
    font-weight: bold;
}

/* Welcome message */
.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.welcome-message h4 {
    margin: 0 0 10px 0;
    color: #0073aa;
    font-size: 16px;
}

.welcome-message p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

/* Quick reply buttons */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    justify-content: center;
}

.quick-reply {
    background: white;
    border: 1px solid #0073aa;
    color: #0073aa;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.quick-reply:hover {
    background: #0073aa;
    color: white;
    transform: translateY(-1px);
}

/* Error message */
.error-message {
    background: #ffe6e6;
    color: #d63638;
    border: 1px solid #ffb3b3;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin: 10px 0;
}

/* Responsive design */
@media (max-width: 480px) {
    .genset-chatbot-window {
        width: calc(100vw - 40px);
        height: 60vh;
        max-height: 500px;
    }
    
    .genset-chatbot-bottom-right,
    .genset-chatbot-bottom-left {
        right: 10px;
        left: 10px;
    }
    
    .genset-chatbot-top-right,
    .genset-chatbot-top-left {
        right: 10px;
        left: 10px;
    }
    
    .genset-chatbot-toggle {
        width: 50px;
        height: 50px;
    }
    
    .genset-chatbot-toggle svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 768px) {
    .genset-chatbot-window {
        width: 320px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .genset-chatbot-window {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .genset-chatbot-messages {
        background: #1a202c;
    }
    
    .message.bot {
        background: #374151;
        color: #e2e8f0;
        border-color: #4b5563;
    }
    
    .message.typing {
        background: #374151;
        color: #9ca3af;
        border-color: #4b5563;
    }
    
    .genset-chatbot-input-container {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    #genset-chatbot-input {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    #genset-chatbot-input::placeholder {
        color: #9ca3af;
    }
    
    .quick-reply {
        background: #374151;
        color: #60a5fa;
        border-color: #60a5fa;
    }
    
    .quick-reply:hover {
        background: #60a5fa;
        color: #1a202c;
    }
}
