/* Neural Partners Chat Widget - npAI Design System Integration */

#npai-chat-widget {
    position: fixed;
    z-index: 10000;
    font-family: var(--font-primary, 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}

/* Positioning */
.npai-chat.bottom-right {
    bottom: 24px;
    right: 24px;
}

.npai-chat.bottom-left {
    bottom: 24px;
    left: 24px;
}

/* Toggle Button - Logo Icon */
.npai-chat-toggle {
    position: relative;
    width: 64px;
    height: 64px;
    background: #FFFFFF !important;
    border: 2px solid rgba(60, 19, 97, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(60, 19, 97, 0.15), 0 2px 4px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    padding: 0;
    overflow: visible;
}

.npai-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 8px 24px rgba(60, 19, 97, 0.25), 0 4px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--neural-purple, #3c1361);
}

.npai-chat-toggle img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.npai-chat-toggle:hover img {
    transform: scale(1.05);
}

/* Close icon state */
.npai-chat-toggle.is-open img {
    display: none;
}

.npai-chat-toggle .npai-close-icon {
    display: none;
    width: 24px;
    height: 24px;
    color: var(--neural-black, #111827);
}

.npai-chat-toggle.is-open .npai-close-icon {
    display: block;
}

/* Notification Badge */
.npai-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg,
        var(--neural-orange, #FF966C) 0%,
        var(--neural-warm-accent, #D97706) 100%);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 2px solid var(--neural-white, #FFFFFF);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Chat Window */
.npai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 580px;
    background: var(--neural-white, #FFFFFF);
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--neural-black, #111827);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.npai-chat-window.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header - Light Neutral */
.npai-chat-header {
    background: var(--neural-white, #FFFFFF);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--neural-black, #111827);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 20px 20px 0 0;
}

.npai-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.npai-avatar {
    width: 44px;
    height: 44px;
    background: var(--neural-white, #FFFFFF);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 4px;
}

.npai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.npai-agent-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.npai-agent-name {
    font-weight: 500;
    font-size: 16px;
    letter-spacing: -0.01em;
    background: linear-gradient(90deg, #3c1361, #6E56CF);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.npai-agent-status {
    font-size: 12px;
    color: var(--neural-grey, #6B7280);
    display: flex;
    align-items: center;
    gap: 6px;
}

.npai-status-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: npai-pulse 2s infinite;
}

@keyframes npai-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.npai-close-btn {
    width: 32px;
    height: 32px;
    background: var(--neural-soft-neutral);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    color: var(--neural-black, #111827);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.npai-close-btn:hover {
    background: var(--neural-white, #FFFFFF);
    border-color: var(--neural-purple, #3c1361);
    color: var(--neural-purple, #3c1361);
    transform: scale(1.1);
}

.npai-close-btn svg {
    width: 14px;
    height: 14px;
}

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

/* Scrollbar Styling */
.npai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.npai-chat-messages::-webkit-scrollbar-thumb {
    background: var(--neural-grey, #6B7280);
    border-radius: 3px;
}

.npai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--neural-black, #111827);
}

/* Message Bubbles */
.npai-message {
    display: flex;
    gap: 8px;
    animation: npai-message-slide 0.3s ease;
}

@keyframes npai-message-slide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.npai-agent-message {
    align-self: flex-start;
    max-width: 80%;
}

.npai-user-message {
    align-self: flex-end;
    max-width: 80%;
}

.npai-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

.npai-agent-message .npai-message-content {
    background: var(--neural-white, #FFFFFF);
    color: var(--neural-black, #111827);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px 16px 16px 4px;
}

.npai-user-message .npai-message-content {
    background: linear-gradient(135deg,
        var(--neural-purple, #3c1361) 0%,
        var(--neural-purple-light, #6E56CF) 100%);
    color: white;
    border-radius: 16px 16px 4px 16px;
}

/* Typing Indicator */
.npai-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: var(--neural-white, #FFFFFF);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px 16px 16px 4px;
    width: fit-content;
}

.npai-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--neural-grey, #6B7280);
    border-radius: 50%;
    animation: npai-typing 1.4s infinite;
}

.npai-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.npai-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Quick Actions */
.npai-quick-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--neural-white, #FFFFFF);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    overflow-x: auto;
    scrollbar-width: none;
}

.npai-quick-actions::-webkit-scrollbar {
    display: none;
}

.npai-quick-action {
    padding: 8px 14px;
    background: var(--neural-soft-neutral);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    font-size: 13px;
    font-family: inherit;
    color: var(--neural-grey, #6B7280);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.npai-quick-action:hover {
    background: var(--neural-white, #FFFFFF);
    border-color: var(--neural-purple, #3c1361);
    color: var(--neural-purple, #3c1361);
}

/* Input Area */
.npai-chat-input {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--neural-white, #FFFFFF);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 0 0 20px 20px;
}

.npai-input-field {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    font-size: 14px;
    font-family: inherit;
    background: var(--neural-soft-neutral);
    transition: all 0.2s ease;
    color: var(--neural-black, #111827);
}

.npai-input-field:focus {
    outline: none;
    border-color: var(--neural-purple, #3c1361);
    background: var(--neural-white, #FFFFFF);
    box-shadow: 0 0 0 3px rgba(60, 19, 97, 0.1);
}

.npai-input-field::placeholder {
    color: var(--neural-grey, #6B7280);
}

.npai-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--neural-white, #FFFFFF);
    border: 1px solid var(--neural-black, #111827);
    color: var(--neural-black, #111827);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.npai-send-btn:not(:disabled):hover {
    background: var(--neural-purple, #3c1361);
    border-color: var(--neural-purple, #3c1361);
    color: white;
    transform: scale(1.05);
}

.npai-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--neural-soft-neutral);
    border-color: rgba(0, 0, 0, 0.1);
    color: var(--neural-grey, #6B7280);
}

.npai-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .npai-chat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
        max-height: 100vh;
        border: none;
    }

    .npai-chat-header {
        border-radius: 0;
    }

    .npai-chat-input {
        border-radius: 0;
        padding-bottom: env(safe-area-inset-bottom, 16px);
    }

    .npai-chat-toggle {
        width: 56px;
        height: 56px;
    }

    .npai-chat-toggle img {
        width: 40px;
        height: 40px;
    }

    .npai-chat.bottom-right,
    .npai-chat.bottom-left {
        bottom: 16px;
        right: 16px;
    }
}

/* Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .npai-chat-window {
        width: 340px;
        height: 520px;
    }
}

/* Powered by badge */
.npai-powered-by {
    padding: 8px 16px;
    background: var(--neural-soft-neutral);
    text-align: center;
    font-size: 11px;
    color: var(--neural-grey, #6B7280);
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}

.npai-powered-by a {
    color: var(--neural-purple, #3c1361);
    text-decoration: none;
    font-weight: 500;
}

.npai-powered-by a:hover {
    text-decoration: underline;
}
