/* ===== NODI ASSISTANT WIDGET ===== */

.nodi-fab {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 9998;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    padding: 0;
    background: linear-gradient(135deg, #0ea5e9, #6366f1, #a855f7);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.nodi-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.6);
}
.nodi-fab img {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
}
.nodi-fab__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(99, 102, 241, 0.5);
    animation: nodiPulse 2s ease-in-out infinite;
}
@keyframes nodiPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0; }
}

.nodi-fab__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: nodiBadgeBounce 0.4s ease;
}
@keyframes nodiBadgeBounce {
    0% { transform: scale(0); }
    60% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Chat window */
.nodi-chat {
    position: fixed;
    bottom: 100px;
    right: 24px;
    z-index: 9999;
    width: 380px;
    max-height: 540px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.nodi-chat.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.nodi-chat__header {
    background: linear-gradient(135deg, #0ea5e9, #6366f1, #a855f7);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
}
.nodi-chat__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
}
.nodi-chat__info h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
}
.nodi-chat__info span {
    font-size: 0.75rem;
    opacity: 0.85;
}
.nodi-chat__close {
    margin-left: auto;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 1;
}
.nodi-chat__close:hover { opacity: 1; }

.nodi-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 280px;
    max-height: 340px;
    background: #f8fafc;
}

.nodi-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.85rem;
    line-height: 1.5;
    animation: nodiMsgIn 0.3s ease;
}
@keyframes nodiMsgIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.nodi-msg--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}
.nodi-msg--user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.nodi-msg--bot strong { color: #6366f1; }

.nodi-msg__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.nodi-chip {
    background: #ede9fe;
    color: #6366f1;
    border: 1px solid #c4b5fd;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.nodi-chip:hover {
    background: #6366f1;
    color: #fff;
}

/* Calculator */
.nodi-calc {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 12px;
    margin-top: 6px;
}
.nodi-calc__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.82rem;
}
.nodi-calc__row label { color: #475569; }
.nodi-calc__row select,
.nodi-calc__row input[type="number"] {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.8rem;
    width: 120px;
}
.nodi-calc__row label input[type="checkbox"] {
    accent-color: #6366f1;
    margin-right: 4px;
    vertical-align: middle;
}
.nodi-calc__total {
    border-top: 2px solid #6366f1;
    margin-top: 6px;
    padding-top: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #6366f1;
    text-align: right;
}
.nodi-calc .nodi-chip {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nodi-chat__input {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}
.nodi-chat__input input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}
.nodi-chat__input input:focus {
    border-color: #6366f1;
}
.nodi-chat__input button {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.nodi-chat__input button:hover { transform: scale(1.1); }
.nodi-chat__input button svg { width: 16px; height: 16px; }

.nodi-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}
.nodi-typing span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: nodiDot 1.2s infinite;
}
.nodi-typing span:nth-child(2) { animation-delay: 0.2s; }
.nodi-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes nodiDot {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.1); }
}

@media (max-width: 480px) {
    .nodi-chat {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 80px;
        max-height: 70vh;
    }
    .nodi-fab {
        right: 16px;
        bottom: 80px;
        width: 56px;
        height: 56px;
    }
    .nodi-fab img { width: 44px; height: 44px; }
}
