/* ============================================================
   Chatbot Primăria Cornu — Ultra Minimalist AI UI (Final)
   ============================================================ */

:root {
    --cc-white:          #ffffff;
    --cc-warm-grey:      #f2f1ef;   /* 8% gri cald */
    --cc-border:         #e7e5e3;
    --cc-text:           #2a2a2a;
    --cc-text-muted:     #8c8c8c;
    --cc-accent:         #7A4FFF;   /* mov 2% */
    --cc-radius:         22px;
    --cc-radius-sm:      16px;

    --cc-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --cc-widget-size: 64px;
    --cc-window-w:    390px;
    --cc-window-h:    600px;

    --cc-z: 99999;
}

/* ───────────────────────────────────────── */
/* Widget */
/* ───────────────────────────────────────── */

#cornu-chatbot-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: var(--cc-z);
    font-family: var(--cc-font);
}

/* ───────────────────────────────────────── */
/* Toggle */
/* ───────────────────────────────────────── */

#cornu-chatbot-toggle {
    width: var(--cc-widget-size);
    height: var(--cc-widget-size);

    border-radius: 50%;
    border: 1px solid var(--cc-border);

    cursor: pointer;

    display: flex;
    align-items: center;
    justify-content: center;

    background: var(--cc-white);
    color: var(--cc-accent);

    box-shadow: 0 6px 22px rgba(0,0,0,.06);

    transition: transform .25s ease, box-shadow .25s ease;
}

#cornu-chatbot-toggle img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    display: block;
}

#cornu-chatbot-toggle svg,
#cornu-chatbot-send svg {
    display: block;
    vertical-align: middle;
    pointer-events: none;
    flex-shrink: 0;
}

#cornu-chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0,0,0,.08);
}

#cornu-chatbot-toggle:focus-visible {
    outline: 3px solid var(--cc-accent);
    outline-offset: 3px;
}

/* ───────────────────────────────────────── */
/* Window */
/* ───────────────────────────────────────── */

#cornu-chatbot-window {
    position: absolute;
    bottom: calc(var(--cc-widget-size) + 16px);
    right: 0;

    width: var(--cc-window-w);
    height: var(--cc-window-h);

    background: var(--cc-white);

    border-radius: var(--cc-radius);
    border: 1px solid var(--cc-border);

    box-shadow: 0 20px 60px rgba(0,0,0,.08);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    transform-origin: bottom right;
    animation: cc-open .22s ease-out;
}

#cornu-chatbot-window[hidden] {
    display: none !important;
}

@keyframes cc-open {
    from { opacity: 0; transform: scale(.94) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ───────────────────────────────────────── */
/* Header */
/* ───────────────────────────────────────── */

#cornu-chatbot-header {
    background: var(--cc-white);
    border-bottom: 1px solid var(--cc-border);

    padding: 18px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    flex-shrink: 0;
}

.header-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--cc-text);
}

.header-subtitle {
    font-size: 11px;
    color: var(--cc-text-muted);
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* Status Online + bulină verde */
.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #4CD964; /* verde status iOS */
    box-shadow: 0 0 0 3px rgba(76,217,100,.25);
}

.status-text {
    font-size: 12px;
    color: var(--cc-text-muted);
}

/* Avatar auto-detectat */
#cornu-chatbot-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--cc-warm-grey);
    border: 1px solid var(--cc-border);
    object-fit: cover;
    display: block;
}

/* ───────────────────────────────────────── */
/* Messages */
/* ───────────────────────────────────────── */

#cornu-chatbot-messages {
    flex: 1;
    overflow-y: auto;

    padding: 24px;

    display: flex;
    flex-direction: column;
    gap: 16px;

    background: var(--cc-warm-grey);

    scroll-behavior: smooth;
}

#cornu-chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

#cornu-chatbot-messages::-webkit-scrollbar-thumb {
    background: #dcd9d6;
    border-radius: 20px;
}

.message {
    max-width: 86%;
    display: flex;
    flex-direction: column;
}

.message.bot { align-self: flex-start; }
.message.user { align-self: flex-end; }

.message-content {
    padding: 16px 18px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;

    border-radius: var(--cc-radius-sm);
}

/* BOT */

.message.bot .message-content {
    background: var(--cc-white);
    border: 1px solid var(--cc-border);
    color: var(--cc-text);
    box-shadow: 0 2px 6px rgba(0,0,0,.03);
}

/* USER */

.message.user .message-content {
    background: var(--cc-accent);
    color: var(--cc-white);
}

/* ERROR */

.message.error .message-content {
    background: #fff3f3;
    border: 1px solid #e8bcbc;
    color: #9b2323;
}

/* ───────────────────────────────────────── */
/* Typing */
/* ───────────────────────────────────────── */

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;

    padding: 12px 14px;

    background: var(--cc-white);
    border: 1px solid var(--cc-border);

    border-radius: var(--cc-radius-sm);

    align-self: flex-start;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cc-text-muted);
    opacity: .6;
}

/* ───────────────────────────────────────── */
/* Input */
/* ───────────────────────────────────────── */

#cornu-chatbot-input-area {
    padding: 20px;
    border-top: 1px solid var(--cc-border);
    background: var(--cc-white);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Chips */

.suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    font-size: 12px;
    padding: 8px 12px;
    background: var(--cc-white);
    border: 1px solid var(--cc-border);
    border-radius: 999px;
    cursor: pointer;
    color: var(--cc-accent);
    transition: all .2s ease;
}

.suggestion-chip:hover {
    background: var(--cc-accent);
    color: var(--cc-white);
    border-color: var(--cc-accent);
}

.suggestions.hidden { display: none; }

/* Input row */

.input-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#cornu-chatbot-input {
    flex: 1;
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius-sm);
    padding: 12px 14px;
    font-size: 14px;
    font-family: var(--cc-font);
    color: var(--cc-text);
    resize: none;
    line-height: 1.5;
    max-height: 96px;
    overflow-y: auto;
    background: var(--cc-warm-grey);
    outline: none;
    transition: .2s ease;
}

#cornu-chatbot-input:focus {
    background: var(--cc-white);
    border-color: var(--cc-accent);
    box-shadow: 0 0 0 4px rgba(185,168,255,.18);
}

#cornu-chatbot-input::placeholder {
    color: var(--cc-text-muted);
}

#cornu-chatbot-send {
    width: 46px;
    height: 46px;
    min-width: 46px;
    border: none;
    border-radius: var(--cc-radius-sm);
    background: var(--cc-accent);
    color: var(--cc-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s ease;
}

#cornu-chatbot-send img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    display: block;
}

#cornu-chatbot-send:hover {
    transform: translateY(-1px);
}

#cornu-chatbot-send:disabled {
    background: #e6e2f7;
    cursor: not-allowed;
}

/* Disclaimer */

.chatbot-disclaimer {
    margin: 0;
    text-align: center;
    font-size: 11px;
    color: var(--cc-text-muted);
    line-height: 1.5;
}

/* ───────────────────────────────────────── */
/* Responsive */
/* ───────────────────────────────────────── */

@media (max-width: 440px) {
    #cornu-chatbot-widget {
        bottom: 16px;
        right: 16px;
    }

    #cornu-chatbot-window {
        width: calc(100vw - 32px);
        right: -16px;
        height: 70vh;
        max-height: 560px;
    }
}

/* ───────────────────────────────────────── */
/* Reduced Motion */
/* ───────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    #cornu-chatbot-window { animation: none; }
}

/* ─── Chat links ─────────────────────────────────────────────── */
.message-content a.chat-link {
    color: var(--cc-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
    transition: opacity 0.15s;
}
.message-content a.chat-link:hover {
    opacity: 0.75;
}
.message.user .message-content a.chat-link {
    color: rgba(255,255,255,0.9);
}
