/* Gandhi Immigration Chatbot Styles */

#gandhi-chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 2147483647;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: calc(100vw - 24px);
}

/* Toggle Button */
#gandhi-chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ee253a, #c2001f);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(238, 37, 58, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    margin-left: auto;
}

#gandhi-chatbot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(238, 37, 58, 0.5);
}

#gandhi-chatbot-toggle:active {
    transform: scale(0.96);
}

/* Notification badge */
#gandhi-chatbot-toggle .gandhi-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #ff5252;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Chat Box */
#gandhi-chatbot-box {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    height: 520px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: gandhi-slideUp 0.25s ease;
}

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

/* Header */
#gandhi-chatbot-header {
    background: linear-gradient(135deg, #ee253a, #c2001f);
    padding: 16px 20px;
    color: white;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gandhi-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#gandhi-chatbot-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    flex-shrink: 0;
}

#gandhi-chatbot-close:hover {
    opacity: 1;
}

.gandhi-chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gandhi-chatbot-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.2;
}

.gandhi-chatbot-status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}

.gandhi-chatbot-status::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #69f0ae;
}

/* Messages */
#gandhi-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f8fc;
    scroll-behavior: smooth;
}

#gandhi-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

#gandhi-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

#gandhi-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 4px;
}

/* Message Bubbles */
.gandhi-message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: gandhi-fadeIn 0.2s ease;
}

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

.gandhi-message.gandhi-bot {
    align-self: flex-start;
}

.gandhi-message.gandhi-user {
    align-self: flex-end;
}

.gandhi-message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.gandhi-bot .gandhi-message-bubble {
    background: #ffffff;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.gandhi-user .gandhi-message-bubble {
    background: linear-gradient(135deg, #ee253a, #c2001f);
    color: white;
    border-bottom-right-radius: 4px;
}

/* ── Markdown formatting inside bot bubbles ── */
.gandhi-bot .gandhi-message-bubble h4,
.gandhi-bot .gandhi-message-bubble h5,
.gandhi-bot .gandhi-message-bubble h6 {
    font-size: 14px;
    font-weight: 500;
    margin: 8px 0 4px;
    color: #1a1a2e;
}
.gandhi-bot .gandhi-message-bubble ul {
    margin: 4px 0 6px 16px;
    padding: 0;
    list-style: disc;
}
.gandhi-bot .gandhi-message-bubble li {
    margin-bottom: 3px;
    font-size: 14px;
    line-height: 1.5;
}
.gandhi-bot .gandhi-message-bubble p {
    margin: 0 0 4px;
}
.gandhi-bot .gandhi-message-bubble br {
    display: block;
    margin: 2px 0;
}
.gandhi-bot .gandhi-message-bubble strong {
    font-weight: 500;
}

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

.gandhi-bot .gandhi-message-time { align-self: flex-start; }
.gandhi-user .gandhi-message-time { align-self: flex-end; }

/* FAQ List */
.gandhi-faq-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}

.gandhi-faq-item {
    background: #fff;
    border: 1.5px solid #e8e8f0;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
    line-height: 1.4;
}

.gandhi-faq-item:hover {
    border-color: #ee253a;
    background: #fff5f6;
    color: #ee253a;
}

/* Satisfaction Buttons */
.gandhi-satisfaction {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.gandhi-satisfaction-btn {
    padding: 7px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1.5px solid;
    transition: all 0.15s;
}

.gandhi-satisfaction-btn.yes {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.gandhi-satisfaction-btn.yes:hover {
    background: #4caf50;
    color: white;
}

.gandhi-satisfaction-btn.no {
    background: #fce4ec;
    border-color: #e91e63;
    color: #c2185b;
}

.gandhi-satisfaction-btn.no:hover {
    background: #e91e63;
    color: white;
}

/* Typing indicator */
.gandhi-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    width: fit-content;
}

.gandhi-typing span {
    width: 7px;
    height: 7px;
    background: #ee253a;
    border-radius: 50%;
    display: inline-block;
    animation: gandhi-bounce 1.2s infinite;
    opacity: 0.6;
}

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

@keyframes gandhi-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Input Area */
#gandhi-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    background: white;
    flex-shrink: 0;
}

#gandhi-chatbot-input {
    flex: 1;
    border: 1.5px solid #e8e8f0;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s;
    background: #f7f8fc;
    color: #333;
}

#gandhi-chatbot-input:focus {
    border-color: #ee253a;
    background: white;
}

#gandhi-chatbot-input::placeholder {
    color: #aaa;
}

#gandhi-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ee253a, #c2001f);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
}

#gandhi-chatbot-send:hover {
    transform: scale(1.08);
}

#gandhi-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* AI Mode indicator */
.gandhi-ai-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #7b2d8b, #4a148c);
    color: white;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    margin-bottom: 6px;
    font-weight: 500;
}


/* Responsive — Mobile */
@media (max-width: 768px) {
    /* Toggle button — closed state */
    #gandhi-chatbot-wrapper {
        right: 16px;
        bottom: 16px;
    }

    /* When chat is open: wrapper covers full viewport */
    #gandhi-chatbot-wrapper.gandhi-chat-open {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
    }

    /* Hide toggle button when chat is open */
    #gandhi-chatbot-wrapper.gandhi-chat-open #gandhi-chatbot-toggle {
        display: none;
    }

    /* Chat box fills the full wrapper */
    #gandhi-chatbot-wrapper.gandhi-chat-open #gandhi-chatbot-box {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        border-radius: 0;
        box-sizing: border-box;
    }

    #gandhi-chatbot-messages {
        -webkit-overflow-scrolling: touch;
    }

    #gandhi-chatbot-input {
        font-size: 16px;
    }
}
