/* =========================================
   MediScan — style.css
   Clean · Mobile-first · RTL/LTR support
========================================= */

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ---------- Variables ---------- */
:root {
  --blk:  #0D1117;
  --blk2: #161C26;
  --wht:  #FFFFFF;
  --bg:   #F4F6F9;
  --bg2:  #EAEDF2;
  --brd:  #DDE1E9;
  --brd2: #C4CAD8;

  --txt:  #14181F;
  --txt2: #424B5C;
  --txt3: #828FA5;

  --grn:     #059669;
  --grn-bg:  #ECFDF5;
  --grn-bd:  #6EE7B7;
  --grn-dk:  #064E3B;

  --blu:     #2563EB;
  --blu-bg:  #EFF6FF;
  --blu-bd:  #93C5FD;
  --blu-dk:  #1E3A8A;

  --amb:     #B45309;
  --amb-bg:  #FFFBEB;
  --amb-bd:  #FCD34D;
  --amb-dk:  #78350F;

  --red:     #DC2626;
  --red-bg:  #FEF2F2;
  --red-bd:  #FCA5A5;
  --red-dk:  #7F1D1D;

  --r8:  8px;
  --r12: 12px;
  --r16: 16px;
  --r20: 20px;
  --r24: 24px;
  --r32: 32px;

  --sh1: 0 1px 4px rgba(0,0,0,.07);
  --sh2: 0 4px 24px rgba(0,0,0,.1);
  --sh3: 0 20px 60px rgba(0,0,0,.18);

  --max: 560px;

  --f-ar: 'Tajawal', sans-serif;
  --f-en: 'DM Sans', sans-serif;
  --f-d:  'Syne', sans-serif;
}

/* ---------- Base ---------- */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--f-ar);
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  line-height: 1.65;
  overflow-x: hidden;
}

[lang="en"] body,
[lang="en"] .sbox-input,
[lang="en"] .btn-primary,
[lang="en"] .btn-outline,
[lang="en"] .card-title,
[lang="en"] .card-sub,
[lang="en"] .search-hint,
[lang="en"] .chip,
[lang="en"] .hero-h1,
[lang="en"] .hero-p,
[lang="en"] .modal-card h3,
[lang="en"] .modal-card p,
[lang="en"] #modal-btn,
[lang="en"] .loading-msg,
[lang="en"] .step span,
[lang="en"] .info-card p,
[lang="en"] .disc-box p,
[lang="en"] .footer {
  font-family: var(--f-en);
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input  { font-family: inherit; }
.hidden { display: none !important; }

/* =========================================
   PLUS / CROSS ICON
========================================= */
.plus-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.plus-icon::before,
.plus-icon::after {
  content: '';
  position: absolute;
  background: white;
  border-radius: 2px;
}

/* Large — lang screen logo */
.plus-lg { width: 80px; height: 80px; }
.plus-lg::before { width: 7px;  height: 36px; }
.plus-lg::after  { width: 36px; height: 7px;  }

/* Small — header & drug icon */
.plus-sm { width: 20px; height: 20px; }
.plus-sm::before { width: 3.5px; height: 15px; }
.plus-sm::after  { width: 15px;  height: 3.5px; }

/* =========================================
   LANGUAGE SCREEN
========================================= */
#lang-screen {
  position: fixed;
  inset: 0;
  background: var(--blk);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  overflow: hidden;
}

.ls-bg {
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 44px,
      rgba(255,255,255,.025) 44px,
      rgba(255,255,255,.025) 45px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 44px,
      rgba(255,255,255,.025) 44px,
      rgba(255,255,255,.025) 45px
    );
}

.ls-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 320px;
  padding: 0 24px;
}

.ls-logo {
  width: 90px;
  height: 90px;
  background: var(--grn);
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 26px;
  box-shadow:
    0 0 0 10px rgba(5,150,105,.14),
    0 0 0 22px rgba(5,150,105,.06);
}

.ls-title {
  font-family: var(--f-d);
  font-size: 52px;
  font-weight: 800;
  color: white;
  letter-spacing: -1.5px;
  margin-bottom: 8px;
}

.ls-sub {
  font-size: 13px;
  color: rgba(255,255,255,.35);
  margin-bottom: 44px;
}

.ls-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-bottom: 28px;
}

.ls-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 20px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r16);
  width: 100%;
  transition: all .22s;
}

.ls-btn:hover {
  background: rgba(5,150,105,.12);
  border-color: rgba(5,150,105,.35);
  transform: translateY(-2px);
}

.ls-btn-label {
  font-size: 20px;
  font-weight: 700;
  color: white;
  font-family: var(--f-ar);
  line-height: 1;
}

.ls-btn:last-child .ls-btn-label {
  font-family: var(--f-en);
}

.ls-btn-sub {
  font-size: 12px;
  color: rgba(255,255,255,.35);
}

.ls-note {
  font-size: 11px;
  color: rgba(255,255,255,.18);
}

/* =========================================
   WARNING BAR
========================================= */
.warn-bar {
  background: var(--amb-bg);
  border-bottom: 1.5px solid var(--amb-bd);
  padding: 10px 20px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--amb-dk);
  line-height: 1.65;
}

.warn-icon { flex-shrink: 0; font-size: 13px; margin-top: 1px; }
.warn-bar span:nth-child(2) { flex: 1; }
.warn-bar button { font-size: 15px; color: var(--amb); opacity: .45; padding: 0 2px; transition: opacity .18s; flex-shrink: 0; }
.warn-bar button:hover { opacity: 1; }

/* =========================================
   TOPBAR
========================================= */
.topbar {
  background: var(--blk);
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.topbar-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-mark {
  width: 34px;
  height: 34px;
  background: var(--grn);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.topbar-name {
  font-family: var(--f-d);
  font-size: 19px;
  font-weight: 800;
  color: white;
  letter-spacing: -.4px;
}

.topbar-lang {
  padding: 7px 18px;
  background: rgba(255,255,255,.08);
  border: .5px solid rgba(255,255,255,.13);
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255,255,255,.65);
  transition: all .2s;
  letter-spacing: .2px;
}

.topbar-lang:hover {
  background: rgba(255,255,255,.14);
  color: white;
}

/* =========================================
   HERO
========================================= */
.hero {
  background: var(--blk);
  padding: 36px 20px 50px;
}

.hero-wrap {
  max-width: var(--max);
  margin: 0 auto;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(5,150,105,.12);
  border: .5px solid rgba(5,150,105,.28);
  border-radius: 100px;
  padding: 5px 14px;
  margin-bottom: 18px;
}

.hero-tag-dot {
  width: 6px;
  height: 6px;
  background: #34D399;
  border-radius: 50%;
  flex-shrink: 0;
}

.hero-tag span:last-child {
  font-size: 11px;
  font-weight: 600;
  color: #34D399;
  letter-spacing: .2px;
}

.hero-h1 {
  font-family: var(--f-d);
  font-size: clamp(26px, 6vw, 38px);
  font-weight: 800;
  color: white;
  line-height: 1.2;
  letter-spacing: -.5px;
  margin-bottom: 12px;
}

.hero-p {
  font-size: 14px;
  color: rgba(255,255,255,.42);
  line-height: 1.8;
  max-width: 420px;
}

/* =========================================
   PAGE / CONTENT
========================================= */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 70px;
}

/* =========================================
   SEARCH CARD
========================================= */
.card {
  background: var(--wht);
  border: 1px solid var(--brd);
  border-radius: var(--r24);
  padding: 26px;
  box-shadow: var(--sh1);
}

.card-title {
  font-family: var(--f-d);
  font-size: 18px;
  font-weight: 800;
  color: var(--txt);
  margin-bottom: 4px;
}

[lang="en"] .card-title { font-family: var(--f-d); }

.card-sub {
  font-size: 12.5px;
  color: var(--txt3);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Search box */
.sbox {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 2px solid var(--brd2);
  border-radius: var(--r16);
  overflow: hidden;
  transition: border-color .22s, box-shadow .22s, background .22s;
  margin-bottom: 12px;
  height: 54px;
}

.sbox:focus-within {
  border-color: var(--blu);
  background: white;
  box-shadow: 0 0 0 4px rgba(37,99,235,.1);
}

.sbox-icon {
  width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--txt3);
  transition: color .22s;
}

.sbox:focus-within .sbox-icon { color: var(--blu); }

.sbox-input {
  flex: 1;
  height: 100%;
  padding: 0 6px;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--txt);
  min-width: 0;
}

.sbox-input::placeholder {
  color: var(--txt3);
  font-weight: 400;
  font-size: 14px;
}

.sbox-clear {
  width: 50px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--txt3);
  transition: color .18s;
  flex-shrink: 0;
}

.sbox-clear:hover { color: var(--red); }

/* Hint */
.search-hint {
  font-size: 12px;
  color: var(--txt3);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 20px;
}

.chip {
  padding: 5px 14px;
  background: var(--bg2);
  border: 1px solid var(--brd);
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--txt2);
  font-family: 'DM Sans', sans-serif;
  transition: all .18s;
}

.chip:hover {
  background: var(--blu-bg);
  border-color: var(--blu-bd);
  color: var(--blu);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 15px;
  background: var(--blk);
  border-radius: var(--r14);
  font-size: 15px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all .22s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--blk2);
  transform: translateY(-1px);
  box-shadow: var(--sh2);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--sh1);
}

.btn-primary:disabled {
  background: var(--bg2);
  color: var(--txt3);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* =========================================
   MODAL
========================================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 2;
  background: white;
  border-radius: var(--r32);
  padding: 40px 28px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--sh3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.modal-icon {
  width: 76px;
  height: 76px;
  background: var(--amb-bg);
  border: 1.5px solid var(--amb-bd);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-card h3 {
  font-family: var(--f-d);
  font-size: 21px;
  font-weight: 800;
  color: var(--txt);
  line-height: 1.2;
}

.modal-card p {
  font-size: 13.5px;
  color: var(--txt2);
  line-height: 1.85;
}

.modal-card button {
  width: 100%;
  padding: 15px;
  background: var(--blk);
  border-radius: var(--r14);
  font-size: 15px;
  font-weight: 700;
  color: white;
  margin-top: 4px;
  transition: background .2s;
}

.modal-card button:hover { background: var(--blk2); }

/* =========================================
   LOADING
========================================= */
.loading {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(244,246,249,.93);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.loading-card {
  background: white;
  border: 1px solid var(--brd);
  border-radius: var(--r24);
  padding: 40px 32px;
  max-width: 340px;
  width: 100%;
  box-shadow: var(--sh3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--bg2);
  border-top-color: var(--blk);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-msg {
  font-size: 15px;
  font-weight: 600;
  color: var(--txt2);
  text-align: center;
}

.steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--brd);
  border-radius: var(--r12);
  background: var(--bg);
  font-size: 12.5px;
  color: var(--txt3);
  transition: all .3s;
}

.step.active {
  border-color: var(--blk);
  background: white;
  color: var(--txt);
  font-weight: 600;
}

.step.done {
  border-color: var(--grn-bd);
  background: var(--grn-bg);
  color: var(--grn-dk);
}

.step-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brd2);
  flex-shrink: 0;
  transition: all .3s;
}

.step.active .step-dot { background: var(--blk); box-shadow: 0 0 0 3px rgba(13,17,23,.12); }
.step.done  .step-dot  { background: var(--grn); }

/* =========================================
   RESULTS
========================================= */
#results {
  animation: fadeUp .38s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Drug hero card */
.drug-hero {
  background: var(--blk);
  border-radius: var(--r24);
  padding: 22px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.drug-hero-icon {
  width: 58px;
  height: 58px;
  background: var(--grn);
  border-radius: var(--r16);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.drug-hero-text h3 {
  font-family: var(--f-d);
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  color: white;
  line-height: 1.18;
  margin-bottom: 4px;
}

.drug-hero-text p {
  font-size: 12px;
  color: #34D399;
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 9px;
}

.drug-src {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(5,150,105,.13);
  border: .5px solid rgba(5,150,105,.25);
  border-radius: 100px;
  padding: 3px 10px;
}

.drug-src-dot {
  width: 5px;
  height: 5px;
  background: #34D399;
  border-radius: 50%;
  flex-shrink: 0;
}

.drug-src span:last-child {
  font-size: 10.5px;
  color: #34D399;
  font-weight: 600;
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.info-card {
  border-radius: var(--r20);
  padding: 16px;
  border: 1.5px solid transparent;
}

.info-card.green { background: var(--grn-bg); border-color: var(--grn-bd); }
.info-card.blue  { background: var(--blu-bg); border-color: var(--blu-bd); }
.info-card.amber { background: var(--amb-bg); border-color: var(--amb-bd); }
.info-card.red   { background: var(--red-bg); border-color: var(--red-bd); }

.info-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.idot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.green-dot { background: var(--grn); }
.blue-dot  { background: var(--blu); }
.amber-dot { background: var(--amb); }
.red-dot   { background: var(--red); }

.info-head span:last-child {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .9px;
}

.info-card.green .info-head span:last-child { color: var(--grn-dk); }
.info-card.blue  .info-head span:last-child { color: var(--blu-dk); }
.info-card.amber .info-head span:last-child { color: var(--amb-dk); }
.info-card.red   .info-head span:last-child { color: var(--red-dk); }

.info-card p {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--txt);
}

/* Disclaimer */
.disc-box {
  background: var(--amb-bg);
  border: 1.5px solid var(--amb-bd);
  border-radius: var(--r14);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 14px;
}

.disc-line {
  width: 3px;
  align-self: stretch;
  background: var(--amb);
  border-radius: 3px;
  flex-shrink: 0;
}

.disc-box p {
  font-size: 12px;
  color: var(--amb-dk);
  line-height: 1.75;
}

/* Outline Button */
.btn-outline {
  width: 100%;
  padding: 15px;
  background: transparent;
  border: 2px solid var(--brd2);
  border-radius: var(--r16);
  font-size: 14px;
  font-weight: 600;
  color: var(--txt);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: all .22s;
}

.btn-outline:hover {
  border-color: var(--blk);
  background: white;
  box-shadow: var(--sh1);
}

/* =========================================
   FOOTER
========================================= */
.footer {
  border-top: 1px solid var(--brd);
  padding: 22px 20px;
  text-align: center;
  font-size: 11.5px;
  color: var(--txt3);
}

/* =========================================
   RESPONSIVE
========================================= */
@media (max-width: 380px) {
  .ls-title   { font-size: 44px; }
  .hero-h1    { font-size: 24px; }
  .info-grid  { grid-template-columns: 1fr; }
  .card       { padding: 18px; }
  .modal-card { padding: 30px 20px; }
}

@media (min-width: 640px) {
  :root { --max: 580px; }
  .hero       { padding: 48px 24px 60px; }
  .page       { padding: 32px 24px 80px; }
  .card       { padding: 30px; }
  .info-grid  { gap: 12px; }
  .info-card  { padding: 18px; }
  .modal-card { padding: 48px 36px; }
}

@media (min-width: 1024px) {
  :root { --max: 620px; }
  .hero-h1 { font-size: 40px; }
}

/* Entrance animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

#app:not(.hidden) .hero-tag  { animation: fadeIn .4s ease both; }
#app:not(.hidden) .hero-h1   { animation: fadeIn .4s .06s ease both; }
#app:not(.hidden) .hero-p    { animation: fadeIn .4s .12s ease both; }
#app:not(.hidden) .card      { animation: fadeIn .4s .18s ease both; }
