/**
 * Digital Munk Chatbot Styles
 * Modern, responsive styling for the chatbot interface
 */

/* Chatbot Toggle Button */
.chatbot-toggler {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #e74c3c, #3498db);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: center;
    outline: none;
    animation: float 6s ease-in-out infinite;
}

.chatbot-toggler:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.chatbot-toggler i {
    font-size: 26px;
    transition: transform 0.3s ease;
}

.chatbot-toggler:hover i {
    transform: scale(1.1);
}

/* Chatbot Container */
.chatbot {
    position: fixed;
    right: 30px;
    bottom: 100px;
    width: 380px;
    max-width: calc(100% - 60px);
    height: 600px;
    max-height: 80vh;
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.15);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.show-chatbot .chatbot {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Chatbot Header */
.chatbot header {
    background: linear-gradient(135deg, #e74c3c, #3498db);
    padding: 16px 24px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.chatbot header h2 {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
}

.chatbot header .close-btn {
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot header .close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chatbox */
.chatbox {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f7fa;
    scroll-behavior: smooth;
}

/* Custom scrollbar for chatbox */
.chatbox::-webkit-scrollbar {
    width: 6px;
}

.chatbox::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 3px;
}

.chatbox::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chatbox::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Chat Messages */
.chatbox .chat {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
    transform-origin: bottom;
}

.chatbox .incoming {
    justify-content: flex-start;
    animation: slideInLeft 0.3s ease-out;
}

.chatbox .outgoing {
    justify-content: flex-end;
    animation: slideInRight 0.3s ease-out;
}

.chatbox .chat p {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9375rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.chatbox .incoming p {
    background: #fff;
    color: #333;
    border-top-left-radius: 4px;
    margin-left: 8px;
}

.chatbox .outgoing p {
    background: linear-gradient(135deg, #e74c3c, #ff6b6b);
    color: #fff;
    border-top-right-radius: 4px;
    margin-right: 8px;
}

/* .chatbox .incoming .material-symbols-outlined {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #e74c3c, #3498db);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    align-self: flex-end;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
} */

/* Chat Input Area */
.chat-input {
    position: relative;
    padding: 16px;
    background: #fff;
    border-top: 1px solid #eaeef2;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.02);
    z-index: 5;
}

.chat-input textarea {
    flex: 1;
    min-height: 24px;
    max-height: 120px;
    border: 1px solid #e0e6ed;
    border-radius: 24px;
    padding: 12px 48px 12px 18px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #333;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.chat-input textarea:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.chat-input textarea::placeholder {
    color: #99a3ba;
}

.chat-input .mic-btn,
.chat-input .send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: #fff;
    background: linear-gradient(135deg, #3498db, #5dade2);
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.chat-input .mic-btn {
    background: #6c757d;
    margin-right: 8px;
}

.chat-input .mic-btn.listening {
    background: #e74c3c;
    animation: pulse 1.5s infinite;
}

.chat-input .send-btn {
    background: linear-gradient(135deg, #e74c3c, #ff6b6b);
}

.chat-input .mic-btn:hover,
.chat-input .send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-input .mic-btn:active,
.chat-input .send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    padding: 8px 16px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-left: 8px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

/* Animations */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

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

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

/* Responsive Design */
@media (max-width: 576px) {
    .chatbot {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .chatbot header {
        border-radius: 0;
    }
    
    .chatbox {
        padding: 15px;
    }
    
    .chatbox .chat p {
        max-width: 90%;
    }
    
    .chatbot-toggler {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
    }
    
    .chatbot header .close-btn {
        display: flex;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chatbot {
        background: #1e293b;
        border-color: #2d3748;
    }
    
    .chatbot header {
        background: linear-gradient(135deg, #c53030, #2b6cb0);
    }
    
    .chatbox {
        background: #0f172a;
    }
    
    .chatbox .incoming p {
        background: #334155;
        color: #e2e8f0;
    }
    
    .chat-input {
        background: #1e293b;
        border-color: #2d3748;
    }
    
    .chat-input textarea {
        background: #1e293b;
        border-color: #2d3748;
        color: #e2e8f0;
    }
    
    .typing-indicator {
        background: #334155;
    }
    
    .typing-indicator span {
        background: #94a3b8;
    }
}