/* ============================================================
   انجمن داروسازان — تم مدرن RTL (کاملاً لوکال)
   ============================================================ */

@font-face {
  font-family: 'IRANSans';
  src: url('fonts/IRANSansWeb.woff2') format('woff2'),
       url('fonts/IRANSansWeb.woff') format('woff');
  font-weight: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSans';
  src: url('fonts/IRANSansWeb_Bold.woff2') format('woff2'),
       url('fonts/IRANSansWeb_Bold.woff') format('woff');
  font-weight: bold;
  font-display: swap;
}
@font-face {
  font-family: 'IRANSans';
  src: url('fonts/IRANSansWeb_Light.woff2') format('woff2'),
       url('fonts/IRANSansWeb_Light.woff') format('woff');
  font-weight: 300;
  font-display: swap;
}

:root {
  --primary: #0e9f6e;
  --primary-dark: #057a55;
  --primary-light: #def7ec;
  --secondary: #1c64f2;
  --danger: #e02424;
  --danger-light: #fde8e8;
  --warning: #c27803;
  --warning-light: #fdf6b2;
  --success: #0e9f6e;
  --info: #1c64f2;
  --info-light: #e1effe;
  --dark: #1f2a37;
  --muted: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --sidebar-bg: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-text: #d1d5db;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.10);
  --sidebar-width: 270px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'IRANSans', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--dark);
  direction: rtl;
  font-size: 14px;
  line-height: 1.8;
}

a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }

/* ---------- چیدمان اصلی ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  overflow-y: auto;
  z-index: 1000;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid #1f2937;
}
.sidebar-brand img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background:#fff; }
.sidebar-brand .t { font-weight: bold; color: #fff; font-size: 15px; line-height: 1.5; }
.sidebar-brand .s { font-size: 11px; color: #9ca3af; }

.menu { list-style: none; margin: 0; padding: 10px 0 40px; }
.menu .group-title {
  padding: 16px 20px 6px;
  font-size: 11px; color: #6b7280; font-weight: bold;
  letter-spacing: .04em;
}
.menu a {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 20px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  transition: all .15s;
  border-inline-start: 3px solid transparent;
}
.menu a .ic { width: 20px; text-align: center; opacity: .85; font-size: 15px; }
.menu a:hover { background: var(--sidebar-hover); color: #fff; }
.menu a.active {
  background: var(--sidebar-hover);
  color: #fff;
  border-inline-start-color: var(--primary);
}
.menu .has-sub > .sub { display: none; list-style: none; margin: 0; padding: 0; background: #0b101b; }
.menu .has-sub.open > .sub { display: block; }
.menu .sub a { padding-inline-start: 50px; font-size: 13px; }
.menu .caret { margin-inline-start: auto; transition: transform .2s; font-size: 11px; }
.menu .has-sub.open > a .caret { transform: rotate(90deg); }

/* ---------- محتوای اصلی ---------- */
.main {
  flex: 1;
  margin-inline-start: var(--sidebar-width);
  display: flex; flex-direction: column;
  min-width: 0;
}
.topbar {
  background: var(--card);
  height: 64px;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 500;
}
.topbar .page-title { font-weight: bold; font-size: 16px; }
.topbar .spacer { flex: 1; }
.menu-toggle { display: none; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--dark); }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; border-radius: 999px;
  cursor: pointer; position: relative;
}
.user-chip:hover { background: var(--bg); }
.user-chip img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.user-chip .nm { font-size: 13px; font-weight: bold; }
.user-chip .rl { font-size: 11px; color: var(--muted); }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; inset-inline-start: 0; top: calc(100% + 8px);
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow-lg); min-width: 200px; padding: 8px; display: none; z-index: 600;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu a, .dropdown-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border-radius: 8px; font-size: 13px;
  background: none; border: none; cursor: pointer; color: var(--dark); text-align: right;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--bg); }

.content { padding: 26px; flex: 1; }

/* ---------- کارت‌ها ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 22px;
  overflow: hidden;
}
.card-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-weight: bold;
}
.card-head .ic { color: var(--primary); }
.card-body { padding: 20px; }

/* ---------- شبکه ---------- */
.row { display: flex; flex-wrap: wrap; margin: -10px; }
.col { padding: 10px; flex: 1; min-width: 0; }
.col-2 { padding: 10px; width: 16.66%; }
.col-3 { padding: 10px; width: 25%; }
.col-4 { padding: 10px; width: 33.33%; }
.col-6 { padding: 10px; width: 50%; }
.col-12 { padding: 10px; width: 100%; }
@media (max-width: 992px){ .col-3,.col-4{width:50%} .col-2{width:33.33%} }
@media (max-width: 640px){ .col-3,.col-4,.col-6,.col-2{width:100%} }

/* ---------- آمار ---------- */
.stat {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
}
.stat .stat-ic {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
}
.stat .v { font-size: 24px; font-weight: bold; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.bg-primary{background:var(--primary)} .bg-info{background:var(--info)}
.bg-warning{background:var(--warning)} .bg-danger{background:var(--danger)}
.bg-secondary{background:#7e3af2}

/* ---------- دکمه‌ها ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-size: 13.5px; font-weight: bold; cursor: pointer;
  transition: all .15s; line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color:#fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover{ background:#1a56db; color:#fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover{ background:#c81e1e; color:#fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-light { background: var(--bg); color: var(--dark); border-color: var(--border); }
.btn-light:hover { background: #e5e7eb; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--dark); }
.btn-outline:hover{ background: var(--bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled]{ opacity:.55; cursor: not-allowed; }

/* ---------- فرم‌ها ---------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: bold; color: #374151; }
.form-label .req { color: var(--danger); }
.form-control, select.form-control, textarea.form-control {
  width: 100%; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-family: inherit; font-size: 13.5px;
  background: #fff; color: var(--dark); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, textarea.form-control:focus, select.form-control:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea.form-control { min-height: 110px; resize: vertical; line-height: 2; }
.form-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-inline-start: 36px; }

/* ---------- جداول ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.table th, table.table td { padding: 12px 14px; text-align: right; border-bottom: 1px solid var(--border); }
table.table thead th { background: #f9fafb; color: #374151; font-weight: bold; white-space: nowrap; }
table.table tbody tr:hover { background: #f9fafb; }
table.table tbody tr.unread { background: var(--warning-light) !important; }

/* ---------- نشان‌ها ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: bold; }
.badge-success { background: var(--primary-light); color: var(--primary-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--info-light); color: var(--secondary); }
.badge-muted { background: #f3f4f6; color: var(--muted); }

/* ---------- آلرت ---------- */
.alert { padding: 14px 18px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px; display:flex; gap:10px; align-items:center; border:1px solid transparent; }
.alert-success { background: var(--primary-light); color: var(--primary-dark); border-color:#84e1bc; }
.alert-danger { background: var(--danger-light); color: var(--danger); border-color:#f8b4b4; }
.alert-warning { background: var(--warning-light); color: var(--warning); border-color:#fce96a; }
.alert-info { background: var(--info-light); color: var(--secondary); border-color:#a4cafe; }

/* ---------- الرت ویژه سامانه (فلش) ---------- */
.flash-alert { position: relative; align-items: flex-start; padding-inline-end: 42px; animation: flash-in .35s cubic-bezier(.2,.8,.25,1); box-shadow: 0 6px 18px -10px rgba(17,24,39,.35); }
.flash-alert .ic {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: bold; color:#fff;
}
.alert-success .ic { background: var(--primary); }
.alert-danger  .ic { background: var(--danger); }
.alert-warning .ic { background: var(--warning); }
.alert-info    .ic { background: var(--secondary); }
.flash-alert .bd { flex: 1; line-height: 1.9; padding-top: 2px; }
.flash-alert .alert-x {
  position: absolute; inset-inline-end: 12px; top: 12px;
  background: none; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: inherit; opacity: .55;
}
.flash-alert .alert-x:hover { opacity: 1; }
.flash-alert.hide { animation: flash-out .3s ease forwards; }
@keyframes flash-in { from { transform: translateY(-10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes flash-out { to { transform: translateY(-8px); opacity: 0; height: 0; margin: 0; padding-top: 0; padding-bottom: 0; } }

/* ---------- توست (اعلان شناور) ---------- */
.toast-wrap {
  position: fixed; top: 18px; inset-inline: 0; z-index: 4000;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  pointer-events: auto; min-width: 260px; max-width: 90vw;
  display: flex; align-items: center; gap: 11px;
  background: #fff; color: var(--dark);
  border: 1px solid var(--border); border-inline-start: 4px solid var(--primary);
  border-radius: 12px; padding: 13px 16px; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 14px 34px -14px rgba(17,24,39,.45);
  animation: toast-in .3s cubic-bezier(.2,.8,.25,1);
}
.toast.hide { animation: toast-out .25s ease forwards; }
.toast .ic { flex: none; width: 24px; height: 24px; border-radius: 50%; display:inline-flex; align-items:center; justify-content:center; color:#fff; font-size:13px; }
.toast.success { border-inline-start-color: var(--primary); } .toast.success .ic { background: var(--primary); }
.toast.error   { border-inline-start-color: var(--danger);  } .toast.error .ic   { background: var(--danger); }
.toast.warning { border-inline-start-color: var(--warning); } .toast.warning .ic { background: var(--warning); }
.toast.info    { border-inline-start-color: var(--secondary);} .toast.info .ic    { background: var(--secondary); }
@keyframes toast-in { from { transform: translateY(-16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toast-out { to { transform: translateY(-12px); opacity: 0; } }

/* ---------- دیالوگ تایید اختصاصی ---------- */
.confirm-modal { max-width: 420px; text-align: center; }
.confirm-modal .cm-ic {
  width: 64px; height: 64px; margin: 4px auto 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; background: var(--danger-light); color: var(--danger);
}
.confirm-modal.is-info .cm-ic { background: var(--info-light); color: var(--secondary); }
.confirm-modal .cm-title { font-weight: bold; font-size: 16px; margin: 16px 0 6px; }
.confirm-modal .cm-msg { color: var(--muted); font-size: 13.5px; line-height: 1.9; padding: 0 6px; }
.confirm-modal .modal-foot { justify-content: center; border-top: none; padding-top: 6px; }
.confirm-modal .modal-foot .btn { min-width: 110px; justify-content: center; }

/* ---------- مودال ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.55);
  display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: pop .2s ease;
}
.modal.wide { max-width: 820px; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-head .t { font-weight: bold; font-size: 15px; }
.modal-head .x { margin-inline-start: auto; background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-start; }

/* ---------- تب‌ها ---------- */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs .tab { padding: 10px 16px; cursor: pointer; font-size: 13px; font-weight: bold; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs .tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tab-pane { display: none; } .tab-pane.active { display: block; }

/* ---------- چت ---------- */
.chat-thread { display: flex; flex-direction: column; gap: 14px; padding: 8px 0; }
.chat-msg { max-width: 78%; padding: 12px 16px; border-radius: 14px; font-size: 13.5px; box-shadow: var(--shadow); }
.chat-msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.chat-msg.in { background: #fff; border: 1px solid var(--border); align-self: flex-start; border-top-right-radius: 4px; }
.chat-msg.out { background: var(--primary-light); align-self: flex-end; border-top-left-radius: 4px; }

/* ---------- متفرقه ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .ic { font-size: 46px; opacity: .35; margin-bottom: 12px; }
.page-actions { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 8px 13px; border-radius: 9px; border: 1px solid var(--border); font-size: 13px; background:#fff; }
.pagination .active span, .pagination a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled span { opacity: .45; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-2{margin-top:10px} .mb-0{margin-bottom:0} .mb-2{margin-bottom:10px} .w-100{width:100%}
.divider { height:1px; background: var(--border); margin: 18px 0; }
.flex { display:flex; align-items:center; gap:10px; }
.flex-between{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }

/* ---------- ورود ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, #0e9f6e 0%, #057a55 100%); }
.auth-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; padding: 38px 34px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo img { width: 78px; height: 78px; border-radius: 18px; object-fit: cover; }
.auth-logo h1 { font-size: 18px; margin: 14px 0 4px; }
.auth-logo p { font-size: 12.5px; color: var(--muted); margin: 0; }
.auth-links { text-align: center; margin-top: 18px; font-size: 13px; }
.otp-input { letter-spacing: 12px; text-align: center; font-size: 22px; font-weight: bold; }

/* ---------- ریسپانسیو ---------- */
@media (max-width: 992px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-inline-start: 0; }
  .menu-toggle { display: block; }
  .user-chip .nm, .user-chip .rl { display: none; }
}

/* انتخاب چندتایی ساده */
select[multiple].form-control { min-height: 130px; padding: 8px; }
select[multiple].form-control option { padding: 7px 10px; border-radius: 7px; margin-bottom: 3px; }
select[multiple].form-control option:checked { background: var(--primary) linear-gradient(0deg,var(--primary),var(--primary)); color:#fff; }

.switch-list { display:flex; flex-wrap:wrap; gap:10px; }
.switch-list label { display:flex; align-items:center; gap:8px; padding:9px 14px; border:1px solid var(--border); border-radius:10px; cursor:pointer; font-size:13px; }
.switch-list label:hover { background: var(--bg); }
.switch-list input { width:16px; height:16px; accent-color: var(--primary); }
