/* Blue Aura's Hidden Paradise - Chatbot Styles */
/* Updated: Reduced bottom padding on chat-actions */
#local-chatbot {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 10000 !important;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4A90E2, #7BB3F0);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(74, 144, 226, 0.3);
    transition: all 0.3s ease;
    color: white;
    font-size: 24px;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(74, 144, 226, 0.4);
}

.chat-container {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 550px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    padding-bottom: 0;
}

.chat-header {
    background: linear-gradient(135deg, #4A90E2, #7BB3F0);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 15px 15px 0 0;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

#chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

#chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0; /* Critical for flex children to shrink properly */
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.chat-message.user {
    background: linear-gradient(135deg, #4A90E2, #7BB3F0);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.chat-message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.chat-message.agent {
    background: linear-gradient(135deg, #2ECC71, #27AE60);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.chat-message.system {
    align-self: center;
    max-width: 90%;
    text-align: center;
}

.system-message {
    background: #E8F4FD;
    color: #4A90E2;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #B3D9FF;
}

.chat-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.chat-button {
    background: white;
    border: 2px solid #4A90E2;
    color: #4A90E2;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.chat-button:hover {
    background: #4A90E2;
    color: white;
    transform: translateY(-1px);
}

.chat-input {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0; /* Prevent input area from shrinking */
}

#chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#chat-input:focus {
    border-color: #4A90E2;
}

#chat-send {
    background: linear-gradient(135deg, #4A90E2, #7BB3F0);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#chat-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.chat-actions {
    padding: 15px 20px 10px 20px !important;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 0 !important;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    flex-shrink: 0; /* Prevent actions area from shrinking */
}

/* Ensure chat-actions is the last child and extends to bottom - tighter spacing */
#local-chatbot .chat-container .chat-actions,
#integrated-chatbot .chat-container .chat-actions,
.chat-container > .chat-actions:last-child {
    padding-bottom: 10px !important;
    margin-bottom: 0 !important;
}

/* Fix layout: Ensure proper flex distribution for floating chatbot */
#local-chatbot .chat-container,
#integrated-chatbot .chat-container {
    display: flex !important;
    flex-direction: column !important;
    height: 550px !important;
    overflow: hidden !important;
}

/* Messages area should expand to fill available space - remove max-height constraint */
#local-chatbot .chat-messages,
#integrated-chatbot .chat-messages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* Input and actions should not shrink - keep them fixed at bottom */
#local-chatbot .chat-input,
#integrated-chatbot .chat-input {
    flex-shrink: 0 !important;
}

#local-chatbot .chat-actions,
#integrated-chatbot .chat-actions {
    flex-shrink: 0 !important;
}

.agent-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #4A90E2, #7BB3F0);
    color: white;
}

.agent-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
    background: linear-gradient(135deg, #3a7bc8, #6ba0d8);
}

.reset-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #6c757d;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.reset-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.reset-btn i {
    margin: 0;
}

.end-chat-btn {
    flex: 1;
    min-width: 120px;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #dc3545;
    color: white;
}

.end-chat-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4A90E2;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #3A7BC8;
}

/* Responsive design */
@media (max-width: 480px) {
    .chat-container {
        width: 320px;
        height: 450px;
        right: -10px;
    }
    
    .chat-toggle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Animation for new messages */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message {
    animation: slideIn 0.3s ease;
}

/* Embedded chat on contact page - override all conflicting styles */
#embedded-chatbot {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
}

#embedded-chatbot .chat-container {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#embedded-chat-messages.chat-messages {
    flex: 1 1 auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#embedded-chatbot .chat-input {
    flex-shrink: 0 !important;
    padding: 16px !important;
    align-items: stretch !important;
}