/* ============================================================
   ErgoKid — חנות: סל קניות, קופה ועמודים משפטיים
   ------------------------------------------------------------
   אותה שפה כמו style.css: rem של האתר (10px ב-1920), פינות
   עגולות גדולות, הצללה עדינה, כחול לפעולות וכתום לפוקוס.
   ============================================================ */

/* hidden תמיד מנצח (גם כשלרכיב יש display משלו) */
.subpage [hidden], .cart [hidden], .cart[hidden], .cart-overlay[hidden] { display: none !important; }

/* ---------- כפתור משני ---------- */
.btn--ghost {
  background: var(--paper);
  color: var(--blue);
  box-shadow: inset 0 0 0 2px var(--blue);
}
.btn--ghost .btn__icon { color: var(--blue); }
.btn--ghost:hover { background: var(--tint-blue); }
.btn:disabled { opacity: .5; cursor: default; }

/* הודעת פרטיות מתחת לטופס יצירת הקשר (חובה בנקודת האיסוף) */
.form__privacy { font-size: max(14px, 1.6rem); text-align: center; opacity: .9; }
.form__privacy a { color: inherit; text-underline-offset: 3px; }

/* ============================================================
   כפתור הסל בהדר
   ============================================================ */
.cart-btn {
  position: relative;
  display: grid; place-items: center;
  width: max(44px, 5.6rem); height: max(44px, 5.6rem);
  margin-inline-start: 2rem;
  padding: 0; border: 0; border-radius: 50%;
  background: var(--paper);
  color: var(--blue);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease;
}
.cart-btn:hover { background: var(--tint-blue); transform: scale(1.05); }
.cart-btn svg { width: 56%; height: 56%; }
.cart-btn__count {
  position: absolute; top: -4px; inset-inline-end: -4px;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px;
  background: var(--orange); color: #fff;
  font-size: 13px; font-weight: 700; line-height: 22px; text-align: center;
  animation: count-pop .35s cubic-bezier(.16, 1, .3, 1);
}
.cart-btn__count[hidden] { display: none; }
@keyframes count-pop { from { scale: .4; } }

/* ============================================================
   פאנל הצד
   ============================================================ */
.cart-open, .cart-open body { overflow: hidden; }

.cart-overlay {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(46, 46, 47, .35);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .4s ease;
}
.cart-overlay.is-open { opacity: 1; }

.cart {
  position: fixed; inset-block: 0; inset-inline-end: 0; z-index: 91;   /* RTL: נפתח משמאל */
  display: flex; flex-direction: column;
  width: min(100%, max(380px, 60rem));
  background: var(--paper) url('../assets/img/deco/pattern.svg') repeat;
  background-size: 32rem 96rem;
  box-shadow: 0 0 60px rgba(46, 46, 47, .2);
  translate: -100% 0;
  transition: translate .45s cubic-bezier(.16, 1, .3, 1);
}
.cart.is-open { translate: 0 0; }

.cart__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(20px, 3.6rem) max(20px, 4rem) max(14px, 2.4rem);
}
.cart__title { font-weight: 700; font-size: max(26px, 4.4rem); line-height: 1.1; }
.cart__close {
  position: relative;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: var(--tint-blue);
  cursor: pointer;
  transition: background-color .2s ease, rotate .3s ease;
}
.cart__close::before, .cart__close::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 18px; height: 2px; margin: -1px 0 0 -9px;
  border-radius: 2px; background: var(--blue);
  rotate: 45deg;
}
.cart__close::after { rotate: -45deg; }
.cart__close:hover { background: #d6e7f1; rotate: 90deg; }

.cart__body {
  flex: 1; overflow-y: auto;
  padding: 0 max(20px, 4rem);
  overscroll-behavior: contain;
}

.cart__empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem;
  height: 100%; min-height: 200px;
  color: var(--gray); text-align: center;
}
.cart__empty svg { width: 64px; height: 64px; color: var(--blue); opacity: .35; }

.cart__list { display: flex; flex-direction: column; gap: max(12px, 1.6rem); padding-bottom: 2rem; }
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "info end" "qty end";
  gap: 1.2rem 1.6rem;
  padding: max(16px, 2.4rem);
  border-radius: max(20px, 2.5rem);
  background: var(--paper);
  box-shadow: var(--shadow);
  animation: item-in .45s cubic-bezier(.16, 1, .3, 1);
}
@keyframes item-in { from { opacity: 0; translate: 0 1rem; } }
.cart-item__info { grid-area: info; display: flex; flex-direction: column; }
.cart-item__name { font-size: max(17px, 2.4rem); line-height: 1.3; }
.cart-item__unit { font-size: max(14px, 1.8rem); color: var(--gray); }
.cart-item__end {
  grid-area: end;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between;
}
.cart-item__total { font-weight: 700; font-size: max(18px, 2.6rem); color: var(--blue); white-space: nowrap; }
.cart-item__remove {
  min-height: 44px; padding: 0 .4rem;
  border: 0; background: none;
  font-size: max(14px, 1.8rem); color: var(--gray);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}
.cart-item__remove:hover { color: var(--red); }

/* בורר כמות: + מימין, − משמאל (RTL) */
.qty {
  grid-area: qty;
  display: inline-flex; align-items: center; align-self: start; justify-self: start;
  border-radius: 999px;
  background: var(--tint-blue);
}
.qty__btn {
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: none; color: var(--blue);
  font-size: 22px; font-weight: 700; line-height: 1;
  cursor: pointer;
  transition: background-color .2s ease;
}
.qty__btn:hover:not(:disabled) { background: #d6e7f1; }
.qty__btn:disabled { opacity: .35; cursor: default; }
.qty__val { min-width: 2.4ch; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

.cart__foot {
  display: flex; flex-direction: column; align-items: stretch; gap: 1.2rem;
  padding: max(16px, 2.4rem) max(20px, 4rem) max(20px, 3.6rem);
  background: var(--paper);
  box-shadow: 0 -10px 30px rgba(46, 46, 47, .06);
}
.cart__free { font-size: max(15px, 2rem); text-align: center; }
.cart__bar { height: 6px; border-radius: 3px; background: var(--tint-blue); overflow: hidden; }
.cart__bar span { display: block; height: 100%; border-radius: 3px; background: var(--green); transition: width .5s ease; }
.cart__sum { display: flex; justify-content: space-between; align-items: baseline; margin: .4rem 0 0; font-weight: 700; }
.cart__sum dd { margin: 0; font-size: max(22px, 3.2rem); color: var(--blue); }
.cart__note { margin-top: -.6rem; font-size: max(14px, 1.8rem); color: var(--gray); }
.cart__cta { width: 100%; min-height: 44px; }
.cart__continue {
  align-self: center;
  min-height: 44px; padding: 0 1rem;
  border: 0; background: none;
  font-size: max(15px, 2rem); color: var(--blue);
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

/* ============================================================
   עמודים פנימיים: הדר ופוטר פשוטים
   ============================================================ */
.subpage { display: flex; flex-direction: column; min-height: 100vh; }
.subpage main { flex: 1; }
.sub-header {
  position: sticky; top: 0; z-index: 40;
  padding-block: max(12px, 1.6rem);
  background: rgba(255, 253, 250, .94);
  box-shadow: 0 6px 24px rgba(46, 46, 47, .08);
  backdrop-filter: blur(8px);
}
.sub-header__inner { display: flex; align-items: center; justify-content: space-between; }
.sub-header__logo img { width: max(90px, 11.1rem); }
.sub-header__back {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: max(16px, 2rem); font-weight: 700; color: var(--blue);
  text-decoration: none;
}
.sub-header__back::before { content: "→"; margin-inline-end: .6rem; transition: translate .2s ease; }
.sub-header__back:hover::before { translate: .3rem 0; }

.site-footer--sub { margin-top: max(60px, 10rem); }
.site-footer--sub .site-footer__inner { flex-direction: column; gap: 2.4rem; }
.site-footer--sub .site-footer__links { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 0 3.2rem; }
.site-footer--sub .site-footer__links a { display: inline-flex; align-items: center; min-height: 44px; }

/* ============================================================
   עמודים משפטיים — טקסט קריא, בלי עיצוב מיוחד
   ============================================================ */
.legal {
  width: min(100rem, 100% - 4rem);
  padding-top: max(40px, 8rem);
  font-size: max(17px, 2rem);
  line-height: 1.7;
}
.legal h1 { margin-bottom: 1.6rem; }
.legal h2 { margin: max(32px, 5rem) 0 1.2rem; font-size: max(22px, 3.2rem); line-height: 1.25; }
.legal h3 { margin: 2.4rem 0 .8rem; font-size: max(18px, 2.4rem); }
.legal p, .legal ul, .legal ol { margin: 0 0 1.2rem; }
.legal ul { padding-inline-start: 2.4rem; list-style: disc; }
.legal ol { padding-inline-start: 2.4rem; }
.legal li + li { margin-top: .6rem; }
.legal a { color: var(--blue); text-underline-offset: 3px; }
.legal__updated { color: var(--gray); }
.legal__toc {
  margin: 3.2rem 0;
  padding: max(20px, 3.2rem) max(20px, 4rem);
  border-radius: max(20px, 3rem);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.legal__toc ol, .legal__toc ul { margin: 0; }
.legal__scroll { overflow-x: auto; margin: 1.6rem 0; }
.legal__scroll:focus-visible { outline-offset: 2px; }
.legal__scroll table { margin: 0; }
.legal table { width: 100%; margin: 1.6rem 0; border-collapse: collapse; background: var(--paper); box-shadow: var(--shadow); border-radius: 1.6rem; overflow: hidden; }
.legal caption { padding-bottom: .8rem; font-weight: 700; text-align: start; }
.legal th, .legal td { padding: 1.2rem 1.6rem; border-bottom: 1px solid rgba(46, 46, 47, .1); text-align: start; vertical-align: top; }
.legal thead th { background: var(--tint-blue); }
.legal [data-biz] { font-weight: 700; }

/* ============================================================
   קופה
   ============================================================ */
.checkout { padding-top: max(36px, 7rem); }
.checkout:focus { outline: none; }
.checkout__title { margin-bottom: max(24px, 5rem); }
.checkout__loading { color: var(--gray); }

.checkout__empty {
  display: flex; flex-direction: column; align-items: center; gap: 2.4rem;
  padding: max(40px, 8rem) 2rem;
  text-align: center;
}
.checkout__empty svg { width: 80px; height: 80px; color: var(--blue); opacity: .35; }

.checkout__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(100%, 56rem);
  gap: max(24px, 6rem);
  align-items: start;
}

.co-form { display: flex; flex-direction: column; gap: max(18px, 3rem); }
.co-form__req { font-size: max(14px, 1.8rem); color: var(--gray); }

.co-box {
  margin: 0; min-width: 0;
  padding: max(20px, 4rem);
  border: 0; border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.co-box[hidden] { display: none; }
.co-box__title {
  float: right; width: 100%;   /* legend בתוך הקופסה (ולא על המסגרת) */
  margin-bottom: max(14px, 2.4rem);
  padding: 0;
  font-weight: 700; font-size: max(20px, 3.2rem); line-height: 1.2;
}
.co-box__title + * { clear: both; }

.co-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: max(14px, 2rem) max(12px, 2rem); }
.co-field { grid-column: span 3; display: flex; flex-direction: column; gap: .6rem; }
.co-field--full { grid-column: 1 / -1; }
.co-field--third { grid-column: span 2; }
.co-field label { font-weight: 700; font-size: max(15px, 2rem); }
.co-field label span[aria-hidden], .check span[aria-hidden], .co-form__req span[aria-hidden] { color: var(--red); }
.co-field input,
.co-field textarea {
  width: 100%;
  min-height: 48px;
  padding: max(10px, 1.4rem) max(14px, 2rem);
  border: 1.5px solid rgba(46, 46, 47, .18);
  border-radius: max(14px, 1.8rem);
  background: #fff;
  font-size: max(16px, 2.2rem);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.co-field input[dir="ltr"] { text-align: right; }
.co-field textarea { resize: vertical; }
.co-field input:hover, .co-field textarea:hover { border-color: rgba(46, 46, 47, .35); }
.co-field input:focus, .co-field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--orange); }
.co-field input::placeholder { color: #7A8588; }
.co-field.is-invalid input { border-color: var(--red); }
.co-field__err:empty { display: none; }
.co-field__err { font-size: max(14px, 1.8rem); color: var(--red); font-weight: 700; }

/* שיטות משלוח — כרטיסי בחירה */
.ship-options { display: flex; flex-direction: column; gap: 1.2rem; }
.ship {
  position: relative;
  display: flex; align-items: center; gap: max(12px, 2rem);
  padding: max(14px, 2rem) max(16px, 2.4rem);
  border: 2px solid rgba(46, 46, 47, .14);
  border-radius: max(16px, 2.5rem);
  background: #fff;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.ship:hover { border-color: rgba(27, 111, 163, .5); }
.ship:has(input:checked) { border-color: var(--blue); background: var(--tint-blue); }
.ship:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--orange); }
.ship input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--blue); }
.ship__body { flex: 1; display: flex; flex-direction: column; }
.ship__label { font-size: max(16px, 2.2rem); }
.ship__note { font-size: max(14px, 1.8rem); color: var(--gray); }
.ship__price { font-weight: 700; color: var(--blue); white-space: nowrap; }

/* תיבות סימון */
.co-consent { display: flex; flex-direction: column; gap: 1.6rem; }
.check { display: flex; align-items: flex-start; gap: 1.2rem; font-size: max(15px, 2rem); line-height: 1.5; cursor: pointer; }
.check input { flex: none; width: 22px; height: 22px; margin: .2em 0 0; accent-color: var(--blue); cursor: pointer; }
.check a { color: var(--blue); }
.check.is-invalid input { outline: 2px solid var(--red); outline-offset: 2px; }
.co-consent__privacy { font-size: max(14px, 1.8rem); color: var(--gray); }
.co-consent__privacy a { color: var(--blue); }

.co-mode-note {
  padding: max(14px, 2rem) max(16px, 2.4rem);
  border-radius: max(16px, 2.5rem);
  background: var(--tint-peach);
  font-size: max(15px, 2rem);
}
.co-mode-note[hidden] { display: none; }
.co-status:empty { display: none; }
.co-status { font-weight: 700; color: var(--red); }
.co-submit { align-self: flex-start; min-height: 44px; }
.co-submit[aria-busy="true"] { opacity: .7; cursor: progress; }

/* סיכום */
/* בקוד הסיכום בא לפני הטופס (סדר ה-Tab בנייד); בדסקטופ הוא בעמודה השמאלית */
.co-form { grid-column: 1; grid-row: 1; }
.co-summary { grid-column: 2; grid-row: 1; position: sticky; top: max(90px, 12rem); }
.co-summary__card {
  display: flex; flex-direction: column; gap: 1.6rem;
  padding: max(22px, 4rem);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.co-summary__title { font-weight: 700; font-size: max(22px, 3.2rem); }
.co-summary__list { display: flex; flex-direction: column; gap: 1rem; }
.co-summary__list li { display: flex; justify-content: space-between; gap: 1.6rem; }
.co-summary__qty { color: var(--gray); white-space: nowrap; }
.co-summary__edit { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-size: max(14px, 1.8rem); color: var(--blue); }
.co-summary__rows { display: flex; flex-direction: column; gap: .8rem; margin: 0; padding-top: 1.6rem; border-top: 1px solid rgba(46, 46, 47, .12); }
.co-summary__rows div { display: flex; justify-content: space-between; }
.co-summary__rows dd { margin: 0; }
.co-summary__total { margin-top: .4rem; font-weight: 700; font-size: max(20px, 2.8rem); }
.co-summary__total dd { color: var(--blue); }
.co-summary__free { font-size: max(15px, 2rem); color: #4d7d32; font-weight: 700; }
.co-summary__secure { display: flex; gap: 1rem; font-size: max(14px, 1.7rem); color: var(--gray); }
.co-summary__secure svg { flex: none; width: 20px; height: 20px; color: var(--green); }

/* תשלום */
.co-pay {
  display: flex; flex-direction: column; gap: 2rem;
  width: min(80rem, 100%); margin-inline: auto;
  padding: max(22px, 5rem);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.co-pay[hidden] { display: none; }
.co-pay__title { font-weight: 700; font-size: max(24px, 4rem); }
.co-test { display: flex; flex-direction: column; gap: 1.6rem; }
.co-test[hidden] { display: none; }
.co-test__badge {
  align-self: flex-start;
  padding: .6rem 1.6rem; border-radius: 999px;
  background: var(--yellow); color: var(--ink);
  font-weight: 700; font-size: max(14px, 1.8rem);
}
.co-test__actions { display: flex; flex-wrap: wrap; gap: 1.6rem; }
.co-iframe iframe { width: 100%; height: 640px; border: 0; border-radius: 2rem; background: #fff; }

/* אישור */
.co-done { display: flex; justify-content: center; }
.co-done[hidden] { display: none; }
.co-done:focus { outline: none; }
.co-done__card {
  display: flex; flex-direction: column; align-items: center; gap: 2rem;
  width: min(72rem, 100%);
  padding: max(28px, 6rem) max(20px, 5rem);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
  animation: reveal-up 1s cubic-bezier(.16, 1, .3, 1);
}
.co-done__icon {
  display: grid; place-items: center;
  width: max(64px, 9rem); height: max(64px, 9rem);
  border-radius: 50%;
  background: var(--green); color: #fff;
  font-size: max(32px, 4.4rem); font-weight: 700;
}
.co-done__number { font-size: max(18px, 2.6rem); }
.co-done .co-summary__list, .co-done .co-summary__rows { align-self: stretch; text-align: start; }

/* ============================================================
   מתחת ל-1100px
   ============================================================ */
@media (max-width: 1099px) {
  /* כאן 1rem = 10px קבוע (כמו בשאר האתר), ולכן הגדלים נקבעים מחדש */
  .cart-btn { margin-inline-start: auto; margin-inline-end: .8rem; }
  .cart { width: min(100%, 440px); }
  .cart__head { padding: 2rem 2rem 1.6rem; }
  .cart__title { font-size: 2.6rem; }
  .cart__body { padding: 0 2rem; }
  .cart-item { padding: 1.6rem; border-radius: 2rem; }
  .cart-item__name { font-size: 1.7rem; }
  .cart-item__unit, .cart-item__remove, .cart__note { font-size: 1.4rem; }
  .cart-item__total { font-size: 1.8rem; }
  .cart__foot { padding: 1.6rem 2rem 2rem; }
  .cart__sum dd { font-size: 2.2rem; }
  .cart__free, .cart__continue { font-size: 1.5rem; }

  .sub-header__logo img { width: 9rem; }
  .sub-header__back { font-size: 1.6rem; }
  .form__privacy { font-size: 1.4rem; }
  .form__privacy { font-size: 1.3rem; }

  .legal { font-size: 1.6rem; }
  .legal h2 { font-size: 2.1rem; }
  .legal h3 { font-size: 1.8rem; }
  .legal__toc { padding: 2rem; border-radius: 2rem; }

  .checkout { padding-top: 3.2rem; }
  .checkout__title { margin-bottom: 2.4rem; }
  .co-form { gap: 1.6rem; }
  .co-form__req, .co-field__err, .co-summary__edit, .co-summary__secure, .co-consent__privacy, .ship__note { font-size: 1.4rem; }
  .co-box { padding: 2rem; }
  .co-box__title { font-size: 2rem; margin-bottom: 1.4rem; }
  .co-field label, .check, .co-mode-note, .co-summary__free { font-size: 1.5rem; }
  .co-field input, .co-field textarea { font-size: 1.6rem; padding: 1rem 1.4rem; border-radius: 1.4rem; }
  .ship { padding: 1.4rem 1.6rem; border-radius: 1.6rem; }
  .ship__label { font-size: 1.6rem; }
  .co-summary__card, .co-pay, .co-done__card { padding: 2.2rem; }
  .co-summary__title { font-size: 2rem; }
  .co-summary__total { font-size: 1.9rem; }
  .co-pay__title { font-size: 2.4rem; }
  .co-done__number { font-size: 1.8rem; }
  .checkout__grid { grid-template-columns: 1fr; }
  .co-form, .co-summary { grid-column: 1; grid-row: auto; }
  .co-summary { position: static; }
  .co-box { border-radius: 3rem; }
  .co-summary__card, .co-pay, .co-done__card { border-radius: 3rem; }
  .co-submit { align-self: stretch; }
  .legal { width: min(72rem, 100% - 3.2rem); }
}
@media (max-width: 599px) {
  .co-field { grid-column: 1 / -1; }
  .co-field--third { grid-column: span 2; }   /* מספר בית, דירה ומיקוד נשארים בשורה אחת */
  .co-iframe iframe { height: 560px; }
  .legal table { font-size: 1.5rem; }
}
