/* Learning Quraan Chatbot Styles — Page-Aware Version */

/* ── Launcher Button ─────────────────────────────── */
#lq-chat-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 62px;
    height: 62px;
    background: linear-gradient(135deg, #1a5c3a, #0f3d26);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999999;
    box-shadow: 0 4px 20px rgba(26,92,58,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
}
#lq-chat-launcher:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(26,92,58,0.55);
}
/* Pulse animation when closed */
#lq-chat-launcher:not(.lq-open)::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid rgba(26,92,58,0.4);
    animation: lqPulse 2s ease-out infinite;
}
@keyframes lqPulse {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* ── Notification badge ──────────────────────────── */
#lq-chat-launcher .lq-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 18px;
    height: 18px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid #fff;
    font-size: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ── Chat Widget ─────────────────────────────────── */
#lq-chat-widget {
    position: fixed;
    bottom: 100px;
    left: 24px;
    width: 375px;
    height: 560px;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.18);
    z-index: 999998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    animation: lqSlideUp 0.25s ease;
}
@keyframes lqSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ──────────────────────────────────────── */
#lq-chat-header {
    background: linear-gradient(135deg, #1a5c3a 0%, #0f3d26 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
#lq-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
#lq-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #fff;
    flex-shrink: 0;
}
#lq-header-name {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
}
#lq-header-sub {
    color: rgba(255,255,255,0.65);
    font-size: 11px;
    margin-top: 1px;
}
#lq-online-badge {
    background: #4ade80;
    color: #0f3d26;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}
#lq-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.15s;
}
#lq-close-btn:hover { color: #fff; }

/* ── Page context label ──────────────────────────── */
#lq-page-label {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.8);
    font-size: 10.5px;
    padding: 5px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    letter-spacing: 0.2px;
    flex-shrink: 0;
}

/* ── Messages ────────────────────────────────────── */
#lq-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 14px 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}
#lq-messages::-webkit-scrollbar { width: 4px; }
#lq-messages::-webkit-scrollbar-track { background: transparent; }
#lq-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

.lq-bot-msg, .lq-user-msg {
    max-width: 84%;
    font-size: 13.5px;
    line-height: 1.6;
    padding: 10px 13px;
    border-radius: 16px;
    word-break: break-word;
}
.lq-bot-msg {
    background: #f1f5f9;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}
.lq-user-msg {
    background: linear-gradient(135deg, #1a5c3a, #0f3d26);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* ── Typing indicator ────────────────────────────── */
.lq-typing {
    display: flex;
    gap: 5px;
    padding: 12px 14px;
    background: #f1f5f9;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: fit-content;
}
.lq-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: lqBounce 1.2s infinite;
}
.lq-dot:nth-child(2) { animation-delay: 0.2s; }
.lq-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes lqBounce {
    0%,60%,100% { transform: translateY(0); }
    30%          { transform: translateY(-6px); }
}

/* ── Quick Replies ───────────────────────────────── */
#lq-quick-replies {
    padding: 8px 14px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex-shrink: 0;
}
.lq-qr {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1.5px solid #1a5c3a;
    color: #1a5c3a;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    font-weight: 500;
}
.lq-qr:hover {
    background: #1a5c3a;
    color: #fff;
}

/* ── Lead Form ───────────────────────────────────── */
#lq-lead-form {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    flex-direction: column;
    gap: 8px;
    display: none;
    flex-shrink: 0;
    background: #f8fafc;
}
#lq-lead-form label {
    font-size: 12px;
    font-weight: 600;
    color: #1a5c3a;
    margin-bottom: -3px;
}
#lq-lead-form input {
    padding: 9px 12px;
    font-size: 13px;
    border-radius: 9px;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    color: #1a1a1a;
    width: 100%;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
#lq-lead-form input:focus {
    outline: none;
    border-color: #1a5c3a;
}
#lq-lead-form button {
    padding: 10px;
    background: linear-gradient(135deg, #1a5c3a, #0f3d26);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s;
    letter-spacing: 0.3px;
}
#lq-lead-form button:hover { opacity: 0.88; }

/* ── Input Row ───────────────────────────────────── */
#lq-input-row {
    padding: 10px 14px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}
#lq-inp {
    flex: 1;
    padding: 10px 14px;
    font-size: 13.5px;
    border-radius: 24px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    color: #1a1a1a;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
#lq-inp:focus { outline: none; border-color: #1a5c3a; }
#lq-inp::placeholder { color: #9ca3af; }

#lq-send-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a5c3a, #0f3d26);
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity 0.15s, transform 0.15s;
}
#lq-send-btn:hover { opacity: 0.85; transform: scale(1.05); }

/* ── Mobile ──────────────────────────────────────── */
@media (max-width: 480px) {
    #lq-chat-widget {
        width: calc(100vw - 20px);
        left: 10px;
        bottom: 88px;
        height: 72vh;
    }
    #lq-chat-launcher {
        left: 16px;
        bottom: 16px;
    }
}

/* ── CTA Card (Bottom Right) ─────────────────────── */
#lq-cta-card {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 280px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.16);
    padding: 18px 18px 16px;
    z-index: 999997;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    border-left: 4px solid #1a5c3a;

    /* Hidden by default */
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    transition: opacity 0.35s ease, transform 0.35s ease;
    pointer-events: none;
}
#lq-cta-card.lq-cta-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}
#lq-cta-card.lq-cta-hiding {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
    pointer-events: none;
}

#lq-cta-dismiss {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 14px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
    transition: color 0.15s;
}
#lq-cta-dismiss:hover { color: #475569; }

#lq-cta-icon {
    font-size: 22px;
    margin-bottom: 6px;
}
#lq-cta-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f3d26;
    margin-bottom: 5px;
    line-height: 1.3;
    padding-right: 18px;
}
#lq-cta-body {
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 12px;
}
#lq-cta-btn {
    width: 100%;
    padding: 10px 14px;
    background: linear-gradient(135deg, #1a5c3a, #0f3d26);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.15s, transform 0.15s;
    letter-spacing: 0.2px;
}
#lq-cta-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

/* Mobile: CTA card full width */
@media (max-width: 480px) {
    #lq-cta-card {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 88px;
    }
}
