/* Chatbot Premium Design – Hope by Uswa Foundation */
#chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    pointer-events: none;
}
#chatbot-wrapper.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ---------- Toggle Button ---------- */
#chatbot-toggle {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: #059669;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(5, 150, 105, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
#chatbot-toggle::after {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 2px solid rgba(5, 150, 105, 0.35);
    animation: pulse-ring 2.2s infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(1.35); opacity: 0; }
}
#chatbot-toggle:hover {
    transform: scale(1.08);
    background: #047857;
    box-shadow: 0 14px 36px rgba(5, 150, 105, 0.45);
}
#chatbot-toggle svg {
    width: 28px;
    height: 28px;
}

/* ---------- Chat Panel ---------- */
#chatbot-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 580px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0,0,0,0.12), 0 0 0 1px rgba(5, 150, 105, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: panelIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes panelIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ---------- Header (with subtle paw prints) ---------- */
#chatbot-header {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    padding: 22px 18px 22px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-radius: 24px 24px 0 0;
    position: relative;
    overflow: hidden;
}
#chatbot-header::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -30px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    border-radius: 50%;
}
#chatbot-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 1px;
    background: rgba(255,255,255,0.15);
}
.chatbot-logo img {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
    z-index: 1;
}
.chatbot-title {
    z-index: 1;
}
.chatbot-title h4 {
    margin: 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: #ffffff;
    letter-spacing: -0.3px;
}
.chatbot-title span {
    font-size: 0.7rem;
    color: #d1fae5;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
}
.chatbot-title span::before {
    content: '';
    width: 7px;
    height: 7px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.4s infinite;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}
#chatbot-close {
    margin-left: auto;
    background: rgba(255,255,255,0.12);
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    z-index: 1;
}
#chatbot-close:hover {
    background: rgba(255,255,255,0.25);
    transform: rotate(90deg);
}

/* ---------- Messages Area ---------- */
#chatbot-messages {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}
#chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
#chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* ---------- Message Bubbles (preserves formatting from AI) ---------- */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 0.92rem;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
    animation: msgPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    white-space: pre-wrap;  /* ← preserves line breaks, bullet points, and spacing */
}
@keyframes msgPop {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.message.user {
    align-self: flex-end;
    background: #059669;
    color: #fff;
    border-bottom-right-radius: 8px;
}
.message.bot {
    align-self: flex-start;
    background: #ffffff;
    color: #0B1120;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 8px;
}

/* Typing indicator */
.typing-dots {
    display: inline-flex;
    gap: 4px;
    padding: 6px 0;
}
.typing-dots span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ---------- Input Area ---------- */
#chatbot-input-area {
    display: flex;
    border-top: 1px solid #e2e8f0;
    padding: 14px 12px;
    background: #ffffff;
    gap: 10px;
    align-items: center;
}
#chatbot-input {
    flex: 1;
    border: 2px solid #e2e8f0;
    border-radius: 30px;
    padding: 10px 18px;
    font-size: 0.92rem;
    outline: none;
    background: #F8FAFC;
    transition: border-color 0.3s, box-shadow 0.3s;
    font-family: inherit;
}
#chatbot-input:focus {
    border-color: #059669;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.08);
}
#chatbot-send {
    background: #059669;
    color: #fff;
    border: none;
    border-radius: 30px;
    padding: 11px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    transition: background 0.3s, transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.2);
}
#chatbot-send:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.3);
}

/* ---------- Mobile ---------- */
@media (max-width: 480px) {
    #chatbot-panel {
        width: 100%;
        right: 0;
        bottom: 0;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    #chatbot-header {
        border-radius: 0;
    }
}