/* ===========================================================================
   تقویم شمسی و انتخابگر تاریخ — باکس شیک و مدرن
   =========================================================================== */

.jdp {
  position: absolute;
  z-index: 120;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  user-select: none;
  animation: jdpIn .18s ease;
}
@keyframes jdpIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.jdp__header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.jdp__nav {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: grid; place-items: center; border: none; background: var(--surface-2);
  color: var(--gray-600); transition: all var(--transition);
}
.jdp__nav:hover { background: var(--primary); color: #fff; }
.jdp__title { font-weight: 700; font-size: 14.5px; display: flex; gap: 6px; }
.jdp__title button { background: none; border: none; font: inherit; font-weight: 700; color: var(--text); padding: 4px 8px; border-radius: var(--radius-sm); }
.jdp__title button:hover { background: var(--primary-light); color: var(--primary); }

.jdp__weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 6px; }
.jdp__weekday { text-align: center; font-size: 11px; font-weight: 700; color: var(--gray-400); padding: 6px 0; }
.jdp__weekday.holiday { color: var(--danger); }

.jdp__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.jdp__day {
  aspect-ratio: 1; display: grid; place-items: center;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  color: var(--gray-700); cursor: pointer; border: none; background: none;
  transition: all var(--transition); position: relative;
}
.jdp__day:hover { background: var(--primary-light); color: var(--primary); }
.jdp__day.empty { visibility: hidden; }
.jdp__day.friday { color: var(--danger); }
.jdp__day.today { border: 1.5px solid var(--primary); font-weight: 700; }
.jdp__day.selected { background: var(--primary); color: #fff; box-shadow: var(--shadow); }
.jdp__day.selected:hover { background: var(--primary-dark); color: #fff; }
.jdp__day.has-event::after { content: ''; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.jdp__footer { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.jdp__footer button { flex: 1; padding: 8px; border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--gray-600); transition: all var(--transition); }
.jdp__footer button:hover { background: var(--gray-50); }
.jdp__footer button.primary { background: var(--primary-light); color: var(--primary); border-color: transparent; }

/* نمای انتخاب ماه/سال */
.jdp__grid-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.jdp__grid-select button { padding: 12px 6px; border-radius: var(--radius-sm); border: none; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--gray-700); transition: all var(--transition); }
.jdp__grid-select button:hover { background: var(--primary); color: #fff; }
.jdp__grid-select button.active { background: var(--primary); color: #fff; }

/* فیلد ورودی تاریخ */
.jdate-field { position: relative; }
.jdate-field .ic { position: absolute; inset-inline-end: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); pointer-events: none; }
.jdate-field .input { padding-inline-end: 40px; cursor: pointer; }

/* ===========================================================================
   تقویم بزرگ (نمای ماهانه صفحه تقویم)
   =========================================================================== */
.calendar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.calendar__head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.calendar__head h2 { font-size: 18px; font-weight: 800; }
.calendar__nav { display: flex; gap: 8px; margin-inline-start: auto; }
.calendar__weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.calendar__weekday { padding: 12px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--gray-500); }
.calendar__weekday.holiday { color: var(--danger); }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar__cell { min-height: 116px; border-inline-end: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 8px; position: relative; transition: background var(--transition); }
.calendar__cell:nth-child(7n) { border-inline-end: none; }
.calendar__cell:hover { background: var(--surface-2); }
.calendar__cell.empty { background: var(--surface-2); }
.calendar__cell.today { background: var(--primary-light); }
.calendar__daynum { font-weight: 700; font-size: 14px; color: var(--gray-700); width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-full); }
.calendar__cell.today .calendar__daynum { background: var(--primary); color: #fff; }
.calendar__cell.friday .calendar__daynum { color: var(--danger); }
.calendar__event { font-size: 11.5px; padding: 3px 8px; border-radius: var(--radius-sm); margin-top: 5px; font-weight: 600; display: flex; align-items: center; gap: 5px; cursor: pointer; }
.calendar__event::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.calendar__event.invoice { background: var(--success-light); color: #166534; }
.calendar__event.contract { background: var(--primary-light); color: var(--primary); }
.calendar__event.reminder { background: var(--warning-light); color: #92400e; }
.calendar__event.task { background: var(--info-light); color: #075985; }
.calendar__event.checkup { background: var(--danger-light); color: #991b1b; }

@media (max-width: 768px) {
  /* هر ۷ ستون باید در عرض موبایل جا شوند: اجازه‌ی جمع‌شدن ستون‌ها + پدینگ/فونت جمع‌وجورتر */
  .calendar__weekday, .calendar__cell { min-width: 0; }
  .calendar__weekday { padding: 8px 2px; font-size: 10.5px; }
  .calendar__cell { min-height: 68px; padding: 5px 3px; }
  .calendar__daynum { width: 26px; height: 26px; font-size: 12.5px; }
  .calendar__event { display: none; }
  .calendar__cell.has-events::after { content: ''; position: absolute; bottom: 8px; inset-inline-start: 50%; transform: translateX(-50%); width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
}
