/* main stylesheet, part 2 of 6: auth pages, type-to-search combobox, reservations filter.
   Loaded in this order by templates/base.html; the parts are one cascade, order matters. */
/* ── Auth pages ───────────────────────────────────────────── */

.logout-form {
  margin: 0;
  padding: 0;
  display: contents;
}

.auth-page {
  min-height: 60vh;
  display: grid;
  place-items: center;
  padding: 2rem 0 4rem;
}

.auth-card {
  width: min(480px, 100%);
  padding: 2rem;
  border-radius: 1.25rem;
  background:
    radial-gradient(circle at top right, rgba(222, 63, 130, 0.07), transparent 30%),
    linear-gradient(180deg, #fff 0%, #fbfaf7 100%);
  border: 1px solid var(--teal-09);
  box-shadow: var(--shadow-card-strong);
  display: grid;
  gap: 1.5rem;
}

.auth-card form {
  display: grid;
  gap: 1.25rem;
}

.auth-card-header {
  display: grid;
  gap: 0.35rem;
  text-align: center;
}

.auth-card-header h1 {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.35;
  color: var(--accent-strong);
}

.auth-card-header p {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-95);
}

.form-fields {
  display: grid;
  gap: 1rem;
}

.form-fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.form-field {
  display: grid;
  gap: 0.4rem;
}

.form-label {
  font-size: var(--fs-90);
  font-weight: 600;
  color: var(--accent-strong);
}

.form-input {
  width: 100%;
  min-height: 2.85rem;
  border-radius: 0.7rem;
  border: 1px solid var(--teal-14);
  background: white;
  color: var(--text);
  padding: 0.7rem 0.95rem;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Read-only profile (counselor's client page): the reception form inside a
   disabled <fieldset>. Keep the text fully readable — browsers grey out
   disabled controls — and drop the fieldset's own frame. */
.form-readonly {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.form-readonly .form-input {
  color: var(--text);
  -webkit-text-fill-color: var(--text);
  opacity: 1;
  background: var(--teal-03);
  cursor: default;
}
.form-readonly select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: none;
}
.form-readonly .form-switch {
  opacity: 0.85;
}

textarea.form-input {
  min-height: auto;
  resize: vertical;
}

select.form-input {
  appearance: none;
  -webkit-appearance: none;
  padding-left: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23259193' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 1rem;
  cursor: pointer;
}

.form-input:focus {
  border-color: rgba(37, 145, 147, 0.28);
  box-shadow: 0 0 0 4px var(--teal-06);
}

.form-input.error {
  border-color: rgba(180, 40, 40, 0.4);
}

/* Custom-select: replaces a plain <select>'s native (OS-chrome) dropdown
   with an on-brand popup list — the select itself stays in the DOM, hidden,
   as the real source of truth. */
.custom-select {
  position: relative;
}

.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  text-align: right;
  cursor: pointer;
}

.custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  flex-shrink: 0;
  display: inline-flex;
  color: var(--accent-strong);
  transition: transform 0.15s ease;
}

.custom-select-trigger[aria-expanded="true"] .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.4rem);
  right: 0;
  left: 0;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: linear-gradient(180deg, #fff 0%, #fbfaf7 100%);
  border-radius: 0.85rem;
  box-shadow: 0 0 0 1px var(--teal-12), 0 20px 50px rgba(33, 50, 58, 0.16);
  animation: cal-pop-in 0.15s ease-out;
}

.custom-select-option {
  display: block;
  width: 100%;
  text-align: right;
  padding: 0.6rem 0.75rem;
  border: none;
  border-radius: var(--radius-sm2);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-90);
  cursor: pointer;
  transition: background 0.12s ease-out;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: var(--teal-08);
  outline: none;
}

.custom-select-option[aria-selected="true"] {
  background: var(--teal-14);
  color: var(--accent-strong);
  font-weight: 700;
}

/* ── Type-to-search combobox (static/js/site_combobox.js) ──────────────────
   Reuses .custom-select / .custom-select-list / .custom-select-option for the
   wrapper and the popup; only the text field, its chevron and the extras a
   searchable list needs are new. The list itself is placed by SitePopover. */

/* While open the list is moved to <body> (so no modal/scroll container can clip
   it) — it must then out-rank the modal backdrop (1300) and the date picker (1400). */
.combobox-list-portal {
  z-index: var(--z-modal);
}

.combobox-input {
  padding-left: 2.6rem;
  text-overflow: ellipsis;
  cursor: text;
}

.combobox-toggle {
  position: absolute;
  top: 50%;
  left: 0.5rem;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--accent-strong);
  cursor: pointer;
}

.combobox-toggle:hover {
  background: var(--teal-10);
}

.combobox-toggle svg {
  transition: transform 0.15s ease;
}

.combobox-input[aria-expanded="true"] ~ .combobox-toggle svg {
  transform: rotate(180deg);
}

.custom-select-option.combobox-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.custom-select-option.is-active {
  background: var(--teal-10);
}

.custom-select-option.is-active[aria-selected="true"] {
  background: var(--teal-18);
}

.combobox-option-title {
  flex: 1;
  min-width: 0;
}

.combobox-option-number {
  flex-shrink: 0;
  min-width: 1.7rem;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--teal-10);
  color: var(--accent-strong);
  font-size: var(--fs-80);
  font-weight: 700;
  text-align: center;
}

.combobox-option-number-none {
  background: none;
}

.combobox-divider {
  margin: 0.4rem 0.35rem 0.25rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--teal-16);
  font-size: var(--fs-75);
  color: var(--muted);
}

.combobox-divider:empty {
  padding-top: 0;
}

/* Number chip on the "order in the reception calendar" admin page. */
.rc-number {
  flex-shrink: 0;
  min-width: 2rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm2);
  background: var(--teal-12);
  color: var(--accent-strong);
  font-weight: 700;
  text-align: center;
}

.rc-number-off {
  background: none;
  color: var(--muted);
}

.combobox-option-secondary {
  flex-shrink: 0;
  font-size: var(--fs-78);
  font-weight: 400;
  color: var(--muted);
}

.combobox-option-clear {
  color: var(--muted);
}

.combobox-empty {
  padding: 0.75rem;
  font-size: var(--fs-85);
  color: var(--muted);
  text-align: center;
}

/* ── Reservations filter (templates/partials/reservation_filter_*.html) ──────
   One button replaces the old row of status chips + sort dropdown; it opens a
   popup holding every filter. Built from the site's own pieces — .cal-modal-*
   for the popup, .form-input fields, the shared combobox and Jalali picker. */

.button.secondary.rf-open {
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.4rem 1.05rem 0.4rem 0.9rem;
  background: #fff;
  color: var(--accent-strong);
  /* shadow-as-border ring + a hairline of depth, like the modals */
  box-shadow: 0 0 0 1px rgba(37, 145, 147, 0.2), 0 1px 2px rgba(33, 50, 58, 0.06);
  transition-property: background-color, box-shadow, transform;
  transition-duration: 0.18s;
  transition-timing-function: ease-out;
}

.button.secondary.rf-open:hover {
  background: var(--teal-07);
  box-shadow: 0 0 0 1px rgba(37, 145, 147, 0.32), 0 6px 16px rgba(33, 50, 58, 0.08);
}

.button.secondary.rf-open:active {
  transform: scale(0.96);
  box-shadow: 0 0 0 1px rgba(37, 145, 147, 0.32);
}

.rf-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.3rem;
  height: 1.3rem;
  padding: 0 0.35rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: var(--fs-72);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Active filters, each removable on its own. */
.rf-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0 1rem;
}

.rf-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2rem;
  padding: 0 0.6rem 0 0.85rem;
  border-radius: 2rem;
  background: var(--teal-09);
  box-shadow: inset 0 0 0 1px rgba(37, 145, 147, 0.2);
  color: var(--accent-strong);
  font-size: var(--fs-82);
  font-weight: 600;
  text-decoration: none;
  transition-property: background-color, box-shadow, color;
  transition-duration: 0.15s;
  transition-timing-function: ease-out;
}

/* the chip is 32px tall; extend the hit area to 40px without growing it */
.rf-chip::after {
  content: "";
  position: absolute;
  inset: -0.25rem 0;
}

.rf-chip svg {
  flex-shrink: 0;
  opacity: 0.7;
}

/* hovering signals "this removes it" */
.rf-chip:hover {
  background: rgba(180, 40, 40, 0.07);
  box-shadow: inset 0 0 0 1px rgba(180, 40, 40, 0.28);
  color: var(--danger);
}

.rf-chip:hover svg {
  opacity: 1;
}

.rf-clear {
  padding: 0.5rem 0.3rem;
  color: var(--muted);
  font-size: var(--fs-82);
  text-decoration: underline;
  text-decoration-color: rgba(30, 30, 30, 0.25);
  text-underline-offset: 0.25em;
  transition: color 0.15s ease-out;
}

.rf-clear:hover {
  color: var(--accent-strong);
}

/* The popup */
.cal-modal-box.rf-box {
  /* (compound selector: .cal-modal-box is declared later in this file) */
  /* a little roomier than the default modal: more air between fields, and
     enough width that the dropdowns and the date picker feel comfortable */
  width: min(500px, 100%);
  padding: 1.6rem 1.7rem 1.75rem;
}

.rf-box:focus {
  outline: none;
}

.rf-box .cal-modal-header h3 {
  text-wrap: balance;
}

/* Month/year dropdowns in the Jalali date picker — the shared combobox in a
   compact size that fits the picker's header. */
.jdp-combobox {
  display: inline-block;
  width: auto;
}

.jdp-combobox .combobox-input {
  width: 6.2rem;
  min-height: 2rem;
  height: 2rem;
  padding: 0 0.6rem 0 1.7rem;
  border-radius: var(--radius-sm);
  border-color: var(--teal-18);
  background: var(--teal-05);
  color: var(--accent-strong);
  font-size: var(--fs-85);
  font-weight: 700;
}

.jdp-combobox-year .combobox-input {
  width: 4.7rem;
}

.jdp-combobox .combobox-toggle {
  left: 0.2rem;
  width: 1.5rem;
  height: 1.5rem;
}

.jdp-combobox .combobox-toggle svg {
  width: 12px;
  height: 12px;
}

.rf-box .jdp-input {
  padding-left: 2.6rem;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23259193'%3E%3Cpath fill-rule='evenodd' d='M6 2a1 1 0 011 1v1h6V3a1 1 0 112 0v1h1a2 2 0 012 2v11a2 2 0 01-2 2H4a2 2 0 01-2-2V6a2 2 0 012-2h1V3a1 1 0 011-1zm-2 7v8h12V9H4z' clip-rule='evenodd'/%3E%3C/svg%3E") no-repeat left 0.9rem center / 1.05rem;
}

.rf-box .form-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.35rem;
}

.rf-box .form-actions .button {
  flex: 1;
  min-height: 2.75rem;
}

/* Fields ease in one after another when the popup opens (split into chunks,
   ~50ms apart) — the fade-out on close stays a plain, quick fade. */
.rf-box .form-field,
.rf-box .form-actions {
  opacity: 0;
  transform: translateY(8px);
  transition-property: opacity, transform;
  transition-duration: 0.22s;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.cal-modal-backdrop.open .rf-box .form-field,
.cal-modal-backdrop.open .rf-box .form-actions {
  opacity: 1;
  transform: none;
}

.cal-modal-backdrop.open .rf-box .form-field:nth-child(1) { transition-delay: 70ms; }
.cal-modal-backdrop.open .rf-box .form-field:nth-child(2) { transition-delay: 120ms; }
.cal-modal-backdrop.open .rf-box .form-field:nth-child(3) { transition-delay: 170ms; }
.cal-modal-backdrop.open .rf-box .form-actions { transition-delay: 220ms; }

@media (prefers-reduced-motion: reduce) {
  .rf-box .form-field,
  .rf-box .form-actions {
    transform: none;
    transition-delay: 0s !important;
  }
}

.form-error {
  font-size: var(--fs-82);
  color: var(--danger);
}

.input-error {
  border-color: var(--danger) !important;
}

.form-error-block {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm2);
  background: rgba(180, 40, 40, 0.07);
  border: 1px solid rgba(180, 40, 40, 0.18);
}

.form-notice-block {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm2);
  background: var(--teal-07);
  border: 1px solid var(--teal-18);
  color: var(--text);
  font-size: var(--fs-90);
  line-height: 1.8;
}

/* #58: «پرونده کدام فرزند؟» — one row per child, the whole row is the button */
.child-pick-list {
  display: grid;
  gap: 0.6rem;
}

.child-pick {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.child-pick:hover {
  border-color: rgba(37, 145, 147, 0.35);
  background: var(--teal-04);
}

.child-pick:active {
  transform: scale(0.99);
}

.child-pick:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

.child-pick.is-current {
  border-color: rgba(37, 145, 147, 0.35);
}

.child-pick-avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--teal-10);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: var(--fs-105);
}

.child-pick-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.15rem;
}

.child-pick-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: var(--fs-100);
}

.child-pick-tag {
  padding: 0.05rem 0.5rem;
  border-radius: var(--radius-2xs);
  background: var(--teal-10);
  color: var(--accent-strong);
  font-size: var(--fs-72);
  font-weight: 600;
}

.child-pick-meta {
  color: var(--muted);
  font-size: var(--fs-82);
  line-height: 1.7;
}

.child-pick-chevron {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.form-hint {
  font-size: var(--fs-82);
  color: var(--muted);
  font-weight: 400;
}

.form-hint-error {
  color: #b23a3a;
}

#summary-count {
  font-variant-numeric: tabular-nums;
}

.auth-submit {
  width: 100%;
  min-height: 2.85rem;
  font-size: var(--fs-100);
}

.auth-alt {
  text-align: center;
  font-size: var(--fs-90);
  color: var(--muted);
  margin: 0;
}

.auth-alt a {
  color: var(--accent-strong);
  font-weight: 600;
}

/* Staff password login: a show/hide eye on the visual left of the box
   (the end side in RTL), and the two quiet links under the card's form. */
.password-field {
  position: relative;
}

.password-field .form-input {
  padding-left: 2.9rem;
}

.password-toggle {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0.35rem;
  margin-block: auto;
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 0.55rem;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle:hover {
  color: var(--accent-strong);
  background: var(--teal-07);
}

.password-toggle:focus-visible {
  outline: 2px solid rgba(37, 145, 147, 0.45);
  outline-offset: 1px;
}

.password-toggle .eye-closed,
.password-toggle[aria-pressed="true"] .eye-open {
  display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
  display: block;
}

.password-rules {
  margin: 0.45rem 0 0;
  padding-inline-start: 1.1rem;
  display: grid;
  gap: 0.15rem;
  line-height: 1.7;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: var(--fs-90);
}

.auth-link-muted {
  color: var(--muted);
  text-decoration: none;
}

.auth-link-muted:hover {
  color: var(--accent-strong);
}

.otp-boxes {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  direction: ltr;
}

.otp-box {
  width: 3rem;
  height: 3.4rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(37, 145, 147, 0.2);
  background: white;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--accent-strong);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  caret-color: transparent;
}

.otp-box:focus {
  border-color: rgba(37, 145, 147, 0.5);
  box-shadow: 0 0 0 4px var(--teal-08);
}

.otp-box.error {
  border-color: rgba(180, 40, 40, 0.4);
}

.button-link {
  background: none;
  border: none;
  color: var(--accent-strong);
  font: inherit;
  font-size: var(--fs-90);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.button-link:disabled {
  color: var(--muted);
  cursor: default;
  text-decoration: none;
}

