/* ALCU Chatbot Styles */

#alcu-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chatbot Button */
.alcu-chatbot-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex; 
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.alcu-chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.alcu-chatbot-button svg {
    color: white;
    width: 28px;
    height: 28px;
}

.alcu-chatbot-button span {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.alcu-chatbot-button:hover span {
    opacity: 1;
}

/* Chatbot Window */
.alcu-chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.alcu-chatbot-window.active {
    display: flex;
}

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

.alcu-chatbot-window.active {
    display: flex;
}

/* Header */
.alcu-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex; 
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Don't shrink, stay fixed */
    position: relative;
}

.alcu-chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.alcu-header-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

.alcu-header-text {
    flex: 1;
}

.alcu-header-text h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
}

.alcu-header-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9; 
}

.alcu-chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none; 
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 0.3s;
    z-index: 10;
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    font-weight: 300;
}

.alcu-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Minimized state */
.alcu-chatbot-window.minimized {
    height: 60px;
    overflow: hidden;
}

.alcu-chatbot-window.minimized .alcu-chatbot-header-content p {
    display: none;
}

/* Ensure input area is always visible */
.alcu-chat-area {
    position: relative;
}

.alcu-input-area {
    order: 999; /* Always last in flex order */
}

/* User Form */
.alcu-user-form {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    flex-shrink: 0; /* Don't shrink */
    min-height: 0; /* Important for flex scrolling */
}

.alcu-form-group { 
    margin-bottom: 15px;
}

.alcu-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.alcu-form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.alcu-form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.alcu-submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600; 
    cursor: pointer;
    transition: transform 0.2s;
    margin-top: 10px;
}

.alcu-submit-btn:hover {
    transform: translateY(-2px);
}

/* Chat Area */
.alcu-chat-area {
    display: flex;
    flex-direction: column; 
    flex: 1;
    min-height: 0; /* Important for flex scrolling */
    overflow: hidden; /* Prevent entire area from scrolling */
}

/* FAQ Section */
.alcu-faq-section {
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0; /* Don't shrink, stay fixed */
}

.alcu-faq-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.alcu-faq-header:hover {
    background: #e9ecef;
}

.alcu-faq-header h4 {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: 600;
}

.alcu-faq-toggle-icon {
    font-size: 12px;
    color: #667eea;
    transition: transform 0.3s;
}

.alcu-faq-section.collapsed .alcu-faq-toggle-icon {
    transform: rotate(-90deg);
}

.alcu-faq-content {
    max-height: 200px;
    overflow-y: auto;
    padding: 0 20px 15px 20px;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.alcu-faq-section.collapsed .alcu-faq-content {
    max-height: 0;
    padding: 0 20px;
    overflow: hidden;
}

.alcu-faq-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
}

.alcu-faq-btn {
    padding: 8px 12px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
}

.alcu-faq-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Keywords Section (Quick Actions) - Uses same styles as FAQ */

.alcu-keyword-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.alcu-keyword-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Messages */
.alcu-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f5f5f5;
    min-height: 0; /* Important for flex scrolling */
}

.alcu-message {
    margin-bottom: 15px;
    display: flex;
    animation: fadeIn 0.3s;
}

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

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

.alcu-message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
}

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

.alcu-message.bot .alcu-message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.alcu-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    padding: 0 4px;
}

/* Country Selection */
.alcu-country-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.alcu-country-btn {
    padding: 12px;
    background: white;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    transition: all 0.2s;
    color: #667eea;
}

.alcu-country-btn:hover {
    background: #667eea;
    color: white;
}

/* Typing Indicator */
.alcu-typing {
    padding: 10px 20px;
    display: flex;
    gap: 5px;
    flex-shrink: 0; /* Don't shrink, stay fixed */
}

.alcu-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* Input Area */
.alcu-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0; /* Don't shrink, stay fixed at bottom */
    position: relative;
    z-index: 10; /* Always on top */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05); /* Subtle shadow to separate from messages */
}

.alcu-input-area input { 
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.alcu-input-area input:focus {
    border-color: #667eea;
}

.alcu-input-area input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

.alcu-input-area button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.alcu-input-area button {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.alcu-input-area button svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: white;
    color: white;
}

.alcu-input-area button:hover {
    transform: scale(1.1);
}  

.alcu-input-area button:hover {
    transform: scale(1.1);
}

/* Popup Notification */
.alcu-popup-notification {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    animation: slideInRight 0.3s ease;
}

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

.alcu-popup-notification p {
    margin: 0;
    flex: 1;
    font-size: 14px;
    color: #333;
}

.alcu-popup-notification button {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    line-height: 1;
}

.alcu-popup-notification button:hover {
    color: #333;
}

/* WhatsApp Link */
.alcu-whatsapp-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 15px;
    background: #25D366;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.3s;
}

.alcu-whatsapp-link:hover {
    background: #20BA5A;
}

/* Responsive */
@media (max-width: 480px) {
    .alcu-chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        height: calc(100vh - 20px);
        max-height: calc(100vh - 20px);
    }
    
    .alcu-chatbot-button {
        width: 50px;
        height: 50px;
        bottom: 10px;
        right: 10px;
    }
}
