/* ===== CHATBOT WIDGET STYLES ===== */

.chat-widget-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Lato', sans-serif;
}

/* Base button */
.chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
    color: white;
    border: none;
    box-shadow: 0 4px 15px rgba(205, 33, 34, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-toggle-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(205, 33, 34, 0.5);
}

.chat-toggle-btn i {
    transition: opacity 0.2s, transform 0.3s;
}

/* The custom IA icon (robot SVG + label) */
.chat-ia-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    transition: opacity 0.2s, transform 0.3s;
}

.chat-ia-label {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    line-height: 1;
    color: white;
    text-transform: uppercase;
    font-family: 'Lato', sans-serif;
}

/* Close icon hidden by default */
.chat-close-icon {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
    transition: opacity 0.2s, transform 0.3s;
}

/* When open: hide IA icon, show X */
.chat-toggle-btn.open .chat-ia-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
    position: absolute;
}
.chat-toggle-btn.open .chat-close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
    position: relative;
}

/* Chat modal */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #e2e8f0;
}

.chat-window.active {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--green-dark), var(--green-mid));
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-icon {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.chat-header-info h3 {
    margin: 0;
    font-size: 1.05rem;
    font-family: 'Playfair Display', serif;
}

.chat-header-info p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Messages Area */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Scrollbar for chat */
.chat-body::-webkit-scrollbar {
    width: 6px;
}
.chat-body::-webkit-scrollbar-track {
    background: transparent;
}
.chat-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    white-space: pre-wrap;
    animation: fadeInMsg 0.3s ease;
}

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

.bot-message {
    align-self: flex-start;
    background: white;
    color: var(--text-dark);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.user-message {
    align-self: flex-end;
    background: var(--green-mid);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 5px rgba(205,33,34,0.1);
}

.bot-message-emblem {
    color: var(--green-dark);
    font-weight: bold;
    font-size: 0.75rem;
    margin-bottom: 4px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Typing indicator */
.typing-indicator {
    align-self: flex-start;
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    display: none;
    align-items: center;
    gap: 4px;
}

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

.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); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Input Area */
.chat-footer {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
}

.chat-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    padding: 10px 18px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--green-light);
}

.chat-send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--green-mid);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.chat-send-btn:hover {
    background: var(--green-dark);
}
.chat-send-btn:active {
    transform: scale(0.95);
}
.chat-send-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(100%);
    }
    .chat-window.active {
        transform: translateY(0);
    }
    .chat-toggle-btn {
        bottom: 20px;
        right: 20px;
    }
    .chat-widget-container.open .chat-toggle-btn {
        /* Hide floating button when full screen chat is open on mobile */
        display: none; 
    }
    /* We need a close button in the header for mobile */
    .mobile-close-chat {
        display: block;
        margin-left: auto;
        background: transparent;
        border: none;
        color: white;
        font-size: 1.2rem;
        cursor: pointer;
    }
}
@media (min-width: 481px) {
    .mobile-close-chat {
        display: none;
    }
}
