/* ============================================
   ANA CHATBOT — Widget Chat
   Temă configurabilă prin CSS variables
   ============================================ */

/* --- Container & Buton --- */
.ana-chat-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    height: 48px;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px 0 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    background: var(--ana-accent, #d4a843);
    color: var(--ana-text-on-accent, #0a0f1a);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.ana-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
}

.ana-chat-btn svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.ana-chat-btn-text {
    transition: opacity 0.2s ease;
}

.ana-chat-btn.ana-open {
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
}

.ana-chat-btn.ana-open .ana-chat-btn-text {
    display: none;
}

/* Pulse animation pe buton */
.ana-chat-btn::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--ana-accent, #d4a843);
    opacity: 0;
    animation: ana-pulse 3s ease-in-out infinite;
    pointer-events: none;
}

.ana-chat-btn.ana-open::after {
    animation: none;
}

@keyframes ana-pulse {
    0%, 100% { opacity: 0; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.3); }
}

/* --- Fereastră Chat --- */
.ana-chat-window {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 9998;
    width: 380px;
    max-height: 560px;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.ana-chat-window.ana-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* --- Header --- */
.ana-chat-header {
    background: var(--ana-accent, #d4a843);
    color: var(--ana-text-on-accent, #0a0f1a);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ana-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.ana-chat-header-info {
    flex: 1;
    min-width: 0;
}

.ana-chat-header-name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.ana-chat-header-sub {
    font-size: 0.78rem;
    opacity: 0.85;
    line-height: 1.3;
}

.ana-chat-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ana-chat-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.ana-chat-close svg {
    width: 20px;
    height: 20px;
}

/* --- Messages Area --- */
.ana-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    max-height: 360px;
}

.ana-chat-messages::-webkit-scrollbar {
    width: 5px;
}

.ana-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ana-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* --- Mesaje --- */
.ana-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.55;
    word-wrap: break-word;
    animation: ana-msg-in 0.25s ease;
}

@keyframes ana-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ana-msg-bot {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.ana-msg-user {
    align-self: flex-end;
    background: var(--ana-accent, #d4a843);
    color: var(--ana-text-on-accent, #0a0f1a);
    border-bottom-right-radius: 4px;
}

/* Formatare text bot (bold, liste) */
.ana-msg-bot strong {
    font-weight: 600;
    color: #0f172a;
}

.ana-msg-bot ul,
.ana-msg-bot ol {
    margin: 6px 0;
    padding-left: 18px;
}

.ana-msg-bot li {
    margin-bottom: 3px;
}

/* --- Typing Indicator --- */
.ana-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}

.ana-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: ana-typing-bounce 1.4s ease-in-out infinite;
}

.ana-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ana-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ana-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* --- Input Area --- */
.ana-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ana-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
    min-height: 40px;
    max-height: 80px;
    line-height: 1.4;
}

.ana-chat-input:focus {
    border-color: var(--ana-accent, #d4a843);
}

.ana-chat-input::placeholder {
    color: #94a3b8;
}

.ana-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--ana-accent, #d4a843);
    color: var(--ana-text-on-accent, #0a0f1a);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    align-self: flex-end;
}

.ana-chat-send:hover {
    transform: scale(1.06);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ana-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ana-chat-send svg {
    width: 18px;
    height: 18px;
}

/* --- Footer (disclaimer + remaining) --- */
.ana-chat-footer {
    padding: 8px 16px;
    background: #f1f5f9;
    text-align: center;
    font-size: 0.72rem;
    color: #94a3b8;
    line-height: 1.4;
    flex-shrink: 0;
}

/* --- Responsive: Mobile full-screen --- */
@media (max-width: 480px) {
    .ana-chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
    }

    .ana-chat-messages {
        max-height: none;
        flex: 1;
    }

    .ana-chat-btn {
        bottom: 16px;
        right: 16px;
    }
}

/* Cookie banner prezent — ridică butonul */
.cookie-banner.show ~ .ana-chat-btn {
    bottom: 80px;
}

@media (max-width: 480px) {
    .cookie-banner.show ~ .ana-chat-btn {
        bottom: 100px;
    }
}
