/* style.css — استایل کارپوشه ناویکا (RTL، روشن، چاپ‌پذیر) */
* { box-sizing: border-box; }

/* ---------- مودال ---------- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(13, 27, 42, 0.55);
  z-index: 1000;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 14px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 720px;
  box-shadow: 0 18px 50px rgba(0,0,0,0.3);
  animation: modalIn 0.18s ease-out;
}
.modal.modal-sm { max-width: 480px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e3e9ef;
}
.modal-head h3 { margin: 0; font-size: 16px; color: #12324f; }
.modal-close {
  background: none; border: 0; font-size: 22px; line-height: 1;
  color: #7a8a99; cursor: pointer; padding: 2px 8px; border-radius: 6px;
}
.modal-close:hover { background: #eef2f6; color: #333; }
.modal-body { padding: 16px 18px 20px; }
@keyframes modalIn {
  from { transform: translateY(-14px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
body {
  font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  direction: rtl;
  margin: 0;
  background: #f4f6f9;
  color: #1d2733;
}
a { color: #0b5fa5; text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  background: #12324f;
  color: #fff;
  padding: 10px 18px;
}
header h1 { font-size: 17px; margin: 4px 0 8px; }
nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
nav a { color: #cfe3f7; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
nav a:hover { background: #1d466c; text-decoration: none; }
nav .who { font-size: 13px; color: #9fc2e4; }
nav .who .ucode { font-size: 11.5px; color: #7fa9d0; background: rgba(255,255,255,.12); padding: 1px 6px; border-radius: 5px; }
nav .spacer { flex: 1; }

main { max-width: 1100px; margin: 18px auto; padding: 0 14px; }
footer {
  text-align: center; color: #6b7a8a; font-size: 12px;
  padding: 14px; border-top: 1px solid #dde4ea; margin-top: 30px;
}

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: #e2f5e8; color: #14682e; border: 1px solid #b5e2c2; }
.flash.err { background: #fdeaea; color: #9c2020; border: 1px solid #f0bcbc; }

h2 { font-size: 19px; margin: 8px 0 14px; }
h3 { font-size: 16px; margin: 18px 0 8px; }

table { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
th, td { border: 1px solid #dbe2e9; padding: 8px 10px; text-align: right; vertical-align: top; }
th { background: #eef3f8; font-weight: 600; }
tr:nth-child(even) td { background: #fbfcfd; }

.card { background: #fff; border: 1px solid #dbe2e9; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.grid.cols3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.open        { background: #f1f3f5; color: #444; }
.badge.in_progress { background: #e3f0fb; color: #0b5fa5; }
.badge.blocked     { background: #fdeee3; color: #a35412; }
.badge.closed      { background: #e2f5e8; color: #14682e; }
.badge.A { background: #fdecec; color: #a02020; }
.badge.B { background: #fdf4e3; color: #9a6b0a; }
.badge.C { background: #eceafd; color: #4b3fae; }
.badge.overdue { background: #a02020; color: #fff; }
.badge.cat { background: #eaf1f8; color: #1f4e79; font-weight: 600; }

.heat-green  { background: #1d9d4f !important; }
.heat-yellow { background: #d9a514 !important; }
.heat-red    { background: #c22f2f !important; }
.heat-cell   { color: #fff; text-align: center; font-weight: 700; width: 110px; }

.btn, button, input[type="submit"] {
  background: #0b5fa5; color: #fff; border: 0; border-radius: 7px;
  padding: 7px 16px; font-size: 14px; font-family: inherit; cursor: pointer;
}
.btn.secondary { background: #5b6b7b; }
.btn.danger { background: #c22f2f; }
.btn.small { padding: 3px 10px; font-size: 12.5px; }

form.inline { display: inline; }
label { display: block; font-size: 13px; margin: 8px 0 3px; color: #40515f; }
input[type="text"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #c6d1da; border-radius: 7px;
  font-family: inherit; font-size: 14px; background: #fff;
}
textarea { min-height: 70px; }
/* فیلدهای متنی بلند (یادداشت/توضیحات و متن بند) */
textarea.tall { min-height: 150px; resize: vertical; }
form .full { flex: 1 1 100%; }
form .row { display: flex; gap: 12px; flex-wrap: wrap; }
form .row > div { flex: 1; min-width: 160px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters label { margin: 0 0 3px; }
.filters > div { min-width: 150px; }

details > summary { cursor: pointer; color: #0b5fa5; font-size: 13px; margin-top: 6px; }
ul.log { font-size: 12.5px; color: #556; padding-right: 18px; margin: 6px 0; }

.kpi { text-align: center; }
.kpi .num { font-size: 30px; font-weight: 700; color: #12324f; }
.kpi .lbl { font-size: 13px; color: #64707c; }

/* ---- دراپ‌داون تاریخ جلالی ---- */
.jdate-group select { width: auto; min-width: 74px; display: inline-block; }
.jdate-group { display: inline-flex; gap: 6px; }

/* ---- حضور و غیاب ---- */
.att-row td { vertical-align: middle; }
.att-radio { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; }
.att-radio label { display: inline-flex; align-items: center; gap: 4px; margin: 0; cursor: pointer; }
.att-present { color: #14682e; font-weight: 600; }
.att-absent { color: #9c2020; font-weight: 600; }
.att-excused_absence { color: #9a6b0a; font-weight: 600; }
.att-deputy { color: #0b5fa5; font-weight: 600; }

/* ---- صورت‌جلسه چاپی با امضا ---- */
.minute-item { border-right: 3px solid #0b5fa5; padding: 7px 14px; margin: 10px 0; background: #f8fafc; border-radius: 6px; }
.minute-item .mtype { font-size: 13px; color: #0b5fa5; font-weight: 700; }
.minute-item > div[style] { font-size: 15px; line-height: 1.8; }
.minute-people {
  display: flex; gap: 18px;
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed #d5dde5;
  font-size: 13px; color: #334;
}
.report-header { text-align: center; border-bottom: 2px solid #12324f; padding-bottom: 10px; margin-bottom: 14px; }
.report-header h2 { margin: 4px 0; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px 30px; margin-top: 34px; }
.sig-box { text-align: center; font-size: 13px; }
.sig-box .sig-line { border-bottom: 1px dotted #555; height: 46px; margin-bottom: 6px; }
.sig-box .sig-role { color: #556; font-size: 12px; }
.sign-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.sign-present { background: #e2f5e8; color: #14682e; }
.sign-absent { background: #fdeaea; color: #9c2020; }
.sign-excused_absence { background: #fdf4e3; color: #9a6b0a; }
.sign-deputy { background: #e3f0fb; color: #0b5fa5; }

/* ---- سربرگ و دکمه چاپ سراسری ---- */
.print-head { display: none; }
.print-bar {
  max-width: 1100px; margin: 0 auto 10px; padding: 0 14px;
  display: flex; justify-content: flex-end;
}
.print-bar button { background: #5b6b7b; }

@media print {
  /* بازنشانی صفحه */
  @page { size: A4; margin: 12mm 10mm; }
  html, body { background: #fff !important; }
  body { font-size: 12px; color: #000; }

  /* حذف عناصر تعاملی/تزئینی */
  header, footer, .filters, form, .no-print, .modal-overlay,
  .print-bar, details > summary, .btn, button { display: none !important; }

  /* سربرگ رسمی چاپ */
  .print-head {
    display: block; text-align: center;
    border-bottom: 2px solid #12324f; padding-bottom: 8px; margin-bottom: 12px;
  }
  .print-head .ph-app { font-size: 15px; font-weight: 700; color: #12324f; margin: 0 0 2px; }
  .print-head .ph-page { font-size: 12.5px; margin: 0; color: #333; }
  .print-head .ph-date { font-size: 11px; color: #666; margin: 2px 0 0; }

  /* چاپ رنگ‌ها دقیقاً (Heatmap، نشان‌ها و نوار پیشرفت) */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  /* details بسته هم هنگام چاپ باز شود */
  details { display: block; }
  details > *:not(summary) { display: block !important; }

  main { max-width: 100% !important; margin: 0 !important; padding: 0 !important; }

  .card { border: 1px solid #ccc !important; box-shadow: none !important; border-radius: 4px !important; }
  table { font-size: 11.5px; }
  th, td { border-color: #999 !important; }

  /* شکستن صفحه تمیز — امضا بلافاصله بعد از اقدامات ادامه می‌یابد، بدون صفحه خالی */
  h2, h3 { break-after: avoid; }
  tr, .minute-item, .sig-box { break-inside: avoid; }
  .sig-grid { break-inside: auto; }
  .sig-section { break-before: auto; break-inside: avoid; }

  /* لینک‌ها زیرخط‌دار و سیاه برای خوانایی روی کاغذ */
  a { color: #000 !important; }

  /* نوار پیشرفت با حاشیه تا در چاپ سیاه‌وسفید هم خوانا باشد */
  div[style*="border-radius:6px"], div[style*="border-radius:5px"] { border: 1px solid #999 !important; }

  /* فونت درشت‌تر برای خوانایی چاپ بندها */
  .minute-item > div[style] { font-size: 14px !important; }
}
