/* ── Chatbot Ulm – Primăria Pantelimon ── */

:root {
    --cp-blue:       #1a4fa0;
    --cp-blue-dark:  #133c7a;
    --cp-blue-light: #2563eb;
    --cp-white:      #ffffff;
    --cp-gray-bg:    #f1f5f9;
    --cp-gray-text:  #64748b;
    --cp-border:     #e2e8f0;
    --cp-radius:     16px;
    --cp-shadow:     0 8px 32px rgba(26,79,160,0.18);
}

/* ── Toggle Button ── */
#cp-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cp-blue), var(--cp-blue-light));
    border: none;
    cursor: pointer;
    box-shadow: var(--cp-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}
#cp-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 36px rgba(26,79,160,0.28);
}
#cp-toggle svg {
    width: 28px;
    height: 28px;
    fill: white;
    transition: transform 0.3s ease;
}
#cp-toggle.open svg {
    transform: rotate(45deg);
}
#cp-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53e3e;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: sans-serif;
    border: 2px solid white;
    animation: cp-pulse 2s infinite;
}
@keyframes cp-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15); }
}

/* ── Chat Window ── */
#cp-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 99998;
    width: 360px;
    height: 540px;
    background: var(--cp-white);
    border-radius: var(--cp-radius);
    box-shadow: var(--cp-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--cp-border);
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
    transform-origin: bottom right;
}
#cp-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ── */
#cp-header {
    background: linear-gradient(135deg, var(--cp-blue), var(--cp-blue-light));
    color: white;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
#cp-header-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
#cp-header-info {
    flex: 1;
}
#cp-header-name {
    font-weight: 700;
    font-size: 15px;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 0.3px;
}
#cp-header-sub {
    font-size: 11px;
    opacity: 0.85;
    margin-top: 1px;
}
#cp-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    margin-right: 2px;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74,222,128,0.3);
}
#cp-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
#cp-close-btn:hover { background: rgba(255,255,255,0.15); }
#cp-close-btn svg { width: 18px; height: 18px; fill: white; }

/* ── Messages Area ── */
#cp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--cp-gray-bg);
    scroll-behavior: smooth;
}
#cp-messages::-webkit-scrollbar { width: 4px; }
#cp-messages::-webkit-scrollbar-track { background: transparent; }
#cp-messages::-webkit-scrollbar-thumb { background: var(--cp-border); border-radius: 4px; }

/* ── Message Bubbles ── */
.cp-msg {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    animation: cp-slide-in 0.2s ease;
}
@keyframes cp-slide-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.cp-msg.user { flex-direction: row-reverse; }

.cp-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cp-blue), var(--cp-blue-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    flex-shrink: 0;
    color: white;
    font-family: Georgia, serif;
    font-weight: 700;
}

.cp-bubble {
    max-width: 78%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.55;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    word-break: break-word;
}
.cp-msg.bot .cp-bubble {
    background: var(--cp-white);
    color: #1e293b;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.cp-msg.user .cp-bubble {
    background: linear-gradient(135deg, var(--cp-blue), var(--cp-blue-light));
    color: white;
    border-bottom-right-radius: 4px;
}
.cp-bubble strong { font-weight: 600; }
.cp-bubble br + br { display: none; }

.cp-time {
    font-size: 10px;
    color: var(--cp-gray-text);
    margin-top: 2px;
    padding: 0 4px;
}
.cp-msg.user .cp-time { text-align: right; }

/* ── Typing Indicator ── */
#cp-typing {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
}
#cp-typing.show { display: flex; }
.cp-dot-flashing {
    background: var(--cp-white);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    gap: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}
.cp-dot-flashing span {
    width: 6px;
    height: 6px;
    background: var(--cp-blue);
    border-radius: 50%;
    animation: cp-blink 1.2s infinite;
}
.cp-dot-flashing span:nth-child(2) { animation-delay: 0.2s; }
.cp-dot-flashing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes cp-blink {
    0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
    40%           { opacity: 1;    transform: scale(1); }
}

/* ── Suggestions ── */
#cp-suggestions {
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--cp-gray-bg);
    border-top: 1px solid var(--cp-border);
    flex-shrink: 0;
}
#cp-suggestions.hidden { display: none; }
.cp-suggestion {
    background: var(--cp-white);
    border: 1px solid var(--cp-border);
    border-radius: 20px;
    padding: 5px 10px;
    font-size: 11.5px;
    color: var(--cp-blue);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
.cp-suggestion:hover {
    background: var(--cp-blue);
    color: white;
    border-color: var(--cp-blue);
}

/* ── Input Area ── */
#cp-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--cp-border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--cp-white);
    flex-shrink: 0;
}
#cp-input {
    flex: 1;
    border: 1.5px solid var(--cp-border);
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13.5px;
    resize: none;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.4;
    max-height: 100px;
    transition: border-color 0.15s;
    color: #1e293b;
    background: var(--cp-gray-bg);
}
#cp-input:focus { border-color: var(--cp-blue-light); background: white; }
#cp-input::placeholder { color: #94a3b8; }

#cp-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cp-blue), var(--cp-blue-light));
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s, opacity 0.15s;
}
#cp-send:hover { transform: scale(1.08); }
#cp-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
#cp-send svg { width: 18px; height: 18px; fill: white; }

/* ── Error message ── */
.cp-error {
    background: #fef2f2;
    color: #dc2626;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 12.5px;
    text-align: center;
    margin: 0 4px;
}

/* ── Responsive ── */
@media (max-width: 400px) {
    #cp-window {
        width: calc(100vw - 16px);
        right: 8px;
        bottom: 88px;
        height: 70vh;
    }
    #cp-toggle { right: 16px; bottom: 16px; }
}
