/* Mr Barber Theme Blocks — reusable component styles for the theme shell.
 * Used for: toast, modal, empty-state, buttons. Built on tokens.css only. */

/* ─── Buttons (shared by blocks & views) ──────────────────────── */
.mrb-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row-reverse;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--mrb-radius-sm);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-sm);
  font-weight: var(--mrb-font-weight-semibold);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--mrb-transition-fast), border-color var(--mrb-transition-fast), color var(--mrb-transition-fast), box-shadow var(--mrb-transition-fast);
  white-space: nowrap;
}

.mrb-btn--primary {
  background: var(--mrb-brand-accent);
  color: var(--mrb-brand-text-on-accent);
}

.mrb-btn--primary:hover {
  filter: brightness(1.05);
  box-shadow: var(--mrb-shadow-sm);
}

.mrb-btn--danger {
  background: var(--mrb-danger);
  color: #ffffff;
}

.mrb-btn--danger:hover {
  filter: brightness(1.05);
}

.mrb-btn--ghost {
  background: transparent;
  color: var(--mrb-text-secondary);
  border-color: var(--mrb-border);
}

.mrb-btn--ghost:hover {
  background: var(--mrb-surface-hover);
  color: var(--mrb-text-primary);
}

.mrb-btn--link {
  background: transparent;
  color: var(--mrb-brand-accent);
  padding: 0 6px;
  height: auto;
}

.mrb-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ─── Stat cards (SHARED: dashboard + reports) ─────────────────
 * Moved from dashboard.css 2026-08-30 — the stat-card pattern is used by
 * both the dashboard hero and the reports KPI row (§21.2 shared blocks). */
.mrb-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--mrb-gap);
  margin-bottom: var(--mrb-gap-lg);
}

/* Compact modern card (user decision 2026-08-30, refined): icon at the
   inline start, value over a FULL (never truncated) label, tiny sparkline
   at the inline end, and the small VS trend badge directly UNDER the chart
   (justified to the same inline end). */
.mrb-stat-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "icon value spark"
    "icon label spark"
    "icon trend trend";
  align-items: center;
  column-gap: 12px;
  row-gap: 4px;
  padding: 14px 16px;
  background: var(--mrb-surface);
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius);
  box-shadow: var(--mrb-shadow-sm);
  min-width: 0;
}

.mrb-stat-card__top {
  display: contents;
}

.mrb-stat-card__icon {
  grid-area: icon;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--mrb-radius-sm);
  font-size: 1.2rem;
}

.mrb-stat-card__icon--accent { background: var(--mrb-status-confirmed-bg); color: var(--mrb-status-confirmed); }
.mrb-stat-card__icon--warning { background: var(--mrb-status-pending-bg);   color: var(--mrb-status-pending); }
.mrb-stat-card__icon--info    { background: var(--mrb-status-completed-bg); color: var(--mrb-status-completed); }
.mrb-stat-card__icon--danger  { background: var(--mrb-danger-bg);           color: var(--mrb-danger); }

.mrb-stat-card__value {
  grid-area: value;
  font-size: var(--mrb-font-size-lg);
  font-weight: var(--mrb-font-weight-bold);
  color: var(--mrb-text-primary);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mrb-stat-card__label {
  grid-area: label;
  font-size: var(--mrb-font-size-xs);
  color: var(--mrb-text-muted);
  /* The card title is the most important element — it must ALWAYS show in
     full (user decision 2026-08-30). No truncation, wrapping is allowed. */
  overflow-wrap: anywhere;
}

/* ─── Stat card trend badge + sparkline (shared) ──
   Used for: the three dashboard stat cards (VS comparison + ApexCharts line).
   Variants: --up (green), --down (red), --flat (muted). Colors come from
   the shared tokens only. */
.mrb-stat-trend {
  grid-area: trend;
  /* Sits directly under the sparkline, aligned to the same inline end. */
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  white-space: nowrap;
}

.mrb-stat-trend b {
  font-weight: 700;
}

.mrb-stat-trend i,
.mrb-stat-trend em {
  font-style: normal;
  font-weight: 500;
}

.mrb-stat-trend svg {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

.mrb-stat-trend--up {
  color: var(--mrb-success);
  background: color-mix(in srgb, var(--mrb-success) 12%, transparent);
}

.mrb-stat-trend--down {
  color: var(--mrb-danger);
  background: color-mix(in srgb, var(--mrb-danger) 12%, transparent);
}

.mrb-stat-trend--flat {
  color: var(--mrb-text-muted);
  background: var(--mrb-surface-2, var(--mrb-surface-hover));
}

/* Tiny sparkline pinned to the card end. overflow stays visible so the
   compact hover tooltip is never clipped. */
.mrb-stat-spark {
  grid-area: spark;
  width: 64px;
  height: 34px;
}

/* Compact hover value — desktop only (JS disables it on touch). The bubble
   is pinned ABOVE the chart by the JS fixed position; these rules keep it
   tiny so it never covers the line. */
.mrb-stat-spark .apexcharts-tooltip {
  font-size: 0.62rem;
  padding: 0;
  border-radius: 5px;
  box-shadow: var(--mrb-shadow-sm);
}

.mrb-stat-spark .apexcharts-tooltip-title {
  padding: 1px 5px;
  margin: 0;
  font-size: 0.58rem;
}

.mrb-stat-spark .apexcharts-tooltip-series-group {
  padding: 1px 5px;
}

.mrb-stat-spark .apexcharts-tooltip-marker {
  display: none;
}

/* Very narrow screens: shrink icon + chart so the row still fits. */
@media (max-width: 480px) {
  .mrb-stat-card {
    padding: 12px 14px;
    column-gap: 10px;
  }

  .mrb-stat-card__icon {
    width: 40px;
    height: 40px;
  }

  .mrb-stat-spark {
    width: 54px;
    height: 30px;
  }
}

/* ─── Filters panel + custom selects (SHARED: bookings + reports) ──
 * Moved from bookings.css 2026-08-30: the slide-in filters panel and the
 * .mrb-cctrl custom dropdown are used by both views (§21.2 shared blocks).
 * Classes: .mrb-filters-panel* / .mrb-cctrl* / .mrb-bookings-filters__*. */
.mrb-filters-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  visibility: hidden;
}

.mrb-filters-panel.is-open {
  pointer-events: auto;
  visibility: visible;
}

.mrb-filters-panel__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity var(--mrb-transition);
}

.mrb-filters-panel.is-open .mrb-filters-panel__backdrop {
  opacity: 1;
}

.mrb-filters-panel__sheet {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 360px;
  max-width: 92vw;
  display: flex;
  flex-direction: column;
  background: var(--mrb-surface);
  border-inline-start: 1px solid var(--mrb-border);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  transform: translateX(100%);
  transition: transform var(--mrb-transition);
}

[dir="ltr"] .mrb-filters-panel__sheet {
  right: 0;
  transform: translateX(100%);
}

[dir="rtl"] .mrb-filters-panel__sheet {
  left: 0;
  transform: translateX(-100%);
}

.mrb-filters-panel.is-open .mrb-filters-panel__sheet {
  transform: translateX(0);
}

.mrb-filters-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--mrb-gap);
  border-bottom: 1px solid var(--mrb-border);
}

.mrb-filters-panel__title {
  font-size: var(--mrb-font-size-md);
  font-weight: var(--mrb-font-weight-semibold);
  color: var(--mrb-text-primary);
}

.mrb-filters-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--mrb-gap);
}

.mrb-filters-panel__foot {
  display: flex;
  gap: var(--mrb-gap-sm);
  padding: var(--mrb-gap);
  border-top: 1px solid var(--mrb-border);
}

.mrb-filters-panel__foot .mrb-btn {
  flex: 1;
}

.mrb-bookings-filters__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-block: 10px;
  border-bottom: 1px solid var(--mrb-border);
}

.mrb-bookings-filters__group:last-child {
  border-bottom: 0;
}

.mrb-bookings-filters__label {
  font-size: var(--mrb-font-size-xs);
  font-weight: var(--mrb-font-weight-semibold);
  color: var(--mrb-text-muted);
}

.mrb-bookings-filters__custom-dates {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.mrb-bookings-filters__custom-dates[hidden] {
  display: none !important;
}

.mrb-bookings-filters__custom-dates input[type="date"] {
  display: none !important;
}

.mrb-cctrl {
  position: relative;
}

.mrb-cctrl__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius-sm);
  background: var(--mrb-surface);
  color: var(--mrb-text-primary);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-sm);
  cursor: pointer;
  text-align: start;
  transition: border-color var(--mrb-transition-fast);
}

.mrb-cctrl__btn:hover {
  border-color: var(--mrb-border-strong);
}

.mrb-cctrl__value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mrb-cctrl__leading {
  color: var(--mrb-text-muted);
  flex-shrink: 0;
}

.mrb-cctrl__caret {
  color: var(--mrb-text-faint);
  flex-shrink: 0;
  transition: transform var(--mrb-transition-fast);
}

.mrb-cctrl.is-open .mrb-cctrl__caret {
  transform: rotate(180deg);
}

.mrb-cctrl__pop {
  position: absolute;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  min-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: var(--mrb-surface);
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 90;
}

.mrb-cctrl.is-open .mrb-cctrl__pop {
  display: flex;
}

.mrb-cctrl__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: none;
  border-radius: var(--mrb-radius-sm);
  background: transparent;
  color: var(--mrb-text-secondary);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-sm);
  cursor: pointer;
  white-space: nowrap;
  text-align: start;
  transition: background var(--mrb-transition-fast), color var(--mrb-transition-fast);
}

.mrb-cctrl__item:hover {
  background: var(--mrb-surface-hover);
  color: var(--mrb-text-primary);
}

.mrb-cctrl__item.is-selected {
  background: color-mix(in srgb, var(--mrb-brand-accent) 12%, transparent);
  color: var(--mrb-text-primary);
  font-weight: var(--mrb-font-weight-medium);
}

.mrb-cctrl__item-icon {
  color: var(--mrb-text-muted);
  flex-shrink: 0;
}

.mrb-cctrl__barber-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--mrb-primary-bg, var(--mrb-surface));
  color: var(--mrb-primary, #6366f1);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  line-height: 1;
}

.mrb-cctrl__avatar {
  display: inline-flex;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}

.mrb-cctrl__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mrb-bookings-filters__custom-dates {
  position: relative;
}

/* ─── Filters toggle + daycount badge (SHARED: bookings + reports) ──
 * Toggle: inline-flex chip; on phones it becomes icon-only (38x38) with the
 * active-filters badge as a positioned circle (same as bookings §13.11.7). */
.mrb-filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mrb-daycount-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--mrb-radius-pill);
  background: var(--mrb-brand-accent);
  color: var(--mrb-brand-text-on-accent);
  font-size: var(--mrb-font-size-xs);
  font-weight: var(--mrb-font-weight-semibold);
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 1023px) {
  .mrb-filters-toggle {
    position: relative;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
  }

  .mrb-filters-toggle .mrb-badge {
    position: absolute;
    top: -2px;
    inset-inline-end: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    font-size: 10px;
    line-height: 18px;
  }

  .mrb-filters-toggle__label {
    display: none;
  }
}

/* Dropdown option title + hint (icon+title+description per choice) and the
   single-date field wrapper. Shared: team roles, prayer city/method, barber
   vacations, and any future .mrb-pref-dd consumer. */
.mrb-cctrl__item-title {
  display: block;
  font-weight: 600;
  line-height: 1.4;
}

.mrb-cctrl__item-hint {
  display: block;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--mrb-text-muted);
}

.mrb-cdate-field {
  position: relative;
  display: block;
  width: 100%;
}

/* Shared table scroller: on narrow screens tables keep their column widths and
   scroll horizontally instead of being squeezed (same rule used by the
   bookings table — now inherited by team, blocked clients, reviews…). */
.mrb-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── Custom date range (SHARED: bookings + reports) ───────────
 * From/To trigger buttons + the calendar popover (day grid + months grid).
 * Moved from bookings.css 2026-08-30 — the reports filters panel reuses the
 * exact same calendar UI. Classes: .mrb-cdate* / .mrb-calendar*. */
.mrb-cdate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  flex: 1;
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius-sm);
  background: var(--mrb-surface);
  color: var(--mrb-text-primary);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-sm);
  cursor: pointer;
  text-align: start;
  transition: border-color var(--mrb-transition-fast);
}

.mrb-cdate:hover {
  border-color: var(--mrb-border-strong);
}

.mrb-cdate--wide {
  width: 100%;
}

.mrb-cdate__icon {
  color: var(--mrb-text-muted);
  flex-shrink: 0;
}

.mrb-cdate--placeholder {
  color: var(--mrb-text-faint);
}

.mrb-calendar {
  position: absolute;
  z-index: 95;
  inset-inline-start: 0;
  top: calc(100% + 6px);
  width: 280px;
  max-width: 100%;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--mrb-surface);
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.mrb-calendar.is-open {
  display: flex;
}

.mrb-calendar__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mrb-calendar__title {
  flex: 1;
  border: none;
  background: transparent;
  padding: 4px 8px;
  border-radius: var(--mrb-radius-sm);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-sm);
  font-weight: var(--mrb-font-weight-semibold);
  color: var(--mrb-text-primary);
  cursor: pointer;
  transition: background var(--mrb-transition-fast);
}

.mrb-calendar__title:hover {
  background: var(--mrb-surface-hover);
}

.mrb-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mrb-calendar__dow {
  text-align: center;
  font-size: var(--mrb-font-size-xs);
  color: var(--mrb-text-muted);
  padding: 4px 0;
}

.mrb-calendar__day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: none;
  border-radius: var(--mrb-radius-sm);
  background: transparent;
  color: var(--mrb-text-primary);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-xs);
  cursor: pointer;
  transition: background var(--mrb-transition-fast);
}

.mrb-calendar__day:hover {
  background: var(--mrb-surface-hover);
}

.mrb-calendar__day.is-selected {
  background: var(--mrb-brand-accent);
  color: var(--mrb-brand-text-on-accent);
  font-weight: var(--mrb-font-weight-semibold);
}

.mrb-calendar__day.is-between {
  background: color-mix(in srgb, var(--mrb-brand-accent) 14%, transparent);
}

.mrb-calendar__day.is-today {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  font-weight: var(--mrb-font-weight-semibold);
}

.mrb-calendar__day.is-future {
  color: var(--mrb-text-muted);
  opacity: 0.35;
  cursor: not-allowed;
}

.mrb-calendar__grid--months {
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.mrb-calendar__month {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border: none;
  border-radius: var(--mrb-radius-sm);
  background: transparent;
  color: var(--mrb-text-primary);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-xs);
  cursor: pointer;
  transition: background var(--mrb-transition-fast);
}

.mrb-calendar__month:hover {
  background: var(--mrb-surface-hover);
}

/* ─── الهاتف: القوائم المنطقية دائماً داخل الإطار (2026-11-06) ───
 * بلاغ المالك: في الهاتف كانت بطاقة اختيار التاريخ والقوائم المنبثقة
 * (أوقات العمل، إلغاء الحجز، وغيرها) تخرج خارج الإطار وتكسر التخطيط.
 * في الهاتف فقط: تُثبت وسط الشاشة بعرض آمن بدل الربط بحافة الحقل.
 * الحاسوب يبقى على السلوك الأصلي كما هو. */
@media (max-width: 640px) {
  .mrb-calendar,
  .mrb-cctrl__pop {
    position: fixed;
    inset: auto;
    left: 50%;
    transform: translateX(-50%);
    top: 50%;
    max-width: min(94vw, 340px);
    width: auto;
  }

  .mrb-cctrl__pop {
    min-width: 0;
    width: min(94vw, 340px);
  }

  .mrb-calendar {
    width: min(94vw, 340px);
  }
}

/* ─── حجوزات اليوم التي مضت: شفافية فقط، دون تعطيل النقر أو فلاتر ─── */
.mrb-bookings-view .mrb-mcard.is-past-booking,
.mrb-bookings-view tr.is-past-booking {
  opacity: 0.55;
}

.mrb-bookings-view [data-mrb-timeline] .is-past-booking {
  opacity: 0.45;
}

/* ─── شريط «الحجز القادم» في صفحة الحجوزات (هاتف فقط) ───────── */
.mrb-bookings-nextbar {
  display: none;
}

@media (max-width: 1023px) {
  .mrb-bookings-nextbar {
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: calc(var(--mrb-header-height, 56px) + env(safe-area-inset-top, 0px));
    z-index: 40;
    margin: 0 0 var(--mrb-gap);
    padding: 10px var(--mrb-gap);
    background: var(--mrb-surface);
    border-bottom: 1px solid var(--mrb-border);
    font-family: var(--mrb-font-family);
    font-size: var(--mrb-font-size-sm);
    font-weight: 600;
    color: var(--mrb-text-primary);
  }

  .mrb-bookings-nextbar .mrb-icon {
    color: var(--mrb-brand-accent);
    flex-shrink: 0;
  }

  .mrb-bookings-nextbar.is-empty {
    color: var(--mrb-text-muted);
    font-weight: 500;
  }

  /* وقت الخدمة في بطاقة الهاتف أكبر وأبرز (بلاغ المالك: يُقرأ قبل فتح التفاصيل). */
  .mrb-mcard__time {
    font-size: 15px;
    font-weight: 700;
  }
}

/* ─── Toast ──────────────────────────────────────────────────── */
.mrb-toast {
  position: fixed;
  top: calc(var(--mrb-header-height) + 12px);
  /* Physical left so translateX(-50%) stays centered in RTL too —
     inset-inline-start resolves to `right` in RTL and pushed the toast
     off-screen left (the recurring "toast appears outside the frame" bug). */
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  background: var(--mrb-surface);
  border: 1px solid var(--mrb-border);
  border-inline-start: 4px solid var(--mrb-info);
  border-radius: var(--mrb-radius);
  box-shadow: var(--mrb-shadow-lg);
  z-index: 90;
  opacity: 0;
  transition: transform var(--mrb-transition-slow), opacity var(--mrb-transition);
}

.mrb-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.mrb-toast--success { border-inline-start-color: var(--mrb-success); }
.mrb-toast--error   { border-inline-start-color: var(--mrb-danger); }
.mrb-toast--warning { border-inline-start-color: var(--mrb-warning); }

.mrb-toast__icon {
  font-size: 1.15rem;
  color: var(--mrb-text-muted);
  flex-shrink: 0;
}

.mrb-toast--success .mrb-toast__icon { color: var(--mrb-success); }
.mrb-toast--error .mrb-toast__icon   { color: var(--mrb-danger); }
.mrb-toast--warning .mrb-toast__icon { color: var(--mrb-warning); }

.mrb-toast__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.mrb-toast__title {
  font-weight: var(--mrb-font-weight-semibold);
  font-size: var(--mrb-font-size-sm);
  color: var(--mrb-text-primary);
}

.mrb-toast__message {
  font-size: var(--mrb-font-size-xs);
  color: var(--mrb-text-muted);
}

.mrb-toast__close {
  background: none;
  border: none;
  color: var(--mrb-text-faint);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.mrb-toast__close:hover {
  color: var(--mrb-text-primary);
}

/* Mr Barber Toast responsive — used for desktop (bigger toast) and mobile
   (stays inside the frame, never hidden behind the bottom bar). */
@media (min-width: 769px) {
  .mrb-toast {
    max-width: min(480px, calc(100vw - 48px));
    padding: 14px 20px;
    gap: 14px;
  }

  .mrb-toast__title {
    font-size: var(--mrb-font-size-md);
  }

  .mrb-toast__message {
    font-size: var(--mrb-font-size-sm);
  }
}

@media (max-width: 1023px) {
  .mrb-toast {
    top: calc(var(--mrb-header-height) + 8px);
    max-width: calc(100vw - 20px);
  }
}

/* ─── Modal ──────────────────────────────────────────────────── */
.mrb-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--mrb-gap);
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--mrb-transition), visibility var(--mrb-transition);
}

.mrb-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.mrb-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--mrb-overlay);
}

.mrb-modal__dialog {
  position: relative;
  width: 100%;
  background: var(--mrb-surface);
  border-radius: var(--mrb-radius);
  box-shadow: var(--mrb-shadow-lg);
  transform: translateY(12px) scale(0.98);
  transition: transform var(--mrb-transition-slow);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mrb-modal.is-open .mrb-modal__dialog {
  transform: translateY(0) scale(1);
}

.mrb-modal__dialog--sm { max-width: 380px; }
.mrb-modal__dialog--md { max-width: 560px; }
.mrb-modal__dialog--lg { max-width: 820px; }

.mrb-modal__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px var(--mrb-gap);
  border-bottom: 1px solid var(--mrb-border);
  flex-shrink: 0;
}

.mrb-modal__icon {
  color: var(--mrb-brand-accent);
  font-size: 1.1rem;
}

.mrb-modal__title {
  flex: 1;
  margin: 0;
  font-size: var(--mrb-font-size-lg);
  font-weight: var(--mrb-font-weight-bold);
  color: var(--mrb-text-primary);
}

.mrb-modal__close {
  background: none;
  border: none;
  color: var(--mrb-text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--mrb-radius-sm);
}

.mrb-modal__close:hover {
  background: var(--mrb-surface-hover);
  color: var(--mrb-text-primary);
}

.mrb-modal__body {
  padding: var(--mrb-gap);
  overflow-y: auto;
  color: var(--mrb-text-secondary);
  font-size: var(--mrb-font-size-sm);
}

.mrb-modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px var(--mrb-gap);
  border-top: 1px solid var(--mrb-border);
  flex-shrink: 0;
}

/* ─── Confirm modal — custom replacement for window.confirm ────
 * Large centered icon + description text + styled action buttons.
 * Used by performAction (cancel/no-show) and phone call confirm.
 * Variants: mrb-btn--danger (destructive), mrb-btn--primary (phone). */
.mrb-confirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px var(--mrb-gap) 16px;
  gap: 12px;
}

.mrb-confirm-body__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mrb-danger);
  flex-shrink: 0;
}

.mrb-confirm-body__icon svg {
  width: 48px;
  height: 48px;
}

.mrb-confirm-body__icon--phone {
  color: var(--mrb-brand-accent);
}

.mrb-confirm-body__text {
  font-size: var(--mrb-font-size-sm);
  color: var(--mrb-text-secondary);
  line-height: 1.6;
  max-width: 320px;
  margin: 0;
}

/* Override ghost button default color so cancel is always readable. */
.mrb-confirm-modal .mrb-btn--ghost {
  color: var(--mrb-text-secondary);
  border-color: var(--mrb-border);
}

/* Ensure the danger/primary action button text is always visible —
 * fixes invisible text until hover caused by specificity issues. */
.mrb-confirm-modal .mrb-btn--danger,
.mrb-confirm-modal .mrb-btn--primary {
  color: #fff !important;
}

/* ─── View switch (shared across views) ─────────────────────── */
.mrb-view-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--mrb-surface-2, var(--mrb-surface-hover));
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius-pill);
}

.mrb-view-switch__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: var(--mrb-radius-pill);
  color: var(--mrb-text-secondary);
  transition: background var(--mrb-transition-fast), color var(--mrb-transition-fast);
}

.mrb-view-switch__btn:hover {
  color: var(--mrb-text-primary);
}

.mrb-view-switch__btn.is-active {
  background: var(--mrb-brand-accent);
  color: var(--mrb-brand-text-on-accent);
}

/* ─── Page head (shared across all views) ───────────────────── */
.mrb-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mrb-gap);
  margin-bottom: var(--mrb-gap);
  flex-wrap: wrap;
}

.mrb-page-head__title {
  margin: 0 0 4px;
  font-size: var(--mrb-font-size-2xl);
  font-weight: var(--mrb-font-weight-bold);
  color: var(--mrb-text-primary);
}

.mrb-page-head__subtitle {
  margin: 0;
  font-size: var(--mrb-font-size-sm);
  color: var(--mrb-text-muted);
}

/* ─── LTR directional arrow flip (shared, moved from bookings.css §21.2) ──
 * SVG arrows are drawn for RTL; in LTR flip ONLY the directional arrows so
 * back→left / forward→right. Symmetric icons (check, clock, scissors…)
 * must NOT be flipped or they appear mirrored. Lives in blocks.css so
 * every view (settings, auth, bookings…) flips consistently. */
[dir="ltr"] .mrb-icon--arrow-left svg,
[dir="ltr"] .mrb-icon--arrow-right svg,
[dir="ltr"] .mrb-icon--chevron-down svg,
[dir="ltr"] .mrb-icon--chevron-up svg,
[dir="ltr"] .mrb-icon--send svg,
[dir="ltr"] .mrb-icon--share svg,
[dir="ltr"] .mrb-icon--route svg {
  transform: scaleX(-1);
}

/* ─── Empty state ────────────────────────────────────────────── */
.mrb-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  gap: 8px;
}

.mrb-empty-state__icon {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--mrb-surface-2);
  color: var(--mrb-text-faint);
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.mrb-empty-state__title {
  margin: 0;
  font-size: var(--mrb-font-size-lg);
  font-weight: var(--mrb-font-weight-semibold);
  color: var(--mrb-text-primary);
}

.mrb-empty-state__message {
  margin: 0;
  font-size: var(--mrb-font-size-sm);
  color: var(--mrb-text-muted);
  max-width: 360px;
}

.mrb-empty-state__action {
  margin-top: 12px;
}

/* Mr Barber Stripe card field — shared by wallet top-up, saved cards and the
   booking wizard checkout. Holds Stripe's hosted Element (an iframe), so the
   theme's input styles cannot reach inside it; this block styles the HOST node
   to mirror .mrb-field__control. Variants: none. */
.mrb-stripe-card {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius-sm);
  background: var(--mrb-bg);
  transition: border-color var(--mrb-transition-fast), box-shadow var(--mrb-transition-fast);
}

.mrb-stripe-card:focus-within {
  border-color: var(--mrb-brand-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mrb-brand-accent) 18%, transparent);
}

.mrb-stripe-card__loading {
  display: block;
  font-size: var(--mrb-font-size-sm);
  color: var(--mrb-text-faint);
}

/* The generic Stripe error text (invalid number, declined card) renders here.
   Scoped to the host node so it inherits the theme's danger color instead of
   Stripe's default red. */
.mrb-stripe-card .StripeElement--invalid {
  color: var(--mrb-danger);
}

/* ─── Toggle switch (SHARED) ─────────────────────────────────────────
   One switch primitive for every "yes/no" the customer decides: the manager
   "work as a barber" control, saving the card on wallet top-up, saving the
   card at booking checkout. Lives here (not in one view) because the booking
   templates load tokens + blocks + their own view only — a view-scoped copy
   left the switch invisible on /booking. Variants: none. */
.mrb-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  flex: 0 0 auto;
}

.mrb-toggle__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.mrb-toggle__track {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 36px;
  background: var(--mrb-border, #cbd5e1);
  border-radius: 999px;
  transition: background 0.18s ease;
}

.mrb-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}

.mrb-toggle__input:checked + .mrb-toggle__track {
  background: var(--mrb-brand-accent, #c5a47e);
}

.mrb-toggle__input:checked + .mrb-toggle__track .mrb-toggle__thumb {
  transform: translateX(16px);
}

.mrb-toggle__input:focus-visible + .mrb-toggle__track {
  outline: 2px solid var(--mrb-brand-accent, #c5a47e);
  outline-offset: 2px;
}

/* Mr Barber shared form fields — moved here (2026-10-31) from profile.css so
   every view (reviews drawer, client rating popup, filters sheets) gets the
   SAME input/textarea design without loading the profile stylesheet.
   Variants: .mrb-field__control--textarea. */
.mrb-field {
  margin-bottom: var(--mrb-gap);
}

.mrb-field:last-child {
  margin-bottom: 0;
}

.mrb-field__label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--mrb-font-size-sm);
  font-weight: var(--mrb-font-weight-medium);
  color: var(--mrb-text-primary);
}

.mrb-field__control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--mrb-border);
  border-radius: var(--mrb-radius-sm);
  background: var(--mrb-bg);
  color: var(--mrb-text-primary);
  font-family: var(--mrb-font-family);
  font-size: var(--mrb-font-size-sm);
  transition: border-color var(--mrb-transition-fast), box-shadow var(--mrb-transition-fast);
}

.mrb-field__control:focus {
  outline: none;
  border-color: var(--mrb-brand-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mrb-brand-accent) 18%, transparent);
}

.mrb-field__control::placeholder {
  color: var(--mrb-text-faint);
}

.mrb-field__control--textarea,
textarea.mrb-field__control {
  height: auto;
  min-height: 112px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.9;
}

.mrb-field__desc {
  /* Comfortable gap under the control; the field itself keeps its own
     bottom rhythm, so every settings screen spaces descriptions identically. */
  margin: 8px 0 0;
  font-size: var(--mrb-font-size-xs);
  line-height: 1.6;
  color: var(--mrb-text-muted);
}

/* Thin scrollbar in the salon's accent color (owner 2026-11-01). */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--mrb-scroll-accent, var(--mrb-brand-accent)) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--mrb-scroll-accent, var(--mrb-brand-accent));
  border-radius: 999px;
}

/* Author display rules (flex/grid) must never defeat the hidden attribute. */
[hidden] {
  display: none !important;
}
