/* ================================================
   AI FASTING COACH CHATBOT
   Multi-Agent Support System for Fasting Journey
   ================================================ */

/* Chatbot Toggle Button (FAB - Floating Action Button) */
.chatbot-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--forest-deep) 0%, var(--sage) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-round);
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(31, 58, 44, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    transition: all var(--transition-base);
    z-index: 999;
    animation: pulse 2s ease-in-out infinite;
}

@media (max-width: 768px) {
    .chatbot-fab {
        bottom: 90px; /* Keep at original position on mobile */
    }
}

.chatbot-fab:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 32px rgba(31, 58, 44, 0.5);
}

.chatbot-fab.active {
    background: linear-gradient(135deg, var(--burnt-sienna) 0%, #E8A24E 100%);
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(31, 58, 44, 0.4);
    }
    50% {
        box-shadow: 0 8px 24px rgba(31, 58, 44, 0.4), 0 0 0 8px rgba(107, 142, 117, 0.2);
    }
}

/* Notification Badge */
.chatbot-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--burnt-sienna);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: var(--weight-black);
    border: 2px solid white;
    animation: bounce 0.6s ease;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 170px;
    right: 20px;
    width: 400px;
    height: 600px;
    max-height: calc(100vh - 200px);
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 998;
    animation: slideUp 0.3s ease;
}

.chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chatbot Header */
.chatbot-header {
    background: var(--bg-gradient-dark);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.chatbot-header-content {
    flex: 1;
}

.chatbot-title {
    font-size: 1.125rem;
    font-weight: var(--weight-black);
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatbot-status {
    font-size: 0.8rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--sage);
    border-radius: var(--radius-round);
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background var(--transition-fast);
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Agent Selector Pills */
.chatbot-agents {
    background: var(--bg-secondary);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.chatbot-agents::-webkit-scrollbar {
    display: none;
}

.agent-pill {
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    font-weight: var(--weight-bold);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.agent-pill:hover {
    border-color: var(--bronze);
    transform: translateY(-1px);
}

.agent-pill.active {
    background: var(--bg-gradient-bronze);
    border-color: var(--bronze);
    color: var(--slate-dark);
    box-shadow: var(--shadow-sm);
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: linear-gradient(to bottom, #f9fafb 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Individual Message */
.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-round);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    background: var(--bg-gradient-bronze);
    color: white;
    font-weight: var(--weight-bold);
}

.message.bot .message-avatar {
    background: var(--bg-gradient-dark);
}

.message-content {
    flex: 1;
}

.message-bubble {
    background: white;
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    font-size: 0.9375rem;
    line-height: 1.6;
    box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
    background: var(--bg-gradient-bronze);
    color: var(--slate-dark);
    border-color: var(--bronze);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.5rem;
    padding: 0.875rem 1.125rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: var(--radius-round);
    animation: typing 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Quick Reply Suggestions */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.quick-reply-btn {
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--bronze);
    border-radius: var(--radius-pill);
    font-size: 0.8125rem;
    font-weight: var(--weight-medium);
    color: var(--bronze);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.quick-reply-btn:hover {
    background: var(--bronze);
    color: white;
}

/* Input Area */
.chatbot-input-area {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    min-height: 44px;
    max-height: 120px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-family: var(--font-body);
    resize: none;
    transition: border-color var(--transition-fast);
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--forest-deep);
    box-shadow: 0 0 0 3px rgba(31, 58, 44, 0.1);
}

.chatbot-input::placeholder {
    color: var(--text-muted);
}

.chatbot-send {
    width: 44px;
    height: 44px;
    background: var(--bg-gradient-bronze);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--slate-dark);
    font-size: 1.125rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.chatbot-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Welcome Screen */
.chatbot-welcome {
    padding: 2rem 1.5rem;
    text-align: center;
}

.welcome-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.welcome-title {
    font-size: 1.5rem;
    font-weight: var(--weight-black);
    color: var(--slate-dark);
    margin-bottom: 0.5rem;
}

.welcome-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.welcome-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.welcome-btn {
    padding: 1rem 1.5rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-btn:hover {
    border-color: var(--forest-deep);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.welcome-btn-icon {
    font-size: 1.5rem;
}

.welcome-btn-text {
    flex: 1;
}

.welcome-btn-title {
    font-weight: var(--weight-bold);
    color: var(--slate-dark);
    margin-bottom: 0.25rem;
}

.welcome-btn-description {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: calc(100vh - 60px);
        max-height: none;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    }

    .chatbot-fab {
        bottom: 20px;
        right: 20px;
    }
}

/* Dark Mode Support (Future) */
@media (prefers-color-scheme: dark) {
    .chatbot-window {
        background: var(--slate-dark);
    }

    .message-bubble {
        background: var(--charcoal);
        border-color: var(--gray-700);
        color: white;
    }

    .chatbot-messages {
        background: linear-gradient(to bottom, var(--slate-dark) 0%, var(--charcoal) 100%);
    }
}
