/* Untz Chat – custom styles (UIkit handles layout/components) */

/* Status indicator */
.untz-chat__status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: 0.8em;
    color: #999;
}

.untz-chat__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
    position: relative;
    transition: background 0.4s ease;
}

.untz-chat__status-text {
    transition: color 0.4s ease;
}

/* Connecting state */
.untz-chat__status--connecting .untz-chat__status-dot {
    background: #f0a500;
    animation: untz-blink 1s ease-in-out infinite;
}

.untz-chat__status--connecting .untz-chat__status-text {
    color: #f0a500;
}

/* Online / active state */
.untz-chat__status--online .untz-chat__status-dot {
    background: #32d296;
}

.untz-chat__status--online .untz-chat__status-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: rgba(50, 210, 150, 0.5);
    animation: untz-pulse 2s ease-in-out infinite;
}

.untz-chat__status--online .untz-chat__status-text {
    color: #32d296;
}

/* Away state */
.untz-chat__status--away .untz-chat__status-dot {
    background: #999;
}

.untz-chat__status--away .untz-chat__status-text {
    color: #999;
}

@keyframes untz-pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50%       { transform: scale(2); opacity: 0; }
}

@keyframes untz-blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.untz-chat__messages {
    height: 320px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    padding: 12px;
    background: var(--uk-background-default, #fff);
}

.untz-no-border .untz-chat__messages {
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
}

.untz-chat__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Message bubbles */
.untz-chat__message {
    display: flex;
    max-width: 80%;
}

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

.untz-chat__message--assistant {
    align-self: flex-start;
}

.untz-chat__bubble {
    padding: 8px 14px;
    border-radius: 18px;
    line-height: 1.5;
    word-break: break-word;
}

.untz-chat__message--user .untz-chat__bubble {
    border-bottom-right-radius: 4px;
}

.untz-chat__message--user .untz-chat__bubble:not([class*="uk-background"]):not([class*="uk-card"]):not([class*="uk-tile"]) {
    background: #1e87f0; /* UIkit primary */
    color: #fff;
}

.untz-chat__message--assistant .untz-chat__bubble {
    border-bottom-left-radius: 4px;
}

.untz-chat__message--assistant .untz-chat__bubble:not([class*="uk-background"]):not([class*="uk-card"]):not([class*="uk-tile"]) {
    background: #f8f8f8;
    color: #333;
}

.untz-chat__bubble.uk-tile {
    padding: 8px 14px;
}

/* Typing indicator */
.untz-chat__typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
}

.untz-chat__dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #999;
    animation: untz-bounce 1.2s infinite;
}

.untz-chat__dot:nth-child(2) { animation-delay: 0.2s; }
.untz-chat__dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes untz-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-5px); }
}

/* Markdown typography inside assistant bubbles */
.untz-chat__message--assistant .untz-chat__bubble p {
    margin: 0 0 6px;
}

.untz-chat__message--assistant .untz-chat__bubble p:last-child {
    margin-bottom: 0;
}

.untz-chat__message--assistant .untz-chat__bubble ul,
.untz-chat__message--assistant .untz-chat__bubble ol {
    margin: 4px 0 6px;
    padding-left: 20px;
}

.untz-chat__message--assistant .untz-chat__bubble li {
    margin-bottom: 2px;
}

.untz-chat__message--assistant .untz-chat__bubble h2 {
    font-size: 1.05em;
    font-weight: 700;
    margin: 0 0 6px;
    line-height: 1.3;
}

.untz-chat__message--assistant .untz-chat__bubble strong {
    font-weight: 600;
}

.untz-chat__message--assistant .untz-chat__bubble em {
    font-style: italic;
}

.untz-chat__message--assistant .untz-chat__bubble code {
    font-family: monospace;
    background: rgba(0, 0, 0, 0.07);
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.untz-chat__message--assistant .untz-chat__bubble a {
    text-decoration: underline;
    color: inherit;
}

/* Quick-start prompt buttons */
.untz-chat__prompts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.untz-chat__prompt-btn {
    background: transparent;
    border: 1px solid #1e87f0;
    color: #1e87f0;
    border-radius: 18px;
    padding: 6px 14px;
    font-size: 0.875em;
    cursor: pointer;
    line-height: 1.4;
    transition: background 0.15s, color 0.15s;
}

.untz-chat__prompt-btn:hover,
.untz-chat__prompt-btn:focus {
    background: #1e87f0;
    color: #fff;
    outline: none;
}

/* Char counter */
.untz-chat__chars {
    margin-left: auto;
}

.untz-chat__chars--warn {
    color: #f0506e;
}
