/* Assistant Floating Action Button */
.ai-assistant-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'DM Sans', sans-serif;
}

.ai-assistant-fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(46, 125, 111, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.ai-assistant-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 16px rgba(46, 125, 111, 0.4);
}

.ai-assistant-fab:active {
    transform: scale(0.95);
}

/* Notification Pulse */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 125, 111, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(46, 125, 111, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 125, 111, 0);
    }
}

.ai-assistant-fab.pulse {
    animation: pulse 2s infinite;
}

/* Slide-up Chat Panel */
.ai-chat-panel {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: var(--paper);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.ai-chat-panel.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
.chat-header {
    padding: 16px 20px;
    background: var(--paper-warm);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    color: var(--accent);
    width: 20px;
    height: 20px;
}

.chat-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.chat-header .subtitle {
    font-size: 0.75rem;
    color: var(--ink-soft);
    margin: 0;
}

.chat-close-btn {
    background: none;
    border: none;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-close-btn:hover {
    background: var(--border-soft);
    color: var(--ink);
}

.chat-close-btn svg {
    width: 18px;
    height: 18px;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--canvas);
}

/* Input Area */
.chat-input-area {
    padding: 16px;
    background: var(--paper);
    border-top: 1px solid var(--border);
}

.chat-input-form {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--canvas);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 6px 6px 6px 12px;
    transition: border-color 0.2s;
}

.chat-input-form:focus-within {
    border-color: var(--accent);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 4px;
    font-size: 0.95rem;
    color: var(--ink);
    outline: none;
}

.chat-input::placeholder {
    color: var(--ink-softer);
}

.chat-voice-btn, .chat-send-btn {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.chat-voice-btn {
    color: var(--ink);
    background: var(--paper-warm);
    border: 1px solid var(--border-soft);
}

.chat-voice-btn:hover {
    color: var(--accent);
    background: var(--paper-warm);
}

.chat-voice-btn.recording {
    color: white;
    background: var(--danger);
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
    0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

.chat-send-btn {
    background: var(--accent);
    color: white;
}

.chat-send-btn:hover:not(:disabled) {
    opacity: 0.9;
}

.chat-send-btn:disabled {
    background: var(--border);
    color: var(--ink-softer);
    cursor: not-allowed;
}

.chat-send-btn svg, .chat-voice-btn svg {
    width: 16px;
    height: 16px;
}

/* Chat Messages */
.chat-message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.chat-message.assistant {
    align-self: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-message.user .message-bubble {
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: var(--paper);
    color: var(--ink);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.confirmation-card {
    background: var(--paper-warm) !important;
    border: 1px solid var(--border-soft) !important;
}

.confirmation-card strong {
    color: var(--ink);
    display: block;
    margin-bottom: 8px;
}

.message-time {
    font-size: 0.7rem;
    color: var(--ink-softer);
    margin: 0 4px;
}

.chat-message.user .message-time {
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    align-items: center;
    height: 24px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--ink-soft);
    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; }
}

/* Suggested Prompts */
.suggestions-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto; /* Push to bottom initially */
}

.suggestion-chip {
    background: var(--paper);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--ink);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    text-align: left;
}

.suggestion-chip:hover {
    background: var(--paper-warm);
    border-color: var(--accent);
    color: var(--accent);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .ai-chat-panel {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 85vh;
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
        border: none;
        border-top: 1px solid var(--border);
    }
    
    .ai-chat-panel.open {
        transform: translateY(0);
    }
    
    .ai-assistant-fab {
        bottom: 20px;
        right: 20px;
    }
    
    /* Hide FAB when panel is open on mobile */
    .ai-chat-panel.open ~ .ai-assistant-fab {
        display: none;
    }
}
