/*
 * AeroBook Jalali date picker (0.6.55) — styles for assets/js/aerobook-jalali-picker.js.
 *
 * RTL first (the week starts on Saturday at the RIGHT edge), logical layout,
 * >= 44px touch targets on phones where it becomes a bottom sheet, keyboard
 * focus rings, reduced-motion respected. Colors come from the plugin's
 * design tokens (aerobook-tokens.css) with literal fallbacks so the picker
 * still looks right on any page that loads it without them.
 */

.aero-jdp {
  position: fixed;
  z-index: 1080;
  width: 304px;
  max-width: calc(100vw - 16px);
  padding: 12px;
  border: 1px solid var(--aero-brand-100, #E7E4FB);
  border-radius: 16px;
  background: #fff;
  color: #1f2937;
  box-shadow: 0 16px 40px rgba(16, 24, 40, .18);
  font-family: var(--aero-font, inherit);
  font-size: 1rem;
  line-height: 1.4;
  direction: rtl;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.aero-jdp[hidden],
.aero-jdp-backdrop[hidden] {
  display: none;
}

.aero-jdp *,
.aero-jdp *::before,
.aero-jdp *::after {
  box-sizing: border-box;
}

.aero-jdp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1079;
  background: rgba(15, 23, 42, .45);
}

/* --- Header: prev / month + year selects / next ------------------------ */

.aero-jdp__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.aero-jdp__selects {
  display: flex;
  flex: 1 1 auto;
  gap: 6px;
  min-width: 0;
}

.aero-jdp__select {
  flex: 1 1 0;
  min-width: 0;
  height: 36px;
  padding: 0 6px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background-color: #fff;
  color: inherit;
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.aero-jdp__nav {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--aero-brand-700, #26179C);
  cursor: pointer;
}

.aero-jdp__nav:hover:not(:disabled) {
  background: var(--aero-brand-50, #F3F2FD);
}

.aero-jdp__nav:disabled {
  opacity: .3;
  cursor: default;
}

/* --- Weekday header + day grid ----------------------------------------- */

.aero-jdp__weekdays,
.aero-jdp__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 2px;
}

.aero-jdp__weekday {
  padding: 4px 0;
  color: #6b7280;
  font-size: .78rem;
  font-weight: 600;
  cursor: default;
}

.aero-jdp__weekday.is-friday {
  color: #d92d20;
}

.aero-jdp__gap {
  display: block;
}

.aero-jdp__day {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: .92rem;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}

.aero-jdp__day:hover:not(:disabled) {
  background: var(--aero-brand-50, #F3F2FD);
}

.aero-jdp__day.is-friday {
  color: #d92d20;
}

.aero-jdp__day.is-today {
  box-shadow: inset 0 0 0 1.5px var(--aero-brand, #6C5CE7);
}

.aero-jdp__day.is-selected {
  background: var(--aero-brand, #6C5CE7);
  color: var(--aero-brand-contrast, #fff);
  box-shadow: none;
  font-weight: 700;
}

.aero-jdp__day:disabled {
  opacity: .28;
  cursor: not-allowed;
}

/* --- Footer ------------------------------------------------------------- */

.aero-jdp__foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #f0f0f5;
}

.aero-jdp__link {
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--aero-brand-700, #26179C);
  font: inherit;
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
}

.aero-jdp__link:hover:not(:disabled) {
  background: var(--aero-brand-50, #F3F2FD);
}

.aero-jdp__link:disabled {
  opacity: .35;
  cursor: default;
}

.aero-jdp__link[hidden] {
  display: none;
}

/* --- Keyboard focus ------------------------------------------------------ */

.aero-jdp__day:focus-visible,
.aero-jdp__nav:focus-visible,
.aero-jdp__select:focus-visible,
.aero-jdp__link:focus-visible {
  outline: 2px solid var(--aero-brand, #6C5CE7);
  outline-offset: 2px;
}

/* --- Phones: a bottom sheet with a backdrop and bigger targets ---------- */

@media (max-width: 575.98px) {
  .aero-jdp {
    inset: auto 0 0 0 !important;
    width: auto;
    max-width: none;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    border-radius: 20px 20px 0 0;
  }

  .aero-jdp__select,
  .aero-jdp__nav {
    height: 44px;
  }

  .aero-jdp__nav {
    flex-basis: 44px;
    width: 44px;
  }

  .aero-jdp__day {
    min-height: 44px;
    font-size: 1rem;
  }

  .aero-jdp__link {
    padding: 10px 14px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .aero-jdp {
    animation: aero-jdp-in .14s ease-out;
  }

  @keyframes aero-jdp-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
  }
}
