/* =========================================================
   داروخانه امیرمهدی طالب — سیستم طراحی پایه
   پالت: سبز کاجی + کرم گرم + مرجانی برای دکمه‌های اصلی
   ========================================================= */
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("../fonts/Vazirmatn-ExtraBold.woff2") format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --pine-950: #042f2e;
  --pine-900: #064e3b;
  --pine-800: #047857;
  --pine-700: #059669;
  --pine-600: #0d9488;
  --pine-500: #10b981;
  --pine-200: #a7f3d0;
  --pine-100: #d1fae5;
  --pine-50: #ecfdf5;
  --cream: #f6faf9;
  --cream-2: #eaf5f1;
  --paper: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-2: #eef2f6;
  --coral: #ff5a4e;
  --coral-600: #e8453a;
  --coral-100: #ffe7e4;
  --amber: #d97706;
  --amber-100: #fef3c7;
  --red: #dc2626;
  --red-100: #fee2e2;
  --blue: #2563eb;
  --blue-100: #dbeafe;
  --purple: #7c3aed;
  --purple-100: #ede9fe;
  --green: #059669;
  --green-100: #d1fae5;
  --gray-100: #f1f5f9;

  --tint-mint: #d1fae5;
  --tint-peach: #ffedd5;
  --tint-sky: #cffafe;
  --tint-sand: #fef3c7;
  --tint-lilac: #ede9fe;
  --tint-rose: #ffe4e6;

  --sun: #ffb020;
  --sky: #06b6d4;
  --grape: #8b5cf6;
  --grad-main: linear-gradient(135deg, #059669 0%, #0891b2 100%);
  --grad-fresh: linear-gradient(135deg, #34d399 0%, #22d3ee 100%);
  --grad-warm: linear-gradient(135deg, #ff7a45 0%, #ff4d6d 100%);
  --grad-sun: linear-gradient(135deg, #ffd166 0%, #ff9f1c 100%);
  --grad-grape: linear-gradient(135deg, #a78bfa 0%, #ec4899 100%);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(17, 35, 30, .06);
  --shadow: 0 2px 4px rgba(17, 35, 30, .04), 0 8px 24px rgba(17, 35, 30, .07);
  --shadow-lg: 0 20px 48px rgba(17, 35, 30, .16);
  --font: "Vazirmatn", Tahoma, sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.8; color: var(--ink);
  background: var(--cream); direction: rtl; text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased; font-feature-settings: "ss01";
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.45; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: embed; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
[x-cloak] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ic { flex-shrink: 0; }
.cur { font-size: .72em; font-weight: 500; color: var(--muted); margin-inline-start: 2px; }

/* ---------- دکمه‌ها */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  background: var(--pine-700); color: #fff; padding: 10px 18px; border-radius: 11px; font-weight: 700; font-size: 14px;
  cursor: pointer; transition: background .15s, transform .15s var(--ease), box-shadow .15s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--pine-800); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-coral { background: var(--coral); }
.btn-coral:hover { background: var(--coral-600); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--paper); border-color: var(--pine-200); color: var(--pine-700); }
.btn-soft { background: var(--pine-100); color: var(--pine-700); }
.btn-soft:hover { background: var(--pine-200); }
.btn-danger { background: var(--red-100); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 26px; font-size: 16px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 38px; height: 38px; }
.link { color: var(--pine-600); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- فرم */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.field .errors { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
input[type=text], input[type=number], input[type=email], input[type=tel], input[type=password], input[type=search],
input[type=url], input[type=date], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 13px;
  font-size: 14.5px; transition: border-color .15s, box-shadow .15s; outline: none; min-height: 44px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.9; }
input:focus, select:focus, textarea:focus { border-color: var(--pine-500); box-shadow: 0 0 0 3px rgba(31, 138, 115, .14); }
input[type=checkbox], input[type=radio] { accent-color: var(--pine-600); width: 17px; height: 17px; vertical-align: middle; }
input[type=file] { font-size: 13px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7772' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }
select[multiple] { background-image: none; padding-left: 13px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; font-weight: 500; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 16px; }
.check-list label { font-weight: 500 !important; display: flex !important; gap: 8px; align-items: center; color: var(--ink) !important; }
.check-list ul { list-style: none; padding: 0; margin: 0; display: contents; }
.input-group { display: flex; gap: 8px; }
.input-group > input { flex: 1; }

/* ---------- برچسب وضعیت */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--gray-100); color: var(--ink-2); white-space: nowrap; line-height: 1.9; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.no-dot::before { display: none; }
.pill.green { background: var(--green-100); color: var(--green); }
.pill.blue { background: var(--blue-100); color: var(--blue); }
.pill.teal { background: var(--pine-100); color: var(--pine-600); }
.pill.amber { background: var(--amber-100); color: var(--amber); }
.pill.red { background: var(--red-100); color: var(--red); }
.pill.purple { background: var(--purple-100); color: var(--purple); }
.pill.gray { background: var(--gray-100); color: var(--muted); }
.pill.coral { background: var(--coral-100); color: var(--coral-600); }

/* ---------- کارت */
.card { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; }
.card-body { padding: 20px; }

/* ---------- پیام‌ها */
.toasts { position: fixed; inset-inline: 0; top: 16px; z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; max-width: 520px; animation: toast-in .35s var(--ease); }
.toast.success { background: var(--pine-800); }
.toast.error { background: var(--red); }
.toast.warning { background: #8a5a00; }
.toast.info { background: #24435f; }
.toast button { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0; display: flex; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--pine-50); border: 1px solid var(--pine-100); color: var(--pine-900); font-size: 14px; }
.alert.warn { background: var(--amber-100); border-color: #f1dfb3; color: #6d4a06; }
.alert.danger { background: var(--red-100); border-color: #f2c9c1; color: #7c2416; }
.alert.info { background: var(--blue-100); border-color: #cddff3; color: #1d4672; }
.alert .ic { margin-top: 3px; }

/* ---------- جدول */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: right; font-size: 12px; font-weight: 700; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--cream); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--pine-50); }
.table .thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 9px; background: var(--cream-2); }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- صفحه‌بندی */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 28px 0 8px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; font-size: 14px; padding: 0 10px; }
.pagination .current { background: var(--pine-700); color: #fff; border-color: var(--pine-700); }
.pagination a:hover { border-color: var(--pine-500); color: var(--pine-700); }

/* ---------- ابزار */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 36px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.fw-b { font-weight: 700; }
.green-t { color: var(--green); } .red-t { color: var(--red); } .coral-t { color: var(--coral-600); } .pine-t { color: var(--pine-600); }
.divider { height: 1px; background: var(--line-2); margin: 16px 0; border: 0; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ic { color: var(--pine-200); margin: 0 auto 12px; }
.progress { height: 10px; background: var(--pine-100); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--pine-600); border-radius: 99px; transition: width .6s var(--ease); }
.progress.coral > span { background: var(--coral); }
.stars { display: inline-flex; gap: 1px; color: #d9d2c3; vertical-align: middle; }
.stars .on { color: #e6a417; }
.stars .on svg { fill: currentColor; }
kbd { font-family: var(--font); background: var(--cream-2); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; font-size: 12px; }

@media (max-width: 900px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .card-pad, .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }
}

/* چت مشاوره */
.chat-card { display: flex; flex-direction: column; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.chat-list { height: min(58vh, 520px); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: var(--pine-50); }
.chat-msg { max-width: 78%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.chat-msg.me { align-self: flex-start; background: var(--pine); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.them { align-self: flex-end; background: var(--paper); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.chat-msg small { display: block; font-size: 10.5px; opacity: .7; margin-top: 2px; }
.chat-msg img { display: block; max-width: 220px; max-height: 240px; border-radius: 10px; margin-bottom: 4px; }
.chat-empty { margin: auto; text-align: center; color: var(--muted); font-size: 13.5px; padding: 24px; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding: 12px; border-top: 1px solid var(--line-2); }
.chat-form textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; }
.chat-attach { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); cursor: pointer; color: var(--pine); flex-shrink: 0; }
.chat-note, .chat-error { padding: 6px 14px; font-size: 12.5px; }
.chat-error { color: #b3261e; }
.chat-canned { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 0 12px 12px; }
.chat-panel { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.chat-convs { max-height: 76vh; overflow-y: auto; padding: 6px; }
.chat-conv { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; }
.chat-conv:hover, .chat-conv.on { background: var(--pine-50); }
.chat-conv b { display: block; font-size: 13.5px; }
.chat-conv small { color: var(--muted); font-size: 11.5px; }
.chat-conv .cnt { background: var(--coral); color: #fff; border-radius: 999px; min-width: 22px; text-align: center; font-size: 12px; padding: 1px 6px; }
@media (max-width: 800px) { .chat-panel { grid-template-columns: 1fr; } .chat-convs { max-height: 220px; } .chat-msg { max-width: 90%; } }
