/* Live Chat — reference-matched compact medical support UI */
.ilaj-chat--mrev,
.ilaj-chat--mrev * {
  box-sizing: border-box;
  min-width: 0;
}

.ilaj-chat--mrev {
  --ilaj-chat-brand: #0a5c54;
  --ilaj-chat-brand-mid: #0c6b62;
  --ilaj-chat-brand-deep: #064d46;
  --ilaj-mrev-line: #d7e4e2;
  --ilaj-mrev-soft: #f3f8f7;
}

/* Compact panel — site stays visible; fits mobile viewport */
.ilaj-chat--mrev .ilaj-chat__panel {
  left: auto;
  right: 12px;
  width: min(340px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  margin: 0;
  transform: none;
  height: auto;
  min-height: 320px;
  max-height: min(56dvh, 480px);
  bottom: calc(var(--mobile-action-bar-height, var(--mobile-bar-h, 64px)) + 12px + env(safe-area-inset-bottom, 0px));
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(6, 77, 70, 0.22), 0 4px 12px rgba(15, 39, 68, 0.08);
}

@media (max-width: 480px) {
  .ilaj-chat--mrev .ilaj-chat__panel {
    left: auto !important;
    right: 12px !important;
    width: min(340px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: min(54dvh, 460px);
    transform: none !important;
  }
}

@media (min-width: 768px) {
  .ilaj-chat--mrev .ilaj-chat__panel {
    width: 380px;
    max-width: 380px;
    right: 1.25rem !important;
    left: auto !important;
    bottom: 1.25rem;
    max-height: min(520px, calc(100vh - 3rem));
    border-radius: 20px;
  }
  html[dir="rtl"] .ilaj-chat--mrev .ilaj-chat__panel,
  .ilaj-chat--mrev .ilaj-chat__panel[dir="rtl"] {
    left: 1.25rem !important;
    right: auto !important;
  }
}

.ilaj-chat--mrev .ilaj-chat__header {
  background: #0a5c54;
  padding: 0.65rem 0.7rem;
  flex-shrink: 0;
}
.ilaj-chat--mrev .ilaj-chat__icon-btn.is-lang,
.ilaj-chat--mrev .ilaj-chat__icon-btn[data-ilaj-sound] {
  display: none;
}
.ilaj-chat--mrev .ilaj-chat__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  background: #4a90d9;
  object-fit: cover;
}
.ilaj-chat--mrev .ilaj-chat__title {
  font-size: 0.92rem;
  font-weight: 700;
}
.ilaj-chat--mrev .ilaj-chat__subtitle {
  font-size: 0.72rem;
}

.ilaj-chat--mrev .ilaj-chat__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.ilaj-chat--mrev .ilaj-chat__view[data-ilaj-view="chat"] {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  min-height: 0;
  flex: 1;
  position: relative;
}

.ilaj-chat--mrev .ilaj-chat__scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.7rem 0.75rem 0.35rem;
  background: #f5f7f8;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.ilaj-chat--mrev .ilaj-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 100%;
  /* Grow with content — only [data-ilaj-scroll] scrolls (no nested message scroller) */
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

.ilaj-chat--mrev .ilaj-chat__offline-banner {
  display: none !important;
}

.ilaj-chat--mrev .ilaj-chat__menu-btn {
  display: none !important;
}

.ilaj-chat--mrev .ilaj-chat__mrev-stage[hidden],
.ilaj-chat--mrev [data-ilaj-mrev-drawer][hidden],
.ilaj-chat--mrev [data-ilaj-mrev-done][hidden],
.ilaj-chat--mrev [data-ilaj-mrev-submitting][hidden],
.ilaj-chat--mrev [data-ilaj-mrev-accordion][hidden] {
  display: none !important;
}

.ilaj-chat--mrev .ilaj-chat__bubble {
  max-width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: 18px;
  background: var(--ilaj-chat-support-bubble, #dce8f6);
  color: #1a2b33;
  font-size: 0.88rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 10px rgba(40, 70, 110, 0.1);
}
.ilaj-chat--mrev .ilaj-chat__msg--visitor .ilaj-chat__bubble {
  background: var(--ilaj-chat-visitor-bubble, #d8f3dc);
  color: #163528;
  border-bottom-right-radius: 6px;
  box-shadow: 0 2px 10px rgba(13, 92, 82, 0.1);
}
.ilaj-chat--mrev .ilaj-chat__msg--admin .ilaj-chat__bubble,
.ilaj-chat--mrev .ilaj-chat__msg--bot .ilaj-chat__bubble,
.ilaj-chat--mrev .ilaj-chat__bubble.is-bot {
  background: var(--ilaj-chat-support-bubble, #dce8f6);
  border-bottom-left-radius: 6px;
}
.ilaj-chat--mrev .ilaj-chat__bubble p { margin: 0; }
.ilaj-chat--mrev .ilaj-chat__bubble--welcome p {
  white-space: pre-line;
}
.ilaj-chat--mrev .ilaj-chat__bubble-time {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.66rem;
  color: #7a8b93;
  text-align: end;
}
[dir="rtl"] .ilaj-chat--mrev .ilaj-chat__msg--bot .ilaj-chat__bubble,
[dir="rtl"] .ilaj-chat--mrev .ilaj-chat__bubble.is-bot {
  border-radius: 18px;
  border-bottom-right-radius: 6px;
}
[dir="rtl"] .ilaj-chat--mrev .ilaj-chat__msg--visitor .ilaj-chat__bubble {
  border-radius: 18px;
  border-bottom-left-radius: 6px;
}

/* Language: English solid, Arabic outline — side by side */
.ilaj-chat__lang-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.15rem 0 0.2rem;
}
.ilaj-chat__lang-pill {
  appearance: none;
  border: 1.5px solid #0a5c54;
  background: #fff;
  color: #0a5c54;
  border-radius: 12px;
  padding: 0.55rem 0.5rem;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.ilaj-chat__lang-pill.is-primary,
.ilaj-chat__lang-pill.is-active,
.ilaj-chat__lang-pill[aria-pressed="true"] {
  background: #0a5c54;
  color: #fff;
  border-color: #0a5c54;
}
.ilaj-chat__lang-pill.is-active::before,
.ilaj-chat__lang-pill[aria-pressed="true"]::before {
  content: none;
}

.ilaj-chat__mrev-actions[hidden],
.ilaj-chat__mrev-stage[hidden],
.ilaj-chat__mrev-accordion[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
}

.ilaj-chat__mrev-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #fff;
  border: 1px solid #e2eaf0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(15, 39, 68, 0.07);
}
.ilaj-chat__mrev-action {
  appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eef2f5;
  background: #fff;
  color: #0d5c52;
  border-radius: 0;
  padding: 0.78rem 0.9rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  text-align: start;
  cursor: pointer;
  transition: background 0.15s ease;
}
.ilaj-chat__mrev-action:last-child {
  border-bottom: 0;
}
.ilaj-chat__mrev-action:hover {
  background: #f6faf9;
}
.ilaj-chat__mrev-action.is-primary {
  background: #fff;
  border-color: #eef2f5;
  color: #0d5c52;
}

.ilaj-chat__mrev-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.15rem;
  padding: 0.35rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dce8e5;
  animation: ilaj-mrev-acc-in 0.2s ease;
}
.ilaj-chat__mrev-acc-item {
  appearance: none;
  width: 100%;
  border: 0;
  background: #f6faf9;
  color: #244048;
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.ilaj-chat__mrev-acc-item:hover { background: #e8f3f1; }
@keyframes ilaj-mrev-acc-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.ilaj-mrev-done {
  text-align: center;
  padding: 0.9rem 0.75rem;
  gap: 0.35rem;
  animation: ilaj-mrev-done-in 0.25s ease;
}
@keyframes ilaj-mrev-done-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.ilaj-mrev-done-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 0.2rem;
  border-radius: 50%;
  background: #0a5c54;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.ilaj-mrev-done strong { font-size: 0.9rem; color: #064d46; }
.ilaj-mrev-done p {
  margin: 0;
  font-size: 0.78rem;
  color: #3a5560;
  line-height: 1.45;
  white-space: pre-line;
}

/* Slide-up medical form drawer inside panel */
.ilaj-mrev-drawer {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  background: #fff;
  animation: ilaj-mrev-drawer-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}
@keyframes ilaj-mrev-drawer-up {
  from { transform: translateY(18%); opacity: 0.6; }
  to { transform: translateY(0); opacity: 1; }
}
.ilaj-mrev-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #e4eeec;
  flex-shrink: 0;
  background: #f7fbfa;
}
.ilaj-mrev-drawer-head strong {
  font-size: 0.84rem;
  color: #064d46;
}
.ilaj-mrev-drawer-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #e8f0ee;
  color: #244048;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}
.ilaj-mrev-card--drawer {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 0.7rem 0.75rem 1.25rem;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ilaj-mrev-card {
  background: #fff;
  border: 1px solid var(--ilaj-mrev-line);
  border-radius: 14px;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 100%;
}

.ilaj-mrev-row--2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem;
}
@media (min-width: 420px) {
  .ilaj-mrev-row--2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.ilaj-mrev-field { display: flex; flex-direction: column; gap: 0.28rem; max-width: 100%; }
.ilaj-mrev-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #244048;
}
.ilaj-mrev-label i { color: #c62828; font-style: normal; }

.ilaj-mrev-input,
.ilaj-mrev-phone {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #d5e2e0;
  border-radius: 10px;
  padding: 0.35rem 0.5rem;
  background: #fff;
  width: 100%;
  max-width: 100%;
}
.ilaj-mrev-input:focus-within,
.ilaj-mrev-phone:focus-within,
.ilaj-mrev-field textarea:focus {
  border-color: #0a5c54;
  outline: none;
  box-shadow: 0 0 0 2px rgba(10, 92, 84, 0.12);
}
.ilaj-mrev-ico { font-size: 0.8rem; opacity: .7; flex-shrink: 0; }
.ilaj-mrev-input input,
.ilaj-mrev-input select,
.ilaj-mrev-phone input {
  border: 0;
  outline: none;
  background: transparent;
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 0.8rem;
  color: #16353d;
}
.ilaj-mrev-field textarea {
  width: 100%;
  max-width: 100%;
  border: 1px solid #d5e2e0;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  font: inherit;
  font-size: 0.8rem;
  resize: vertical;
  min-height: 3.6rem;
}
.ilaj-mrev-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: #6b7c86;
  font-size: 0.64rem;
}
.ilaj-mrev-hint { margin: 0; color: #6b7c86; font-size: 0.68rem; line-height: 1.35; }
.ilaj-mrev-dial {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
  font-size: 0.76rem;
  font-weight: 650;
  color: #244048;
  padding-inline-end: 0.35rem;
  border-inline-end: 1px solid #e1ecea;
}
.ilaj-mrev-drop {
  border: 1.5px dashed #b9cdc9;
  border-radius: 12px;
  padding: 0.65rem;
  background: var(--ilaj-mrev-soft);
  text-align: center;
  cursor: pointer;
}
.ilaj-mrev-drop.is-drag { border-color: #0a5c54; background: #e7f3f1; }
.ilaj-mrev-cloud { font-size: 1.2rem; display: block; margin-bottom: 0.15rem; }
.ilaj-mrev-drop-inner p { margin: 0; font-size: 0.74rem; color: #3a5560; }
.ilaj-mrev-browse {
  appearance: none;
  border: 0;
  background: none;
  color: #0a5c54;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}
.ilaj-mrev-files {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.ilaj-mrev-file {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 26px;
  gap: 0.35rem;
  align-items: center;
  border: 1px solid #e1ecea;
  border-radius: 10px;
  padding: 0.3rem 0.35rem;
  background: #fafcfc;
}
.ilaj-mrev-file-thumb {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #e8f1ef;
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #0a5c54;
  overflow: hidden;
}
.ilaj-mrev-file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ilaj-mrev-file strong {
  display: block;
  font-size: 0.7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ilaj-mrev-file span { font-size: 0.62rem; color: #6b7c86; }
.ilaj-mrev-file button {
  border: 0;
  background: transparent;
  color: #6b7c86;
  font-size: 1.05rem;
  cursor: pointer;
}
.ilaj-mrev-consent {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  font-size: 0.7rem;
  line-height: 1.4;
  color: #244048;
}
.ilaj-mrev-consent input {
  margin-top: 0.12rem;
  flex-shrink: 0;
  accent-color: #0a5c54;
}
.ilaj-mrev-form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.15rem;
  padding-bottom: 0.25rem;
}
.ilaj-mrev-submit,
.ilaj-mrev-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border-radius: 12px;
  padding: 0.68rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
}
.ilaj-mrev-submit {
  background: #0a5c54;
  color: #fff;
  border-color: #0a5c54;
}
.ilaj-mrev-cancel {
  background: #fff;
  color: #0a5c54;
  border-color: #0a5c54;
}
.ilaj-mrev-submit:disabled { opacity: .6; cursor: wait; }

.ilaj-mrev-submitting .ilaj-mrev-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 0.5rem;
  text-align: center;
  color: #244048;
  font-size: 0.84rem;
}

.ilaj-chat--mrev .ilaj-chat__composer {
  flex-shrink: 0;
  border-top: 1px solid #e4eeec;
  background: #fff;
  padding: 0.4rem 0.55rem 0.3rem;
}
.ilaj-chat--mrev .ilaj-chat__composer-row {
  gap: 0.35rem;
}
.ilaj-chat--mrev .ilaj-chat__attach {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef2f4;
  color: #3a5560;
  border: 0;
}
.ilaj-chat--mrev .ilaj-chat__input {
  border-radius: 18px;
  background: #f4f7f8;
  border: 1px solid #e4eeec;
  max-width: 100%;
}
.ilaj-chat--mrev .ilaj-chat__send {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #0a5c54;
  flex-shrink: 0;
}
.ilaj-chat--mrev .ilaj-chat__powered {
  margin: 0.2rem 0 0;
  text-align: center;
  font-size: 0.62rem;
  color: #8a9aa2;
}
.ilaj-chat--mrev .ilaj-chat__powered::before {
  content: "✓ ";
  color: #0a5c54;
  font-weight: 700;
}

.ilaj-chat--mrev .ilaj-chat__chips[hidden],
.ilaj-chat--mrev .ilaj-chat__sheet[hidden] {
  display: none !important;
}

[dir="rtl"] .ilaj-mrev-dial {
  border-inline-end: 0;
  border-inline-start: 1px solid #e1ecea;
  padding-inline-end: 0;
  padding-inline-start: 0.35rem;
}

/* When form drawer open, hide composer under it */
.ilaj-chat--mrev .ilaj-chat__view.has-mrev-drawer .ilaj-chat__composer {
  visibility: hidden;
  pointer-events: none;
  height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
}

/* Compact post-submit quick replies — sit in scroll flow, never overlay */
.ilaj-chat__mrev-post-qr {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.15rem 0.1rem 0.55rem;
  max-width: 100%;
}
.ilaj-chat__mrev-post-qr[hidden] {
  display: none !important;
}
.ilaj-chat__mrev-qr {
  appearance: none;
  border: 1px solid #cfe0dd;
  background: #fff;
  color: #0a5c54;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.2;
}
.ilaj-chat__mrev-qr:hover {
  background: #f3f8f7;
  border-color: #0a5c54;
}
