/* ── Ziggy Chat Widget ──────────────────────────────────────────── */
.ziggy-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0;
}

.ziggy-messages {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    scroll-behavior: smooth;
}

.ziggy-message {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    max-width: 90%;
}

.ziggy-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ziggy-bot {
    align-self: flex-start;
}

.ziggy-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.ziggy-bot .ziggy-avatar {
    background: var(--accent-color, #2563eb);
}

.ziggy-user .ziggy-avatar {
    background: var(--bg-tertiary, #374151);
}

.ziggy-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.ziggy-avatar-emoji {
    font-size: 16px;
    line-height: 1;
}

.ziggy-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.ziggy-bot .ziggy-bubble {
    background: var(--bg-secondary, #1f2937);
    color: var(--text-primary, #f3f4f6);
    border-bottom-left-radius: 4px;
}

.ziggy-user .ziggy-bubble {
    background: var(--accent-color, #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}

.ziggy-input-row {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border-color, #374151);
    background: var(--bg-primary, #111827);
}

.ziggy-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #374151);
    border-radius: 20px;
    background: var(--bg-tertiary, #1f2937);
    color: var(--text-primary, #f3f4f6);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
}

.ziggy-input:focus {
    border-color: var(--accent-color, #2563eb);
}

.ziggy-input:disabled {
    opacity: 0.5;
}

.ziggy-send {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: var(--accent-color, #2563eb);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.ziggy-send:hover:not(:disabled) {
    opacity: 0.85;
}

.ziggy-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Initial welcome message */
.ziggy-message:first-child .ziggy-bubble {
    border-bottom-left-radius: 4px;
}

/* Results table inside chat */
.ziggy-results {
    margin-top: 8px;
    overflow-x: auto;
}

.ziggy-results table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.ziggy-results th {
    background: var(--bg-tertiary, #374151);
    padding: 4px 6px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color, #4b5563);
}

.ziggy-results td {
    padding: 3px 6px;
    border-bottom: 1px solid var(--border-color, #1f2937);
    white-space: nowrap;
}

.ziggy-results tbody tr:hover {
    background: var(--bg-tertiary, #374151);
}

.ziggy-more {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary, #9ca3af);
    font-style: italic;
}

/* Link pills inside chat bubble */
.ziggy-bubble .notif-links {
    margin-top: 4px;
}

.ziggy-bubble .notif-link {
    background: var(--bg-tertiary, #374151);
    border-color: var(--border-color, #4b5563);
    padding: 1px 6px;
    font-size: 11px;
}

/* Thinking indicator — bouncing dots */
.ziggy-thinking .ziggy-bubble {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    min-height: 20px;
}

.ziggy-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary, #9ca3af);
    animation: ziggyBounce 1.4s ease-in-out infinite;
}

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

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

@keyframes ziggyBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}
