/* bot.css - Modern Government AI Assistant */

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0a4b7a;
    --primary-light: #1a6da8;
    --primary-dark: #063454;
    --secondary: #4a9eff;
    --accent: #2d9cdb;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 20px 60px rgba(0, 20, 50, 0.25);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ===== CHAT CONTAINER ===== */
.chatbot-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999999;
    font-family: var(--font);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* ===== TOGGLE BUTTON ===== */
.chatbot-toggle {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border: none;
    box-shadow: 0 8px 32px rgba(10, 75, 122, 0.4);
    color: white;
    font-size: 30px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.chatbot-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(10, 75, 122, 0.5);
}

.chatbot-toggle .status-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #2ecc71;
    border: 2px solid white;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.chatbot-toggle .icon-open { display: block; }
.chatbot-toggle .icon-close { display: none; }
.chatbot-toggle.active .icon-open { display: none; }
.chatbot-toggle.active .icon-close { display: block; }

/* ===== CHAT WINDOW ===== */
.chatbot-window {
    position: absolute;
    bottom: 88px;
    right: 0;
    width: 420px;
    max-width: 92vw;
    height: 600px;
    max-height: 75vh;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: var(--transition);
    transform-origin: bottom right;
}

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

/* ===== HEADER ===== */
.chatbot-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 18px 22px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

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

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

.chatbot-header-info h3 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin: 0;
    line-height: 1.2;
}

.chatbot-header-info .status-text {
    font-size: 11px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.chatbot-header-info .status-text .dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2ecc71;
    animation: pulse-dot 1.8s infinite;
}

.chatbot-header-actions {
    display: flex;
    gap: 6px;
}

.chatbot-header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== MESSAGES AREA ===== */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(248, 250, 254, 0.5);
    scroll-behavior: smooth;
}

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

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}

/* ===== MESSAGE BUBBLES ===== */
.message {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    animation: messageIn 0.3s ease;
    position: relative;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: #1a2a3a;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-bottom-right-radius: 4px;
}

.message .timestamp {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 6px;
    display: block;
    text-align: right;
    letter-spacing: 0.2px;
}

.message.user .timestamp {
    opacity: 0.8;
}

/* ===== TYPING INDICATOR ===== */
.typing-indicator {
    align-self: flex-start;
    background: white;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: none;
    gap: 5px;
    align-items: center;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--secondary);
    display: inline-block;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    padding: 10px 18px 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.quick-actions button {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 12px;
    color: var(--primary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    white-space: nowrap;
}

.quick-actions button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 75, 122, 0.2);
}

/* ===== INPUT AREA ===== */
.chatbot-input-area {
    display: flex;
    gap: 10px;
    padding: 14px 18px 18px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    align-items: flex-end;
}

.chatbot-input-area textarea {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    font-family: var(--font);
    resize: none;
    outline: none;
    transition: var(--transition);
    background: white;
    min-height: 44px;
    max-height: 120px;
    line-height: 1.5;
    color: #1a2a3a;
}

.chatbot-input-area textarea:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}

.chatbot-input-area textarea::placeholder {
    color: #94a3b8;
}

.chatbot-input-area .send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-input-area .send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(10, 75, 122, 0.3);
}

.chatbot-input-area .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ===== CLEAR CHAT BUTTON ===== */
.clear-chat-btn {
    position: absolute;
    bottom: 100px;
    right: 18px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 14px;
    color: #64748b;
    transition: var(--transition);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 5;
}

.clear-chat-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

.clear-chat-btn.visible {
    display: flex;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .chatbot-container {
        bottom: 16px;
        right: 16px;
    }

    .chatbot-toggle {
        width: 60px;
        height: 60px;
        font-size: 26px;
    }

    .chatbot-window {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
        border: none;
        backdrop-filter: blur(16px);
    }

    .chatbot-header {
        padding: 14px 18px;
        border-radius: 0;
    }

    .chatbot-messages {
        padding: 14px;
    }

    .message {
        max-width: 88%;
        font-size: 13px;
        padding: 10px 14px;
    }

    .quick-actions {
        padding: 8px 14px;
        gap: 6px;
    }

    .quick-actions button {
        font-size: 11px;
        padding: 5px 12px;
    }

    .chatbot-input-area {
        padding: 10px 14px 14px;
    }

    .chatbot-input-area textarea {
        font-size: 13px;
        padding: 8px 12px;
        min-height: 40px;
    }

    .chatbot-input-area .send-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .clear-chat-btn {
        bottom: 85px;
        right: 14px;
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .chatbot-header-info h3 {
        font-size: 14px;
    }
    .chatbot-avatar {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }
}