/* ============================================================
   HAYAT THEME — front.css
   v1.5.3 — Cleaned: single chat-button block, zero duplicates

   Chat button:
     • Desktop:  right 12px, bottom 72px + safe-area, 56×56
     • Mobile:   right 8px,  bottom 68px + safe-area, 52×52
   ============================================================ */

/* ============================================================
   1. FONTS
============================================================ */

@font-face {
    font-family: "AlQuranQalam";
    src: url("https://hayatapp.online/wp-content/uploads/2026/06/Alqalam-Quran-Font-3.woff2") format("woff2");
    font-display: swap;
}
@font-face {
    font-family: "JameelNoori";
    src: url("https://hayatapp.online/wp-content/uploads/2026/06/Jameel-Noori-Nastaleeq-Regular.woff2") format("woff2");
    font-display: swap;
}
@font-face {
    font-family: "NotoNaskhFallback";
    src: url("https://hayatapp.online/wp-content/uploads/2026/06/NotoNaskhArabic-Regular.woff2") format("woff2");
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF,
                   U+FB50-FDFF, U+FE70-FEFF;
}

/* ============================================================
   2. HAYAT CHAT — ROOT & RESET
============================================================ */

.hayat-chat-root {
    --hayat-chat-primary:      var(--hayat-hero-1, #0b6b3a);
    --hayat-chat-primary-dark: var(--hayat-hero-2, #084d2b);

    --hayat-chat-surface: #ffffff;
    --hayat-chat-page:    #f6f8f7;
    --hayat-chat-border:  #e2e9e5;
    --hayat-chat-text:    #18251e;
    --hayat-chat-muted:   #6b7b71;
    --hayat-chat-user:    #e8f5ed;

    font-family: inherit;
    color: var(--hayat-chat-text);
    z-index: 99990;
    position: relative;
    isolation: isolate;
}

.hayat-chat-root *,
.hayat-chat-root *::before,
.hayat-chat-root *::after {
    box-sizing: border-box;
}

.hayat-chat-root button,
.hayat-chat-root textarea,
.hayat-chat-root select {
    font: inherit;
}

.hayat-chat-root button {
    cursor: pointer;
}

.hayat-chat-root button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* ============================================================
   3. HIDE THE OLD GREEN CHATBOT LAUNCHER
============================================================ */

.hayat-chat-launcher,
.hayat-chat-root .hayat-chat-launcher,
#hayat-chat-launcher,
[class*="chat-launcher"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    font-size: 0 !important;
}

/* ============================================================
   4. MAIN PANEL
============================================================ */

.hayat-chat-panel {
    position: fixed;
    inset-inline-end: 20px;
    bottom: 88px;
    z-index: 99991;

    display: flex;
    flex-direction: column;

    width: min(410px, calc(100vw - 32px));
    height: min(620px, calc(100dvh - 125px));
    min-height: 340px;

    overflow: hidden;

    border: 1px solid rgba(222, 232, 226, 0.95);
    border-radius: 22px;

    background: var(--hayat-chat-surface);

    box-shadow:
        0 22px 65px rgba(18, 42, 28, 0.17),
        0 3px 12px rgba(18, 42, 28, 0.06);

    animation: hayatChatAppear 0.22s ease-out;
}

.hayat-chat-panel[hidden] {
    display: none !important;
}

@keyframes hayatChatAppear {
    from { opacity: 0; transform: translateY(10px) scale(0.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   5. HEADER
============================================================ */

.hayat-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px;
    color: #ffffff;
    background: linear-gradient(
        135deg,
        var(--hayat-chat-primary),
        var(--hayat-chat-primary-dark)
    );
}

.hayat-chat-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.hayat-chat-avatar {
    display: flex;
    flex: 0 0 42px;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    font-size: 23px;
    font-weight: 700;
}

.hayat-chat-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 750;
    line-height: 1.5;
}

.hayat-chat-subtitle {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    line-height: 1.5;
}

.hayat-chat-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 6px;
}

.hayat-chat-language {
    max-width: 125px;
    height: 34px;
    padding: 0 7px;
    border: 1px solid rgba(255, 255, 255, 0.32);
    border-radius: 9px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.13);
    font-size: 11px;
}

.hayat-chat-language option {
    color: #18251e;
    background: #ffffff;
}

.hayat-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.14);
    font-size: 25px;
    line-height: 1;
}

.hayat-chat-close:hover {
    background: rgba(255, 255, 255, 0.24);
}

/* ============================================================
   6. CONVERSATION
============================================================ */

.hayat-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 17px 13px 12px;
    background:
        radial-gradient(
            circle at top right,
            rgba(232, 245, 237, 0.55),
            transparent 45%
        ),
        var(--hayat-chat-page);
    scrollbar-width: thin;
    scrollbar-color: #cad8ce transparent;
}

.hayat-chat-message {
    display: flex;
    margin-bottom: 12px;
    width: 100%;
}

.hayat-chat-message-user {
    justify-content: flex-end;
}

.hayat-chat-message-assistant {
    justify-content: flex-start;
}

.hayat-chat-bubble {
    max-width: 94%;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid var(--hayat-chat-border);
    border-radius: 15px;
    background: #ffffff;
    color: var(--hayat-chat-text);
    font-size: 13px;
    line-height: 1.9;
    overflow-wrap: anywhere;
}

.hayat-chat-message-user .hayat-chat-bubble {
    max-width: 88%;
    border-color: transparent;
    border-end-end-radius: 5px;
    background: var(--hayat-chat-user);
}

.hayat-chat-message-assistant .hayat-chat-bubble {
    border-end-start-radius: 5px;
}

.hayat-chat-bubble p {
    margin: 8px 0;
}

.hayat-chat-bubble p:last-child {
    margin-bottom: 0;
}

/* ============================================================
   7. ARTICLE RESPONSE
============================================================ */

.hayat-chat-result-label {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 9px;
    border: 1px solid #d7ebdf;
    border-radius: 999px;
    color: var(--hayat-chat-primary);
    background: #eff9f2;
    font-size: 10px;
    font-weight: 750;
    line-height: 1.6;
}

.hayat-chat-article-title {
    margin: 0 0 9px;
    color: var(--hayat-chat-primary-dark);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.8;
}

.hayat-chat-preview {
    margin: 0;
    color: #39483e;
    font-size: 13px;
    line-height: 2;
    white-space: normal;
}

.hayat-chat-open-article {
    display: block;
    width: 100%;
    margin-top: 13px;
    padding: 10px 12px;
    border: 0;
    border-radius: 10px;
    color: #ffffff;
    background: var(--hayat-chat-primary);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transition: background 0.2s ease;
}

.hayat-chat-open-article:hover {
    background: var(--hayat-chat-primary-dark);
}

.hayat-chat-source-note {
    margin: 10px 0 0 !important;
    padding-top: 8px;
    border-top: 1px solid #edf0ed;
    color: var(--hayat-chat-muted);
    font-size: 10px;
    line-height: 1.8;
}

.hayat-chat-related-heading {
    margin-top: 15px;
    margin-bottom: 8px;
    color: var(--hayat-chat-text);
    font-size: 12px;
    font-weight: 750;
}

.hayat-chat-related-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hayat-chat-related-item {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--hayat-chat-border);
    border-radius: 9px;
    color: #33473a;
    background: #ffffff;
    font-size: 12px;
    line-height: 1.7;
    text-align: start;
    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}

.hayat-chat-related-item:hover {
    border-color: #a9d2b7;
    background: #f1f9f4;
}

/* ============================================================
   8. SUGGESTED QUESTIONS
============================================================ */

.hayat-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin: -3px 0 14px;
}

.hayat-chat-suggestion {
    padding: 8px 10px;
    border: 1px solid #d8e7dc;
    border-radius: 999px;
    color: var(--hayat-chat-primary-dark);
    background: #ffffff;
    font-size: 11px;
    line-height: 1.5;
}

.hayat-chat-suggestion:hover {
    background: #edf8f0;
}

/* ============================================================
   9. LOADING
============================================================ */

.hayat-chat-loading {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 20px;
}

.hayat-chat-loading span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hayat-chat-primary);
    animation: hayatChatDot 1s infinite ease-in-out;
}

.hayat-chat-loading span:nth-child(2) { animation-delay: 0.15s; }
.hayat-chat-loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes hayatChatDot {
    0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
    30%           { opacity: 1;    transform: translateY(-4px); }
}

/* ============================================================
   10. STATUS
============================================================ */

.hayat-chat-status {
    min-height: 0;
    padding: 0 14px;
    color: var(--hayat-chat-muted);
    background: #ffffff;
    font-size: 11px;
    line-height: 1.8;
}

.hayat-chat-status:not(:empty) {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* ============================================================
   11. INPUT
============================================================ */

.hayat-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 11px 12px;
    border-top: 1px solid var(--hayat-chat-border);
    background: #ffffff;
}

.hayat-chat-input {
    display: block;
    flex: 1 1 auto;
    width: 0;
    min-width: 0;
    max-height: 100px;
    min-height: 43px;
    resize: vertical;
    padding: 11px 12px;
    border: 1px solid #dfe8e1;
    border-radius: 12px;
    outline: none;
    color: var(--hayat-chat-text);
    background: #f9fbf9;
    font-size: 13px;
    line-height: 1.7;
}

.hayat-chat-input:focus {
    border-color: #8dc5a0;
    box-shadow: 0 0 0 3px rgba(11, 107, 58, 0.08);
}

.hayat-chat-input::placeholder {
    color: #87948b;
}

.hayat-chat-send {
    flex: 0 0 auto;
    min-width: 64px;
    min-height: 43px;
    padding: 0 13px;
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    background: var(--hayat-chat-primary);
    font-size: 12px;
    font-weight: 750;
}

.hayat-chat-send:hover {
    background: var(--hayat-chat-primary-dark);
}

/* ============================================================
   12. FOOTER
============================================================ */

.hayat-chat-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 13px;
    border-top: 1px solid #f0f2f0;
    color: #8a968e;
    background: #ffffff;
    font-size: 10px;
}

.hayat-chat-clear {
    padding: 3px 0;
    border: 0;
    color: var(--hayat-chat-primary);
    background: transparent;
    font-size: 11px;
    font-weight: 650;
}

/* ============================================================
   13. KEYBOARD FOCUS
============================================================ */

.hayat-chat-root button:focus-visible,
.hayat-chat-root select:focus-visible,
.hayat-chat-root textarea:focus-visible {
    outline: 2px solid #83c69a;
    outline-offset: 2px;
}

/* ============================================================
   14. RTL / LTR
============================================================ */

.hayat-chat-root[dir="rtl"] .hayat-chat-bubble { text-align: right; }
.hayat-chat-root[dir="ltr"] .hayat-chat-bubble { text-align: left; }

.hayat-chat-root[dir="rtl"] .hayat-chat-form,
.hayat-chat-root[dir="ltr"] .hayat-chat-form {
    flex-direction: row;
}

/* ============================================================
   15. MOBILE — PANEL
============================================================ */

@media (max-width: 520px) {
    .hayat-chat-panel {
        inset-inline-end: 8px;
        bottom: 74px;
        width: calc(100vw - 16px);
        height: min(610px, calc(100dvh - 95px));
        min-height: 300px;
        border-radius: 18px;
    }

    .hayat-chat-header   { padding: 12px; }
    .hayat-chat-title    { font-size: 13px; }
    .hayat-chat-subtitle { max-width: 190px; font-size: 10px; }
    .hayat-chat-language { max-width: 95px; font-size: 10px; }
    .hayat-chat-messages { padding: 12px 10px; }
    .hayat-chat-bubble   { max-width: 97%; padding: 11px; font-size: 12px; }
}

/* ============================================================
   16. REDUCED MOTION
============================================================ */

@media (prefers-reduced-motion: reduce) {
    .hayat-chat-root *,
    .hayat-chat-root *::before,
    .hayat-chat-root *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   17. THEME COLOR SYNC
============================================================ */

html body[data-theme="green"] .hayat-chat-root,
html body:not([data-theme]) .hayat-chat-root {
    --hayat-chat-primary:      #0B6B3A;
    --hayat-chat-primary-dark: #064e3b;
}

html body[data-theme="blue"] .hayat-chat-root {
    --hayat-chat-primary:      #0369a1;
    --hayat-chat-primary-dark: #075985;
}

html body[data-theme="rose"] .hayat-chat-root {
    --hayat-chat-primary:      #be185d;
    --hayat-chat-primary-dark: #831843;
}

html body[data-theme="lavender"] .hayat-chat-root {
    --hayat-chat-primary:      #6d28d9;
    --hayat-chat-primary-dark: #4c1d95;
}

html body[data-theme="sand"] .hayat-chat-root {
    --hayat-chat-primary:      #b45309;
    --hayat-chat-primary-dark: #78350f;
}

html body[data-theme="mint"] .hayat-chat-root {
    --hayat-chat-primary:      #047857;
    --hayat-chat-primary-dark: #064e3b;
}

body.dark-mode .hayat-chat-root {
    --hayat-chat-primary:      #1f2937;
    --hayat-chat-primary-dark: #0b1220;
}

/* ============================================================
   18. 🎯 CHAT EMOJI BUTTON — POSITION (SINGLE SOURCE OF TRUTH)
   ============================================================
   The floating 💬 button is injected by chatbot.js with its
   own inline styles (right: 20px; bottom: 85px). These rules
   override those on every page load.

   Desktop → right: 12px, bottom: 72px + safe-area, 56×56
   Mobile  → right:  8px, bottom: 68px + safe-area, 52×52
   ============================================================ */

html body #hayat-assistant-floating-btn {
    position: fixed !important;
    right: 12px !important;
    left: auto !important;
    top: auto !important;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    width: 56px !important;
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    color: #0B6B3A !important;
    font-size: 40px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    z-index: 99990 !important;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35)) !important;
    transition: transform 0.2s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

html body #hayat-assistant-floating-btn:hover {
    transform: scale(1.1) !important;
}

html body #hayat-assistant-floating-btn:active {
    transform: scale(0.95) !important;
}

html body #hayat-assistant-floating-btn:focus-visible {
    outline: 2px solid #0B6B3A !important;
    outline-offset: 4px !important;
}

/* Mobile — tighter to corner */
@media (max-width: 520px) {
    html body #hayat-assistant-floating-btn {
        right: 4px !important;
        bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
        width: 52px !important;
        height: 52px !important;
        min-height: 52px !important;
        font-size: 36px !important;
    }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    html body #hayat-assistant-floating-btn,
    html body #hayat-assistant-floating-btn:hover,
    html body #hayat-assistant-floating-btn:active {
        transition: none !important;
        transform: none !important;
    }
}

/* Dark mode — bright neon green on dark backgrounds */
html body.dark-mode #hayat-assistant-floating-btn {
    color: #34d399 !important;
}

html body.dark-mode #hayat-assistant-floating-btn:focus-visible {
    outline-color: #34d399 !important;
}