.ask-emad-launcher{
 position:fixed;right:22px;bottom:22px;z-index:400;
 border:0;border-radius:999px;padding:13px 18px;
 background:var(--primary);color:#fff;font-weight:700;
 box-shadow:0 10px 30px rgba(0,0,0,.22);cursor:pointer;
}
.ask-emad-panel{
 position:fixed;right:22px;bottom:82px;z-index:400;
 width:min(390px,calc(100vw - 28px));height:570px;
 max-height:calc(100vh - 110px);background:#fff;
 border:1px solid var(--slate-200);border-radius:18px;
 box-shadow:0 24px 60px rgba(0,0,0,.28);
 display:flex;flex-direction:column;overflow:hidden;
}
.ask-emad-panel[hidden]{display:none}
.ask-emad-head{padding:15px 16px;background:var(--primary);color:#fff;
 display:flex;justify-content:space-between;align-items:center}
.ask-emad-head strong{display:block}
.ask-emad-head small{opacity:.82}
.ask-emad-close{border:0;background:transparent;color:#fff;font-size:20px;cursor:pointer}
.ask-emad-messages{flex:1;overflow:auto;padding:14px;background:#f8fafc}
.ask-msg{max-width:88%;padding:10px 12px;margin:0 0 10px;
 border-radius:12px;white-space:pre-wrap;font-size:.88rem;line-height:1.5}
.ask-msg.bot{background:#fff;border:1px solid var(--slate-200)}
.ask-msg.user{margin-left:auto;background:var(--primary);color:#fff}
.ask-emad-quick{display:flex;gap:6px;padding:8px 12px;overflow-x:auto}
.ask-emad-quick button{white-space:nowrap;border:1px solid var(--slate-200);
 background:#fff;border-radius:999px;padding:6px 9px;font-size:.72rem;cursor:pointer}
.ask-emad-form{display:flex;gap:7px;padding:11px;border-top:1px solid var(--slate-200)}
.ask-emad-form input{flex:1;border:1px solid var(--slate-300);border-radius:10px;padding:10px}
.ask-emad-form button{border:0;border-radius:10px;background:var(--primary);
 color:#fff;padding:0 13px;cursor:pointer}
@media(max-width:520px){
 .ask-emad-panel{right:14px;bottom:76px;height:70vh}
 .ask-emad-launcher{right:14px;bottom:14px}
}

/* Arabic / RTL support */
.ask-msg.rtl {
  direction: rtl;
  text-align: right;
  unicode-bidi: plaintext;
}

.ask-msg.ltr {
  direction: ltr;
  text-align: left;
  unicode-bidi: plaintext;
}

.ask-emad-form input[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.ask-emad-form input[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

/* Better Arabic readability */
.ask-msg {
  line-height: 1.7;
  word-break: break-word;
}

/* ===== MOBILE CHAT LAUNCHER QA ===== */
@media (max-width: 768px) {
  .ask-emad-launcher {
    right: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom)) !important;

    width: 48px;
    height: 48px;
    min-width: 48px;

    padding: 0 !important;
    border-radius: 50% !important;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 0 !important;
    line-height: 1;
  }

  .ask-emad-launcher i {
    font-size: 1rem !important;
    margin: 0 !important;
  }

  .ask-emad-panel {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;

    width: auto !important;
    max-width: none !important;
    height: min(70vh, 620px) !important;
    max-height: calc(100dvh - 95px);
  }
}
/* ===== END MOBILE CHAT LAUNCHER QA ===== */



/* ===== MOBILE CHAT SAFE POSITION FINAL ===== */
@media (max-width: 768px) {
    .ask-emad-launcher {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;

        right: 12px !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;

        padding: 0 !important;
        border-radius: 50% !important;

        position: fixed !important;
        z-index: 10000 !important;
    }

    .ask-emad-launcher i {
        font-size: 1rem !important;
        margin: 0 !important;
    }
}
/* ===== END MOBILE CHAT SAFE POSITION FINAL ===== */


/* ===== MOBILE CHAT VIEWPORT FIT FINAL ===== */
@media (max-width: 768px) {

    .ask-emad-panel {
        position: fixed !important;

        top: max(8px, env(safe-area-inset-top)) !important;
        left: 8px !important;
        right: 8px !important;
        bottom: calc(68px + env(safe-area-inset-bottom)) !important;

        width: auto !important;
        max-width: none !important;

        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;

        margin: 0 !important;
        overflow: hidden !important;

        display: flex !important;
        flex-direction: column !important;

        z-index: 10001 !important;
    }

    .ask-emad-panel[hidden] {
        display: none !important;
    }

    .ask-emad-head,
    .ask-emad-quick,
    .ask-emad-form {
        flex: 0 0 auto;
    }

    .ask-emad-messages {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .ask-emad-form {
        width: 100%;
    }

    .ask-emad-form input {
        min-width: 0 !important;
        font-size: 16px !important;
    }

    .ask-emad-launcher {
        right: 12px !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
        width: 48px !important;
        height: 48px !important;
        z-index: 10002 !important;
    }
}

@media (max-width: 768px) and (max-height: 500px) {
    .ask-emad-quick {
        display: none;
    }
}
/* ===== END MOBILE CHAT VIEWPORT FIT FINAL ===== */
