/*
 * PersianDatePicker widget styles (framework-agnostic, from persian-datepicker.md §5).
 * Theme colour is the site brand teal (#0d9488) instead of the doc's default blue.
 */

/* Visibility toggle used by the script */
.pdp-popup.hidden { display: none; }

/* The visible input is forced to LTR so the digits read naturally */
.mcdp-rtl-input { direction: ltr; text-align: center; }

/* Popup container. The script appends it to <body> and positions it from the input's
   bounding rect, so no overflow:hidden ancestor (panel-card, table-responsive) can clip it.
   z-index must clear the sticky admin topbar (1020). */
.pdp-popup {
    position: fixed; z-index: 1100; width: 18rem;
    background: #fff; padding: 0.75rem; border-radius: 0.75rem;
    box-shadow: 0 0 0 1px #e2e8f0, 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
    direction: rtl;
}

/* Header: nav buttons + title */
.pdp-header { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.pdp-title  { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; font-weight: 600; color: #1e293b; }

.pdp-nav-btn {
    display: flex; align-items: center; justify-content: center;
    height: 2rem; width: 2rem; border: 0; background: transparent;
    border-radius: 0.5rem; color: #475569; cursor: pointer;
}
.pdp-nav-btn:hover { background: #f1f5f9; }

/* SVG chevron. Base points LEFT; "previous" button is mirrored to point RIGHT (RTL). */
.pdp-nav-icon { height: 1rem; width: 1rem; }
.pdp-nav-prev .pdp-nav-icon { transform: scaleX(-1); }

.pdp-year-input {
    width: 4rem; text-align: center; font-size: 0.875rem;
    padding: 0.125rem 0.25rem; border: 0; border-radius: 0.375rem;
    background: #f8fafc; box-shadow: inset 0 0 0 1px #e2e8f0; color: inherit;
}
.pdp-year-input:focus { outline: none; box-shadow: inset 0 0 0 2px #0d9488; }

/* Day grid */
.pdp-grid    { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 0.25rem; }
.pdp-weekday { padding: 0.25rem 0; text-align: center; font-size: 0.75rem; font-weight: 500; color: #94a3b8; }
.pdp-day {
    display: flex; align-items: center; justify-content: center;
    height: 2rem; width: 2rem; border-radius: 0.5rem;
    font-size: 0.875rem; color: #334155; cursor: pointer;
}
.pdp-day:hover         { background: #f0fdfa; color: #0f766e; }
.pdp-day-empty         { height: 2rem; width: 2rem; }
.pdp-day-today         { box-shadow: inset 0 0 0 1px #5eead4; }
.pdp-day-selected,
.pdp-day-selected:hover{ background: #0d9488; color: #fff; }
.pdp-day-disabled,
.pdp-day-disabled:hover{ cursor: not-allowed; color: #cbd5e1; background: transparent; }

/* Footer actions */
.pdp-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; padding-top: 0.5rem; border-top: 1px solid #f1f5f9; }
.pdp-link   { font-size: 0.75rem; font-weight: 500; color: #0d9488; cursor: pointer; }

/* Brief red outline shown by the script on invalid manual input */
.mcdp-rtl-input.ring-red-400 { box-shadow: inset 0 0 0 2px #f87171; }

/* Dark theme — this file is plain CSS (not Tailwind), so it needs its own explicit overrides.
   پنل مدیریت تم را روی <html data-theme="dark"> می‌گذارد (نه کلاس .dark)؛ هر دو پوشش داده می‌شوند.
   چون پاپ‌آپ فرزند body است، انتخابگر باید از ریشه بیاید. */
:where(.dark, [data-theme="dark"]) .pdp-popup {
    background: #1e293b;
    box-shadow: 0 0 0 1px #334155, 0 10px 15px -3px rgba(0,0,0,.3), 0 4px 6px -4px rgba(0,0,0,.3);
}

:where(.dark, [data-theme="dark"]) .pdp-title { color: #f1f5f9; }

:where(.dark, [data-theme="dark"]) .pdp-nav-btn { color: #94a3b8; }
:where(.dark, [data-theme="dark"]) .pdp-nav-btn:hover { background: #334155; }

:where(.dark, [data-theme="dark"]) .pdp-year-input {
    background: #0f172a; box-shadow: inset 0 0 0 1px #334155; color: #f1f5f9;
}
:where(.dark, [data-theme="dark"]) .pdp-year-input:focus { box-shadow: inset 0 0 0 2px #0d9488; }

:where(.dark, [data-theme="dark"]) .pdp-weekday { color: #64748b; }
:where(.dark, [data-theme="dark"]) .pdp-day { color: #cbd5e1; }
:where(.dark, [data-theme="dark"]) .pdp-day:hover { background: #134e4a; color: #5eead4; }
:where(.dark, [data-theme="dark"]) .pdp-day-today { box-shadow: inset 0 0 0 1px #0d9488; }
:where(.dark, [data-theme="dark"]) .pdp-day-selected,
:where(.dark, [data-theme="dark"]) .pdp-day-selected:hover { background: #0d9488; color: #fff; }
:where(.dark, [data-theme="dark"]) .pdp-day-disabled,
:where(.dark, [data-theme="dark"]) .pdp-day-disabled:hover { color: #475569; background: transparent; }

:where(.dark, [data-theme="dark"]) .pdp-footer { border-top-color: #334155; }

/* ── Time picker ──────────────────────────────────────────────────────────
   Shares .pdp-popup (position, surface, shadow), .pdp-header/.pdp-footer, .pdp-chip
   and .pdp-hint with the calendar. Two views (hours grid, minutes grid) since
   ۱۴۰۵/۰۸/۰۸; the header is the value itself, as two buttons. */
.ptp-popup { width: 14rem; }
/* Sixty minute cells in ten columns need more room; only that view widens. */
.ptp-popup.ptp-wide { width: 20rem; }
.ptp-header { justify-content: center; }
.ptp-title { gap: 0.15rem; font-size: 1.15rem; }
.ptp-chip { font-size: 1.15rem; font-weight: 700; padding: 0 0.3rem 0 0.4rem; height: 2.1rem; }
.ptp-chip-active { background: #f0fdfa; color: #0f766e; }
.ptp-colon { font-weight: 700; color: #94a3b8; }

.ptp-grid { display: grid; gap: 0.3rem; }
.ptp-grid-hours { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.ptp-grid-minutes.ptp-cols-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ptp-grid-minutes.ptp-cols-10 { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.2rem; }

.ptp-cell {
    display: flex; align-items: center; justify-content: center;
    height: 2.1rem; border-radius: 0.5rem;
    font-size: 0.85rem; color: #334155; cursor: pointer;
    direction: ltr;
}
.ptp-grid-minutes.ptp-cols-4 .ptp-cell { height: 2.4rem; }
.ptp-grid-minutes.ptp-cols-10 .ptp-cell { height: 1.8rem; font-size: 0.8rem; border-radius: 0.4rem; }
.ptp-cell:hover { background: #f0fdfa; color: #0f766e; }
.ptp-cell-selected,
.ptp-cell-selected:hover { background: #0d9488; color: #fff; }

:where(.dark, [data-theme="dark"]) .ptp-chip-active { background: #134e4a; color: #5eead4; }
:where(.dark, [data-theme="dark"]) .ptp-colon { color: #64748b; }
:where(.dark, [data-theme="dark"]) .ptp-cell { color: #cbd5e1; }
:where(.dark, [data-theme="dark"]) .ptp-cell:hover { background: #134e4a; color: #5eead4; }
:where(.dark, [data-theme="dark"]) .ptp-cell-selected,
:where(.dark, [data-theme="dark"]) .ptp-cell-selected:hover { background: #0d9488; color: #fff; }

/* ── Month and year views (۱۴۰۵/۰۸/۰۸) ─────────────────────────────────────
   The header's month and year are buttons; each opens a 4×3 grid. Shares .pdp-popup,
   .pdp-header, .pdp-nav-btn and .pdp-footer with the day view; only the chips and the
   3-column cells are new. */

/* سرآیند: دو دکمهٔ ماه و سال به‌جای متن و input */
.pdp-chip {
  display: inline-flex; align-items: center; gap: 0.2rem;
  height: 1.9rem; padding: 0 0.45rem 0 0.35rem;
  border: 0; border-radius: 0.5rem; background: transparent;
  font: inherit; font-size: 0.875rem; font-weight: 600; color: #1e293b;
  cursor: pointer; transition: background .15s ease;
}
.pdp-chip:hover, .pdp-chip:focus-visible { background: #f1f5f9; outline: none; }
.pdp-chip-caret { width: 0.85rem; height: 0.85rem; opacity: .55; }
.pdp-title .pdp-chip + .pdp-chip { margin-inline-start: 0.1rem; }

/* شبکهٔ ۳ ستونه برای ماه‌ها و سال‌ها (۴ ردیف، تقریباً هم‌ارتفاع با ۶ ردیف روز) */
.pdp-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; }
.pdp-cell {
  display: flex; align-items: center; justify-content: center;
  height: 2.6rem; border-radius: 0.5rem;
  font-size: 0.875rem; color: #334155; cursor: pointer;
  transition: background .12s ease;
}
.pdp-cell:hover          { background: #f0fdfa; color: #0f766e; }
.pdp-cell-current        { box-shadow: inset 0 0 0 1px #5eead4; }
.pdp-cell-selected,
.pdp-cell-selected:hover { background: #0d9488; color: #fff; }
.pdp-cell-disabled,
.pdp-cell-disabled:hover { cursor: not-allowed; color: #cbd5e1; background: transparent; }

/* راهنمای یک‌خطی بالای شبکهٔ ماه */
.pdp-hint { font-size: 0.72rem; color: #94a3b8; text-align: center; margin: -0.15rem 0 0.4rem; }

/* بازهٔ صفحهٔ سال، کنار input سال */
.pdp-range { font-size: 0.72rem; color: #94a3b8; white-space: nowrap; }
.pdp-popup[data-mode="years"] .pdp-year-input { width: 3.6rem; }
/* inputها فونت را ارث نمی‌برند؛ بدون این، سال با ارقام لاتینِ فونت سیستم کنار اعداد فارسی شبکه می‌نشیند */
.pdp-year-input { font-family: inherit; }

.pdp-nav-btn[disabled] { opacity: .3; cursor: default; }
.pdp-nav-btn[disabled]:hover { background: transparent; }
.pdp-link-muted { color: #94a3b8; }

/* گذار نرم بین نماها؛ با reduced-motion خاموش */
.pdp-popup .pdp-grid { animation: pdpFade .14s ease; }
@keyframes pdpFade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pdp-popup .pdp-grid { animation: none; } }

/* تم تیره */
:where(.dark, [data-theme="dark"]) .pdp-chip { color: #f1f5f9; }
:where(.dark, [data-theme="dark"]) .pdp-chip:hover,
:where(.dark, [data-theme="dark"]) .pdp-chip:focus-visible { background: #334155; }
:where(.dark, [data-theme="dark"]) .pdp-cell { color: #cbd5e1; }
:where(.dark, [data-theme="dark"]) .pdp-cell:hover { background: #134e4a; color: #5eead4; }
:where(.dark, [data-theme="dark"]) .pdp-cell-current { box-shadow: inset 0 0 0 1px #0d9488; }
:where(.dark, [data-theme="dark"]) .pdp-cell-selected,
:where(.dark, [data-theme="dark"]) .pdp-cell-selected:hover { background: #0d9488; color: #fff; }
:where(.dark, [data-theme="dark"]) .pdp-cell-disabled,
:where(.dark, [data-theme="dark"]) .pdp-cell-disabled:hover { color: #475569; background: transparent; }
:where(.dark, [data-theme="dark"]) .pdp-hint,
:where(.dark, [data-theme="dark"]) .pdp-range,
:where(.dark, [data-theme="dark"]) .pdp-link-muted { color: #64748b; }
