@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&display=swap');

/* ── Root ────────────────────────────────────────────────────────── */
.imd-root {
  --p: #1AAFC8;
  --s: #F5851F;
  --bg: #f7f9fc;
  --card: #ffffff;
  --border: #e4eaf0;
  --text: #1a2333;
  --muted: #7a8fa8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 40px rgba(26,175,200,.12);

  font-family: 'Heebo', Arial, sans-serif;
  direction: rtl;
  background: var(--card);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  max-width: 700px;
  margin: 0 auto;
  border: 1px solid var(--border);
}

/* ── Header ──────────────────────────────────────────────────────── */
.imd-header {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  background: linear-gradient(135deg, #f0fbfd 0%, #fff8f2 100%);
  border-bottom: 2px solid var(--border);
  position: relative;
}
.imd-header::after {
  content: '';
  position: absolute;
  bottom: -2px; right: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--p), var(--s));
}
.imd-avatar-wrap { position: relative; flex-shrink: 0; }
.imd-avatar {
  width: 62px; height: 62px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--p);
  box-shadow: 0 0 0 4px rgba(26,175,200,.12);
}
.imd-badge {
  position: absolute;
  bottom: 2px; left: 0;
  background: #edfaf3;
  color: #1a9952;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
  border: 1px solid #b6e8cc;
}
.imd-header-text { flex: 1; }
.imd-title {
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 4px;
}
.imd-sub {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
  line-height: 1.5;
}

/* ── Progress ────────────────────────────────────────────────────── */
.imd-progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.imd-progress-bar {
  flex: 1;
  height: 5px;
  background: #dde8ee;
  border-radius: 99px;
  overflow: hidden;
}
.imd-progress-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, var(--p), var(--s));
  border-radius: 99px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.imd-step-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 110px;
  text-align: left;
}

/* ── Chat Box ────────────────────────────────────────────────────── */
.imd-chat-box {
  padding: 22px 24px 0;
  min-height: 320px;
  max-height: 460px;
  overflow-y: auto;
  scroll-behavior: smooth;
  background: var(--card);
  scrollbar-width: thin;
  scrollbar-color: #dde8ee transparent;
}
.imd-chat-box::-webkit-scrollbar { width: 4px; }
.imd-chat-box::-webkit-scrollbar-thumb { background: #dde8ee; border-radius: 99px; }

/* ── Rows ────────────────────────────────────────────────────────── */
.imd-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 14px;
  animation: imdIn .3s ease both;
}
.imd-row-bot  { justify-content: flex-start; flex-direction: row-reverse; }
.imd-row-user { justify-content: flex-start; }
@keyframes imdIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.imd-mini-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(26,175,200,.3);
}

/* ── Bubbles ─────────────────────────────────────────────────────── */
.imd-bubble {
  max-width: 76%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.65;
}
.imd-bubble-bot {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-top-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(26,175,200,.06);
}
.imd-bubble-user {
  background: linear-gradient(135deg, var(--p), #0d8fa8);
  color: #fff;
  border-bottom-right-radius: 4px;
  font-weight: 500;
  box-shadow: 0 4px 14px rgba(26,175,200,.25);
}
.imd-bubble a { color: var(--s); }

/* ── Typing ──────────────────────────────────────────────────────── */
.imd-typing-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-direction: row-reverse;
  margin-bottom: 14px;
}
.imd-typing-dots {
  display: flex; gap: 5px;
  padding: 14px 18px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  border-top-right-radius: 4px;
}
.imd-typing-dots span {
  width: 7px; height: 7px;
  background: var(--p);
  border-radius: 50%;
  animation: imdDot 1.3s ease-in-out infinite;
  opacity: .35;
}
.imd-typing-dots span:nth-child(2) { animation-delay: .18s; }
.imd-typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes imdDot {
  0%,60%,100% { opacity:.25; transform:translateY(0); }
  30%          { opacity:1;   transform:translateY(-4px); }
}

/* ── Input ───────────────────────────────────────────────────────── */
.imd-input-wrap {
  display: flex;
  gap: 10px;
  padding: 16px 24px 22px;
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
.imd-input {
  flex: 1;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Heebo', Arial, sans-serif;
  font-size: 15px;
  padding: 12px 16px;
  outline: none;
  direction: rtl;
  transition: border-color .2s, box-shadow .2s;
}
.imd-input::placeholder { color: #b0bfcc; }
.imd-input:focus {
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgba(26,175,200,.1);
  background: #fff;
}
.imd-btn {
  background: linear-gradient(135deg, var(--s), #d96b10);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 0 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .2s, transform .1s;
  box-shadow: 0 4px 14px rgba(245,133,31,.3);
  flex-shrink: 0;
}
.imd-btn:hover  { opacity: .9; }
.imd-btn:active { transform: scale(.95); }
.imd-btn svg { transform: scaleX(-1); }

/* ── Analysis Card ───────────────────────────────────────────────── */
.imd-analysis {
  margin: 4px 0 14px;
  background: linear-gradient(135deg, #f0fbfd, #fff9f5);
  border: 1.5px solid rgba(26,175,200,.2);
  border-right: 4px solid var(--p);
  border-radius: var(--radius);
  padding: 20px 22px;
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.85;
  animation: imdIn .4s ease;
  white-space: pre-wrap;
}
.imd-analysis-label {
  display: inline-block;
  background: linear-gradient(90deg, var(--p), var(--s));
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 99px;
  margin-bottom: 14px;
  letter-spacing: .5px;
}

/* ── Done ────────────────────────────────────────────────────────── */
.imd-done { padding: 20px 24px 28px; text-align: center; }
.imd-done-inner {
  background: linear-gradient(135deg, #f0fbfd, #fff9f5);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 24px;
}
.imd-check {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--p), #0d8fa8);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
  margin: 0 auto 14px;
  box-shadow: 0 6px 20px rgba(26,175,200,.3);
}
.imd-done-text { color: var(--muted); font-size: 15px; margin: 0 0 20px; }
.imd-cta-link {
  display: inline-block;
  background: linear-gradient(135deg, var(--s), #d96b10);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: opacity .2s;
  box-shadow: 0 4px 16px rgba(245,133,31,.3);
}
.imd-cta-link:hover { opacity: .88; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media(max-width: 480px) {
  .imd-header     { padding: 18px; gap: 14px; }
  .imd-title      { font-size: 17px; }
  .imd-chat-box   { padding: 16px 14px 0; }
  .imd-input-wrap { padding: 12px 14px 18px; }
  .imd-bubble     { font-size: 14px; }
  .imd-progress-wrap { padding: 10px 18px; }
}
