/* =====================================================================
   Kidush Club — ממשקי המערכת
   התחברות, אזור אישי ופאנל ניהול. נטען אחרי theme.css.
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. פס ההתחברות בכותרת
   --------------------------------------------------------------------- */
.authbar { display: flex; align-items: center; gap: var(--s2); }

.authbar__me {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--hair);
  border-radius: var(--r-full);
  transition: border-color var(--t-1), background var(--t-1);
}
.authbar__me:hover { border-color: var(--hair-brass); background: rgba(224,180,92,.06); }

.authbar__avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.authbar__avatar--letter {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brass), var(--brass-glow));
  color: var(--brass-ink);
  font-weight: 800;
  font-size: 14px;
}
.authbar__name {
  font-size: 14px;
  color: var(--cream-2);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.authbar__warn { font-size: 12px; color: var(--warn); }

@media (max-width: 700px) {
  .authbar__name { display: none; }
  .authbar__me { padding: 5px; }
}

/* ---------------------------------------------------------------------
   2. חלון מודאלי
   --------------------------------------------------------------------- */
.kc-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
}
.kc-modal.is-open { display: flex; }

.kc-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 3, .8);
  backdrop-filter: blur(8px);
  animation: kc-fade-up 200ms var(--ease-out);
}

.kc-modal__box {
  position: relative;
  width: min(440px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  padding: var(--s8) var(--s7) var(--s7);
  background: linear-gradient(165deg, var(--night-3), var(--night-0));
  border: 1px solid var(--hair-brass);
  border-radius: var(--r-lg);
  box-shadow: var(--lift-3), var(--halo);
  animation: kc-modal-in 280ms var(--ease-out);
}
.kc-modal__box--sm { width: min(400px, 100%); padding: var(--s7); }

@keyframes kc-modal-in {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.kc-modal__x {
  position: absolute;
  top: var(--s3);
  inset-inline-end: var(--s3);
  width: 38px; height: 38px;
  background: none;
  border: 0;
  color: var(--cream-3);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--r-xs);
  transition: color var(--t-1), background var(--t-1);
}
.kc-modal__x:hover { color: var(--brass-lit); background: rgba(246,239,227,.05); }

.kc-modal__crest {
  width: 54px; height: 54px;
  margin: 0 auto var(--s4);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--brass);
  background: radial-gradient(circle at 50% 30%, rgba(224,180,92,.22), transparent 70%);
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--brass-lit);
  box-shadow: var(--halo);
}

.kc-modal__title { text-align: center; margin: var(--s3) 0 var(--s2); font-size: 27px; }
.kc-modal__sub {
  text-align: center;
  color: var(--cream-2);
  font-size: 14.5px;
  margin-bottom: var(--s6);
  line-height: 1.6;
}
.kc-modal__fine {
  margin-top: var(--s5);
  text-align: center;
  font-size: 12px;
  color: var(--cream-3);
  line-height: 1.6;
}

/* כפתור Google */
.auth-google { justify-content: center; gap: var(--s3); font-weight: 600; }
.auth-google svg { flex-shrink: 0; }

/* מפריד "או" */
.auth-or {
  display: flex;
  align-items: center;
  gap: var(--s4);
  margin: var(--s6) 0;
  color: var(--cream-3);
  font-size: 12.5px;
}
.auth-or::before, .auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--hair);
}

/* שדה הקוד — מעוצב כמו לוח הקוד במייל, כדי שהמעבר יהיה רציף */
.auth-otp {
  text-align: center;
  font-family: "Courier New", Courier, monospace;
  font-size: 30px;
  font-weight: 700;
  color: var(--brass-lit);
  letter-spacing: .3em;
  text-indent: .3em;
  direction: ltr;
  min-height: 62px;
}
.auth-otp::placeholder { color: #4a4033; }

.auth-links { display: flex; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); }

/* תג "אחרון" — מזכיר באיזו שיטה נכנסת בפעם הקודמת */
.auth-last {
  margin-inline-start: auto;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: rgba(224, 180, 92, .16);
  color: var(--brass-lit);
  font-size: 11px;
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   3. פריסת ממשקי המערכת
   --------------------------------------------------------------------- */
.app-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--s7);
}
.app-head h1 { font-size: clamp(30px, 4vw, 46px); }
.app-head p { color: var(--cream-2); font-size: 15px; margin-top: var(--s2); }

.gate {
  max-width: 520px;
  margin: var(--s10) auto;
  text-align: center;
  padding: var(--s9) var(--s6);
  border: 1px solid var(--hair-brass);
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--night-2), var(--night-0));
  box-shadow: var(--lift-2);
}
.gate h2 { margin: var(--s4) 0 var(--s3); }
.gate p { color: var(--cream-2); margin-bottom: var(--s6); }

/* ---------------------------------------------------------------------
   4. כרטיסי סטטיסטיקה
   --------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s7);
}

.stat {
  padding: var(--s5);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, var(--night-2), var(--night-0));
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 500;
  color: var(--brass-lit);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat span { font-size: 13px; color: var(--cream-3); }

/* ---------------------------------------------------------------------
   5. כרטיס הזמנה
   --------------------------------------------------------------------- */
.orders { display: grid; gap: var(--s4); }

.order {
  border: 1px solid var(--hair);
  border-radius: var(--r-lg);
  background: linear-gradient(165deg, var(--night-2), var(--night-0));
  overflow: hidden;
  transition: border-color var(--t-2);
}
.order:hover { border-color: var(--hair-brass); }
.order.is-pending { border-inline-start: 3px solid var(--warn); }
.order.is-confirmed { border-inline-start: 3px solid var(--ok); }
.order.is-cancelled { opacity: .68; }

.order__head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--s5) var(--s6);
  border-bottom: 1px solid var(--hair);
}
.order__no { font-family: var(--font-display); font-size: 21px; color: var(--brass-lit); }
.order__meta { font-size: 13px; color: var(--cream-3); margin-top: 2px; }

.order__body { padding: var(--s5) var(--s6); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.facts dt { font-size: 12px; color: var(--cream-3); margin-bottom: 2px; }
.facts dd { margin: 0; font-size: 15px; font-weight: 500; }

.order__items { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.order__item {
  padding-inline-start: var(--s4);
  border-inline-start: 2px solid var(--hair-brass);
}
.order__item b { display: block; font-size: 14.5px; }
.order__item span { font-size: 13px; color: var(--cream-3); line-height: 1.5; }

.order__foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  justify-content: space-between;
  padding: var(--s4) var(--s6);
  border-top: 1px solid var(--hair);
  font-size: 14px;
  color: var(--cream-2);
}
.order__total b { color: var(--brass-lit); font-size: 18px; font-variant-numeric: tabular-nums; }

.order__note {
  margin: var(--s4) var(--s6) var(--s5);
  padding: var(--s3) var(--s4);
  border: 1px solid rgba(79,164,107,.4);
  background: rgba(79,164,107,.09);
  border-radius: var(--r-sm);
  font-size: 14px;
}

/* ---------------------------------------------------------------------
   5b. סרגל התקדמות ההזמנה
   --------------------------------------------------------------------- */
.stepper {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 var(--s5);
  padding: 0;
}

.stepper__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  font-size: 12.5px;
  color: var(--cream-3);
}

/* הקו שמחבר בין השלבים */
.stepper__item:not(:first-child)::before {
  content: "";
  position: absolute;
  inset-inline-end: 50%;
  top: 6px;
  width: 100%;
  height: 2px;
  background: var(--hair);
}
.stepper__item.is-done:not(:first-child)::before { background: var(--brass); }

.stepper__dot {
  position: relative;
  z-index: 1;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--night-3);
  border: 2px solid var(--hair);
}
.stepper__item.is-done .stepper__dot { background: var(--brass); border-color: var(--brass); }
.stepper__item.is-current .stepper__dot { box-shadow: 0 0 0 4px rgba(224, 180, 92, .2); }
.stepper__item.is-done .stepper__label { color: var(--cream-2); font-weight: 600; }

.stepper--cancelled {
  display: block;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  background: rgba(207, 106, 85, .1);
  border: 1px solid rgba(207, 106, 85, .35);
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

/* ---------------------------------------------------------------------
   5c. צ'יפים לסינון
   --------------------------------------------------------------------- */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-bottom: var(--s5);
}

.filter-chip {
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--hair);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--cream-2);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--t-1), background var(--t-1), color var(--t-1);
}
.filter-chip:hover { border-color: var(--hair-brass); color: var(--cream); }
.filter-chip span { opacity: .6; margin-inline-start: 4px; }
.filter-chip.is-active {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--brass-ink);
  font-weight: 700;
}
.filter-chip.is-active span { opacity: .75; }

/* ---------------------------------------------------------------------
   6. פאנל ניהול
   --------------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: var(--s1);
  border-bottom: 1px solid var(--hair);
  margin-bottom: var(--s7);
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: var(--s4) var(--s5);
  background: none;
  border: 0;
  color: var(--cream-3);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-1);
}
.tab::after {
  content: "";
  position: absolute;
  inset-inline: var(--s4);
  bottom: -1px;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transition: transform var(--t-2);
}
.tab:hover { color: var(--cream-2); }
.tab[aria-selected="true"] { color: var(--brass-lit); }
.tab[aria-selected="true"]::after { transform: scaleX(1); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  margin-bottom: var(--s5);
}
.toolbar .input, .toolbar .select { min-height: 46px; width: auto; min-width: 170px; }
.toolbar__spacer { flex: 1; }

/* רשימת מוצרים לניהול */
.admin-list { display: grid; gap: var(--s3); }

.admin-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: var(--s4);
  align-items: center;
  padding: var(--s3);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
  background: var(--night-2);
  transition: border-color var(--t-1);
}
.admin-row:hover { border-color: var(--hair-brass); }
.admin-row.is-inactive { opacity: .55; }

.admin-row__thumb {
  width: 72px; height: 56px;
  object-fit: cover;
  border-radius: var(--r-xs);
  background: var(--night-0);
}
.admin-row__title { font-weight: 600; font-size: 16px; }
.admin-row__meta { font-size: 13px; color: var(--cream-3); }
.admin-row__actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* עורך מוצר */
.editor { display: grid; gap: var(--s4); }
.editor__grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
.editor__grid .field--full { grid-column: 1 / -1; }

.feature-rows { display: grid; gap: var(--s2); }
.feature-row { display: grid; grid-template-columns: 1fr auto; gap: var(--s2); }

.upload-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-sm);
  border: 1px solid var(--hair);
  background: var(--night-0);
}

@media (max-width: 700px) {
  .editor__grid { grid-template-columns: 1fr; }
  .admin-row { grid-template-columns: 56px 1fr; }
  .admin-row__thumb { width: 56px; height: 46px; }
  .admin-row__actions { grid-column: 1 / -1; }
  .kc-modal__box { padding: var(--s7) var(--s5) var(--s5); }
  .order__head, .order__body, .order__foot { padding-inline: var(--s5); }
}
