/* ===== base ===== */
:root {
  --navy: #0E4E6B;
  --cyan: #2E9BD6;
  --cyan-soft: #E7F3FB;
  --ink: #13343F;
  --line: #E7EDF1;
  --page-bg: #EDF2F5;
  --tamin: #15527C;
  --tamin-bg: #EAF2FB;
  --tamin-border: #C6DEF3;
  --salamat: #1C7A4F;
  --salamat-bg: #EAF5EE;
  --salamat-border: #C6E6D2;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: Vazirmatn, Tahoma, sans-serif;
  color: var(--ink);
  background: var(--page-bg);
  min-height: 100vh;
}

::selection { background: #FDE68A; }
input::placeholder { color: #9DB0BA; }

@keyframes opfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes blinkdot { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

mark { background: #FDE68A; color: inherit; border-radius: 3px; }

/* ===== update banner ===== */
.update-banner {
  position: sticky; top: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 10px 16px;
  background: #FEF3C7; color: #92400E;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 4px 14px -8px rgba(0,0,0,.3);
}
.update-banner button {
  padding: 6px 16px; border-radius: 999px; border: none;
  background: var(--navy); color: #fff;
  font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer;
}

/* ===== hero ===== */
.hero {
  position: relative;
  background: var(--navy);
  overflow: hidden;
  padding: 52px 28px 92px;
  animation: opfade .4s ease both;
}
.hero-ring { position: absolute; border-radius: 50%; }
.hero-ring-1 { left: -120px; top: -90px; width: 420px; height: 420px; border: 60px solid rgba(46,155,214,.10); }
.hero-ring-2 { left: -40px; top: 10px; width: 300px; height: 300px; border: 38px solid rgba(46,155,214,.08); }
.hero-inner { position: relative; max-width: 1160px; margin: 0 auto; text-align: center; }
.hero h1 { margin: 0; font-size: 32px; font-weight: 800; color: #fff; }

/* ===== main ===== */
.main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 28px;
  position: relative;
  z-index: 5;
}

/* ===== toolbar / search ===== */
.toolbar {
  display: flex; flex-direction: column; align-items: center;
  margin: -18px 0 28px;
  position: relative; z-index: 10;
}
.search-wrap { position: relative; width: 100%; max-width: 640px; }
.search-bar {
  display: flex; align-items: center;
  background: #fff;
  border: 1px solid #E2EAEF;
  border-radius: 14px;
  box-shadow: 0 22px 50px -24px rgba(10,58,80,.55);
}
.filter-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 13px 16px;
  border: none; border-left: 1px solid var(--line);
  border-radius: 0 13px 13px 0;
  background: transparent;
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  color: var(--navy); cursor: pointer; white-space: nowrap;
}
.filter-btn .caret { opacity: .4; font-size: 10px; margin-right: 2px; }
#searchInput {
  flex: 1; min-width: 0;
  padding: 13px 10px;
  border: none; outline: none; background: transparent;
  font-family: inherit; font-size: 14px; color: var(--ink);
  text-align: right;
}
#searchInput::-webkit-search-cancel-button { display: none; }
.search-icon {
  display: flex; align-items: center;
  padding: 0 15px; color: #C5D2DA; font-size: 18px; flex: none;
}
.clear-btn {
  display: flex; align-items: center; justify-content: center;
  margin: 0 12px; width: 22px; height: 22px; flex: none;
  border-radius: 50%; border: none;
  background: #E5ECF0; color: #6B8290;
  font-size: 15px; line-height: 1; cursor: pointer;
  transition: background .15s, color .15s;
}
.clear-btn:hover { background: #CDD8DF; color: #1E3D4C; }

/* dropdowns */
.dropdown-anchor { position: relative; }
.dropdown {
  position: absolute; top: 8px; right: 0; z-index: 30;
  background: #fff;
  border: 1px solid #E3EBF0; border-radius: 14px;
  box-shadow: 0 20px 44px -18px rgba(10,58,80,.42);
  padding: 16px; min-width: 260px;
  animation: opfade .18s ease both;
}
.dropdown-title {
  font-size: 11px; color: #B0C0C9;
  padding: 0 2px 11px; font-weight: 600; letter-spacing: .04em;
}
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  display: inline-flex; align-items: center;
  padding: 6px 15px; border-radius: 999px;
  border: 1px solid #E0E8ED; background: #F7FAFB; color: #6B8290;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.chip.on {
  border-color: var(--navy); background: var(--navy); color: #fff;
  font-weight: 600;
}

/* ===== controls row ===== */
.controls {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 4px 16px;
}
.sort-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sort-label { font-size: 12.5px; color: #8497A1; margin-left: 4px; }
.sort-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid #D8E3E9; background: #fff; color: #5E7682;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.sort-chip.on {
  border-color: var(--navy); background: var(--navy); color: #fff; font-weight: 700;
}
.sort-chip .arrow { font-size: 11px; }
.meta-row { display: flex; align-items: center; gap: 8px; }
.updated-at {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #8497A1; white-space: nowrap;
}
.blink-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cyan);
  animation: blinkdot 1.4s ease-in-out infinite;
}
.per-page {
  background: #fff; border: 1px solid #DBE5EB; border-radius: 8px;
  padding: 5px 8px;
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--navy); cursor: pointer; outline: none;
}

/* ===== card list ===== */
.card-list { display: flex; flex-direction: column; gap: 11px; }

.card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.7);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px -14px rgba(10,58,80,.4);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  direction: ltr;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -16px rgba(10,58,80,.45);
  border-color: var(--cyan);
}
.card-info { flex: 1; min-width: 0; }
.card-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-name {
  font-size: 16px; font-weight: 700; color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dose-chip {
  display: inline-flex; align-items: center; flex: none;
  padding: 2px 9px; border-radius: 7px;
  background: var(--cyan-soft); color: var(--navy);
  font-size: 11.5px; font-weight: 600;
}
.generic-name {
  font-size: 13px; color: #5E7682; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.card-codes { display: flex; align-items: stretch; gap: 10px; flex: none; }

.code-box {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 7px 14px; border-radius: 12px;
  min-width: 120px;
  font-family: inherit;
  cursor: pointer;
  transition: filter .15s ease;
  border: 1px solid;
}
.code-box:hover { filter: brightness(.96); }
.code-box .code-label { font-size: 10.5px; font-weight: 600; }
.code-box .code-val {
  display: flex; align-items: center; gap: 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 15px; font-weight: 700; letter-spacing: .3px;
}
.code-box .copy-mark { opacity: .45; font-size: 12px; }
.code-box .copied-mark { color: #1F9D6B; font-size: 11px; font-weight: 700; }

.code-tamin { background: var(--tamin-bg); border-color: var(--tamin-border); }
.code-tamin .code-label { color: #6088AB; }
.code-tamin .code-val { color: var(--tamin); }

.code-salamat { background: var(--salamat-bg); border-color: var(--salamat-border); }
.code-salamat .code-label { color: #5C9377; }
.code-salamat .code-val { color: var(--salamat); }

.code-empty {
  border: 1px dashed #DCE6EC; background: transparent; cursor: default;
}
.code-empty:hover { filter: none; }
.code-empty .code-label { color: #A8B8C0; }
.code-empty .code-val { color: #BCC8CF; font-family: inherit; }

/* ===== empty state ===== */
.empty-state {
  padding: 54px 20px; text-align: center; color: #8497A1;
  background: rgba(255,255,255,.6);
  border-radius: 16px; border: 1px solid rgba(255,255,255,.7);
  font-size: 14.5px;
}
.empty-icon { font-size: 30px; opacity: .5; margin-bottom: 8px; }

/* ===== pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 6px; margin: 24px 0 48px;
}
.nav-btn, .page-btn {
  padding: 8px 14px; border-radius: 9px;
  border: 1px solid #DBE5EB; background: #fff; color: var(--navy);
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.page-btn { min-width: 36px; padding: 8px 12px; }
.page-btn.on {
  border-color: var(--navy); background: var(--navy); color: #fff; font-weight: 700;
}
.page-gap { color: #8497A1; padding: 0 2px; }

/* ===== help ===== */
.help-fab {
  position: fixed; bottom: 26px; left: 26px; z-index: 70;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 18px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.45);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 34px -14px rgba(10,58,80,.4);
  color: var(--navy);
  font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.help-fab:hover { background: rgba(255,255,255,.7); }
.help-fab-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 13px;
}

.help-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(10,40,56,.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: opfade .25s ease both;
}
.help-modal {
  position: relative; width: 100%; max-width: 540px; max-height: 84vh;
  overflow-y: auto;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(26px) saturate(150%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  box-shadow: 0 40px 90px -30px rgba(8,40,56,.6);
  padding: 30px 30px 26px;
}
.help-close {
  position: absolute; top: 18px; left: 18px;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(10,58,80,.12);
  background: rgba(255,255,255,.6); color: var(--navy);
  font-size: 17px; cursor: pointer; line-height: 1;
}
.help-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.help-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--navy); color: #fff; font-size: 20px; font-weight: 800;
}
.help-title { font-size: 18px; font-weight: 800; color: var(--navy); }
.help-sub { font-size: 12.5px; color: #6E8794; margin-top: 2px; }
.help-steps { display: flex; flex-direction: column; gap: 14px; }
.help-step { display: flex; gap: 12px; align-items: flex-start; }
.help-num {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--cyan-soft); color: var(--navy);
  font-size: 13px; font-weight: 800; margin-top: 1px;
}
.help-step b { font-weight: 700; color: var(--navy); font-size: 14px; }
.help-step p { margin: 2px 0 0; font-size: 13.5px; line-height: 1.9; color: #4D6772; }
.c-tamin { color: var(--tamin); }
.c-salamat { color: var(--salamat); }
.help-foot {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid rgba(10,58,80,.1);
  font-size: 12px; color: #8497A1; text-align: center;
}

/* ===== mobile ===== */
@media (max-width: 640px) {
  .hero { padding: 40px 20px 80px; }
  .hero h1 { font-size: 22px; }
  .main { padding: 0 14px; }

  .card { flex-direction: column; align-items: stretch; gap: 10px; padding: 14px 16px; }
  .card-codes { width: 100%; }
  .code-box { flex: 1; min-width: 0; }

  .controls { flex-direction: column; align-items: stretch; }
  .meta-row { justify-content: space-between; }

  .help-fab { bottom: 18px; left: 18px; padding: 10px 15px; font-size: 13px; }
}
