/* Floating chat container */
#nac-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#nac-chat-bubble {
    width: 60px;
    height: 60px;
    background: #0073aa;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 115, 170, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
#nac-chat-bubble:hover, #nac-chat-bubble:focus {
    transform: scale(1.08);
    background: #005a87;
    box-shadow: 0 6px 20px rgba(0, 115, 170, 0.5);
    outline: none;
}
#nac-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 580px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: nacFadeInUp 0.2s ease;
}
@keyframes nacFadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0);    }
}
#nac-chat-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
}
#nac-status {
    font-size: 11px;
    font-weight: normal;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 20px;
    margin-left: 8px;
}
#nac-chat-close {
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.15s;
}
#nac-chat-close:hover, #nac-chat-close:focus {
    opacity: 1;
    outline: none;
}
#nac-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f7fb;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}
.nac-message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 100%;
    animation: nacMessageIn 0.15s ease;
}
@keyframes nacMessageIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0);   }
}
.nac-user-wrapper { justify-content: flex-end; }
.nac-bot-wrapper  { justify-content: flex-start; }
.nac-user-icon, .nac-bot-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.nac-user-icon {
    background: #0073aa;
    color: #fff;
    order: 1;
}
.nac-bot-icon {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.nac-user-message, .nac-bot-message {
    max-width: 72%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    word-wrap: break-word;
    line-height: 1.45;
}
.nac-user-wrapper .nac-user-message { order: 0; }
.nac-user-message {
    background: #0073aa;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.nac-bot-message {
    background: #fff;
    color: #1e2a3a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.nac-bot-message.thinking {
    font-style: italic;
    color: #64748b;
    background: #f1f5f9;
}
.nac-bot-message.error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}
.nac-message-text { line-height: 1.4; }
.nac-timestamp {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.55;
    text-align: right;
}
.nac-user-message .nac-timestamp { color: rgba(255, 255, 255, 0.8); }
.nac-buttons {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.nac-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #0073aa;
    color: #fff !important;
    padding: 6px 14px;
    border-radius: 30px;
    text-decoration: none !important;
    font-weight: 500;
    font-size: 13px;
    transition: background 0.2s, transform 0.1s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.nac-button:hover, .nac-button:focus {
    background: #005a87;
    text-decoration: none !important;
    transform: translateY(-1px);
    outline: none;
}
.nac-voice-button {
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nac-voice-button:hover {
    background: #005a87;
    transform: scale(1.05);
}
.nac-voice-button.listening {
    background: #e74c3c;
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}
.nac-voice-button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}
#nac-chat-input-area {
    display: flex;
    border-top: 1px solid #e2e8f0;
    padding: 12px;
    background: #fff;
    gap: 8px;
    align-items: center;
}
#nac-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#nac-chat-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}
#nac-chat-send {
    background: #0073aa;
    color: #fff;
    border: none;
    padding: 9px 18px;
    border-radius: 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}
#nac-chat-send:hover { background: #005a87; transform: translateY(-1px); }
#nac-chat-send:disabled { background: #94a3b8; cursor: not-allowed; transform: none; }
@media (max-width: 440px) {
    #nac-chat-window {
        width: calc(100vw - 24px);
        right: -10px;
    }
}