/* bot.css - Modern & Friendly UI */

/* Pulse Animation for Bot Bubble */
@keyframes pulse-purple {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.7); transform: scale(1); }
    70% { box-shadow: 0 0 0 15px rgba(139, 92, 246, 0); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); transform: scale(1); }
}

/* 1. The Bubble Trigger */
#botBubble {
    position: fixed; bottom: 25px; right: 25px;
    width: 65px; height: 65px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; cursor: pointer;
    animation: pulse-purple 2s infinite;
    z-index: 9000 !important; color: white; /* Lowered to sit behind modals */
}
#botBubble:hover {
    animation: none;
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}
#botBubble:active { transform: scale(0.9); }

/* 2. The Main Interface Window */
#botInterface {
    position: fixed; bottom: 100px; right: 25px;
    width: 380px; max-width: 90vw; height: 550px;
    display: none; flex-direction: column;
    border-radius: 28px;
    background: white;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.05);
    z-index: 9000 !important; overflow: hidden; /* Lowered to sit behind modals */
    animation: slideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* 3. Header */
.bot-header { 
    background: linear-gradient(135deg, #8b5cf6, #7c3aed); 
    color: white; padding: 18px 25px; 
    font-weight: 800; font-size: 1.1rem;
    display: flex; justify-content: space-between; align-items: center; 
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2);
}

/* 4. Chat Body */
.bot-body { 
    padding: 20px; background: #f8fafc; 
    flex: 1; overflow-y: auto; 
    display: flex; flex-direction: column; gap: 12px;
}

/* 5. Messages */
.bot-msg { 
    padding: 14px 18px; border-radius: 20px; 
    font-size: 0.95rem; line-height: 1.5; 
    max-width: 85%; word-wrap: break-word; 
    animation: popIn 0.2s ease;
}
.bot-msg-ai { 
    background: white; color: #334155; 
    border-bottom-left-radius: 4px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); 
    align-self: flex-start; 
}
.bot-msg-user { 
    background: #8b5cf6; color: white; 
    border-bottom-right-radius: 4px; 
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
    align-self: flex-end; 
}

/* 6. Input Area */
.bot-input-area { 
    padding: 15px; background: white; 
    border-top: 1px solid #f1f5f9; 
    display: flex; gap: 10px; align-items: center; 
}
#aiIn {
    background: #f1f5f9; padding: 12px 15px; border-radius: 25px; 
    font-size: 1rem; color: #334155;
}
#aiIn:focus { background: white; box-shadow: 0 0 0 2px #ddd6fe; }

/* 7. Interactive Elements (Cards & Buttons) */
/* 3. Helper for standard buttons inside chat */
.bot-btn-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.btn-mini {
    padding: 8px 16px; border-radius: 50px; border: none;
    background: #ede9fe; color: #7c3aed;
    font-weight: 700; font-size: 0.85rem; cursor: pointer;
    transition: 0.2s; flex: 1;
}
.btn-mini:hover { background: #ddd6fe; transform: translateY(-1px); }

/* 1. Chips Container */
.bot-chips-container {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping or horizontal scroll */
    gap: 8px;
    margin-bottom: 10px;
}

/* 2. The Chip Buttons (Purple Circles/Pills) */
.bot-chip {
    background: #ede9fe; /* Light Purple */
    color: #7c3aed;      /* Dark Purple Text */
    border: 1px solid #ddd6fe;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.bot-chip:hover {
    background: #8b5cf6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.bot-card {
    background: #f8fafc; padding: 15px; border-radius: 16px; 
    border: 1px solid #e2e8f0; margin-top: 10px;
}
.bot-card-title { font-weight: 800; font-size: 0.85rem; color: #64748b; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }

.bot-form-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.bot-form-row label { font-size: 0.8rem; font-weight: 700; color: #94a3b8; }
.cal-input { padding: 6px; border-radius: 8px; border: 1px solid #cbd5e1; font-family: inherit; }

.btn-full {
    width: 100%; padding: 10px; background: #8b5cf6; color: white;
    border: none; border-radius: 12px; font-weight: 700; cursor: pointer; margin-top: 5px;
}

/* 8. Summary Card */
.bot-summary-card {
    background: white; padding: 16px; border-radius: 16px;
    border: 1px solid #e2e8f0; margin-top: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
}
.sum-row { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 6px; color: #64748b; font-weight: 500; }
.sum-divider { height: 1px; background: #f1f5f9; margin: 10px 0; }
.sum-row.total { font-size: 1.1rem; font-weight: 800; color: #1e293b; margin-bottom: 0; }
.text-green { color: #10b981; font-weight: 700; }
.text-red { color: #ef4444; font-weight: 700; }

@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Floating Hint Bubble (Landing Page) */
.bot-hint-bubble {
    position: fixed;
    bottom: 100px;  /* Sits right above the bot icon */
    right: 25px;
    background: white;
    padding: 18px;
    border-radius: 20px 20px 4px 20px; /* Speech bubble shape */
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.25);
    z-index: 9980; /* Lowered to sit behind modals */
    width: 240px; /* Increased width for better readability */
    cursor: pointer;
    border: 1px solid rgba(139, 92, 246, 0.1);
    animation: floatHint 3s ease-in-out infinite;
    display: block; /* Visible by default */
}

/* Arrow pointing down to the bot */
.bubble-arrow {
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

/* Close button for hint bubble */
.hint-close-btn {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 18px;
    color: #94a3b8; /* Light gray */
    cursor: pointer;
    line-height: 1;
    z-index: 20;
    transition: 0.2s;
    padding: 2px;
}
.hint-close-btn:hover {
    color: #ef4444; /* Red on hover */
    transform: scale(1.2);
}

/* Gentle floating animation */
@keyframes floatHint {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Hide on mobile if screen is too short (prevents covering keyboard) */
@media (max-height: 600px) {
    .bot-hint-bubble { display: none !important; }
}

/* Dark Mode for Bot Interface */
[data-theme="dark"] #botInterface { background: #1e1b4b; border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .bot-body { background: #0f172a; }
[data-theme="dark"] .bot-msg-ai { background: rgba(255,255,255,0.08); color: #e2e8f0; box-shadow: none; }
[data-theme="dark"] .bot-input-area { background: #1e1b4b; border-top-color: rgba(255,255,255,0.08); }
[data-theme="dark"] #aiIn { background: rgba(255,255,255,0.08); color: #e2e8f0; }
[data-theme="dark"] #aiIn:focus { background: rgba(255,255,255,0.12); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3); }
[data-theme="dark"] .bot-card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .bot-card-title { color: #94a3b8; }
[data-theme="dark"] .bot-form-row label { color: #64748b; }
[data-theme="dark"] .cal-input { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: #e2e8f0; }
[data-theme="dark"] .bot-summary-card { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .sum-row { color: #94a3b8; }
[data-theme="dark"] .sum-row.total { color: #f8fafc; }
[data-theme="dark"] .sum-divider { background: rgba(255,255,255,0.08); }
[data-theme="dark"] .btn-mini { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
[data-theme="dark"] .btn-mini:hover { background: rgba(139, 92, 246, 0.35); }
[data-theme="dark"] .bot-chip { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.3); }
[data-theme="dark"] .bot-chip:hover { background: #8b5cf6; color: white; }
[data-theme="dark"] .bot-hint-bubble { background: #1e1b4b; border-color: rgba(139, 92, 246, 0.3); }
[data-theme="dark"] .bot-hint-bubble div { color: #c4b5fd !important; }
[data-theme="dark"] .bubble-arrow { border-top-color: #1e1b4b; }
[data-theme="dark"] .hint-close-btn { color: #64748b; }

/* Mobile Bot Positioning */
@media (max-width: 600px) {
    /* Default (landing page - no nav bar) */
    #botBubble { bottom: calc(20px + env(safe-area-inset-bottom)); right: 20px; width: 55px; height: 55px; font-size: 1.6rem; }
    #botInterface { bottom: calc(90px + env(safe-area-inset-bottom)); right: 15px; height: 55vh; max-height: 400px; }
    .bot-hint-bubble { bottom: calc(85px + env(safe-area-inset-bottom)); right: 20px; width: 200px; padding: 14px; }

    /* Main app (above nav + FAB) */
    .app-active #botBubble { bottom: calc(140px + env(safe-area-inset-bottom)); }
    .app-active #botInterface { bottom: calc(210px + env(safe-area-inset-bottom)); }
    .app-active .bot-hint-bubble { bottom: calc(205px + env(safe-area-inset-bottom)); }
}