/* ──────────────────────────────────────────────────────────────
   base.css — צבעים, כפתורים, טפסים, כרטיסים, חלונות, הודעות, אנימציות.
   משותף לדף הבית, ללוח ולדפי המשפט.
   הפלטה (v3): ירוק חם ובהיר כמו באתר המקורי, עם צהוב-ענבר, קורל, כחול וסגול
   כצבעי עזר. הצבעים של כל קבוצה מחליפים את --c-* בלוח (lib/widgets.js).
   הנימוקים לכל בחירה: docs/DECISIONS.md, D32–D36.
   ────────────────────────────────────────────────────────────── */
:root {
  --c-primary: #16834b;      /* הירוק של המקור (#1a9e5c), כהה בחצי גוון כדי שטקסט לבן עליו יהיה קריא (4.8:1) */
  --c-secondary: #f2a93b;    /* ענבר חם: רק לקישוט (פסים, נקודות), אף פעם לא כצבע טקסט */
  --c-bg: #f4f8f1;
  --c-accent: #dff2e5;
  --c-surface: #ffffff;
  --c-border: #cfe0d3;
  --c-text: #1c2b22;
  --c-muted: #56705f;
  --c-leaf: #1a9e5c;         /* הירוק המקורי, למילויים בלי טקסט (פס התקדמות, נקודות) */
  --c-sun: #ffc93c;
  --c-mint: #1a9e5c;
  --c-sky: #3b82f6;
  --c-grape: #7c5cd6;
  --c-coral: #ef6f5c;
  --c-danger: #d63a3a;
  --c-warn: #e08a00;
  --c-ink: #1c2b22;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 2px 10px rgba(28, 43, 34, 0.07);
  --shadow-lg: 0 14px 40px rgba(28, 43, 34, 0.18);
  --ease: cubic-bezier(.22, .8, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 150ms;
  --t-med: 240ms;
  --font: 'Heebo', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  --font-display: 'Secular One', 'Heebo', 'Segoe UI', 'Arial Hebrew', Arial, sans-serif;
  --tap: 46px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* הרקע: נקודות עדינות כמו משטח בנייה. לא גרדיאנט, לא "זוהר". */
body { margin: 0; font-family: var(--font); background: var(--c-bg) radial-gradient(var(--c-border) 1.2px, transparent 1.4px) 0 0 / 22px 22px; color: var(--c-text); direction: rtl; min-height: 100vh; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-primary); }
:focus-visible { outline: 3px solid var(--c-sun); outline-offset: 2px; border-radius: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
/* כותרות וגדלים בולטים: גופן תצוגה עם אופי (Secular One, משקל אחד) */
.display, h1, .brand, .modal-header h3, .card-header h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: .01em; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ── אייקונים (SVG inline) ── */
.i { width: 1.15em; height: 1.15em; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; display: inline-block; }
.i-lg { width: 1.6em; height: 1.6em; }
.logo-mark { display: inline-block; flex-shrink: 0; user-select: none; }

/* ── כפתורים ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--tap); padding: 10px 20px; border-radius: 999px; border: 2px solid transparent;
  background: var(--c-primary); color: #fff; font-weight: 800; font-size: 0.96rem; text-decoration: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.16);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast), filter var(--t-fast);
  -webkit-tap-highlight-color: transparent; user-select: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 5px 0 rgba(0, 0, 0, 0.16); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }
.btn .i { transition: transform var(--t-fast) var(--spring); }
.btn:hover .i { transform: scale(1.15); }
.btn-secondary { background: var(--c-secondary); color: var(--c-ink); }
.btn-sun { background: var(--c-sun); color: var(--c-ink); }
.btn-mint { background: var(--c-primary); }
.btn-ghost { background: transparent; color: var(--c-primary); border-color: var(--c-primary); box-shadow: none; }
.btn-ghost:hover { background: var(--c-accent); box-shadow: none; }
.btn-soft { background: var(--c-accent); color: var(--c-primary); box-shadow: none; }
.btn-soft:hover { box-shadow: none; }
.btn-danger { background: var(--c-danger); }
.btn-danger-ghost { background: transparent; color: var(--c-danger); border-color: var(--c-danger); box-shadow: none; }
.btn-sm { min-height: 38px; padding: 5px 14px; font-size: 0.86rem; }
.btn-xs { min-height: 32px; padding: 3px 10px; font-size: 0.78rem; }
.btn-lg { min-height: 56px; padding: 12px 30px; font-size: 1.12rem; }
.btn-icon { padding: 0; width: var(--tap); }
.btn-block { width: 100%; }
.btn-glow { background: var(--c-primary); }
.btn.busy { pointer-events: none; }
.btn.busy::before { content: ''; width: 16px; height: 16px; border-radius: 50%; border: 3px solid rgba(255,255,255,.45); border-top-color: #fff; animation: spin .7s linear infinite; flex-shrink: 0; }
.link-btn { background: none; border: none; color: var(--c-primary); font-weight: 700; padding: 4px 0; text-decoration: underline dotted; }

/* ── טפסים ── */
.field { margin-bottom: 16px; position: relative; }
.field label { display: block; font-size: 0.88rem; font-weight: 700; color: var(--c-text); margin-bottom: 6px; }
.input, .field input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border: 2px solid var(--c-border); border-radius: var(--radius-sm);
  background: var(--c-surface); color: var(--c-text); font-size: 1rem; transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--c-primary); box-shadow: 0 0 0 4px rgba(22, 131, 75, 0.16); }
.input-lg { min-height: 58px; font-size: 1.15rem; padding: 12px 18px; border-radius: 14px; }
.input.ltr, .ltr { direction: ltr; text-align: left; }
.field .hint, .hint { font-size: 0.82rem; color: var(--c-muted); margin-top: 5px; }
.field .err { display: none; color: var(--c-danger); font-size: 0.84rem; margin-top: 5px; font-weight: 700; }
.field.invalid .err { display: block; animation: rise var(--t-med) var(--ease); }
.field.invalid input { border-color: var(--c-danger); }
.field.shake { animation: shake .4s var(--ease); }
textarea { resize: vertical; min-height: 80px; }
.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 0.94rem; min-height: 40px; }
.checkbox input { width: 24px; height: 24px; accent-color: var(--c-primary); cursor: pointer; flex-shrink: 0; }
.pw-wrap { display: flex; gap: 6px; align-items: center; }
.pw-wrap input { flex: 1; }

/* ── כרטיסים ── */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--c-border); cursor: pointer; user-select: none; min-height: 54px; transition: background var(--t-fast); }
.card-header:hover { background: color-mix(in srgb, var(--c-accent) 45%, transparent); }
.card-header h2 { margin: 0; font-size: 1.12rem; color: var(--c-text); flex: 1; display: flex; align-items: center; gap: 8px; }
.card-emoji { font-size: 1.2em; line-height: 1; display: inline-block; transition: transform var(--t-med) var(--spring); }
.card-header:hover .card-emoji { transform: rotate(-10deg) scale(1.15); }
.card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.card-chevron { transition: transform var(--t-med) var(--ease); color: var(--c-muted); }
.card.collapsed .card-chevron { transform: rotate(-90deg); }
.card.collapsed .card-header { border-bottom-color: transparent; }
.card.collapsed .card-body { display: none; }
.card-body { padding: 16px 18px; animation: unfold var(--t-med) var(--ease); }
.card-hint { font-size: .8rem; margin: 10px 0 0; }
.card-footer { padding: 10px 16px; border-top: 1px solid var(--c-border); display: flex; gap: 8px; flex-wrap: wrap; }
.panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }

/* ── חלונות (modal) ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(28, 43, 34, 0.52); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; animation: fade-in var(--t-fast) var(--ease); }
.modal { background: var(--c-surface); border-radius: 20px; box-shadow: var(--shadow-lg); width: 100%; min-width: 0; max-width: 560px; max-height: 90vh; overflow-y: auto; animation: modal-in 280ms var(--spring); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--c-border); position: sticky; top: 0; background: var(--c-surface); z-index: 1; }
.modal-header h3 { margin: 0; font-size: 1.18rem; color: var(--c-text); display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; width: 40px; height: 40px; border-radius: 50%; color: var(--c-muted); display: grid; place-items: center; transition: transform var(--t-fast) var(--ease), background var(--t-fast); }
.modal-close:hover { background: var(--c-accent); color: var(--c-danger); transform: rotate(90deg); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }

/* ── אנימציות (כולן קצרות, וכולן נכבות עם prefers-reduced-motion) ── */
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }
@keyframes unfold { from { opacity: 0; transform: translateY(-6px) } to { opacity: 1; transform: none } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.96) } to { opacity: 1; transform: none } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0 } 70% { transform: scale(1.08) } 100% { transform: scale(1); opacity: 1 } }
@keyframes wiggle { 0%, 100% { transform: rotate(0) } 25% { transform: rotate(-8deg) } 75% { transform: rotate(8deg) } }
@keyframes shake { 0%, 100% { transform: translateX(0) } 20% { transform: translateX(8px) } 40% { transform: translateX(-8px) } 60% { transform: translateX(5px) } 80% { transform: translateX(-5px) } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes bob { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
@keyframes nudge { 0%, 100% { transform: translateX(0) } 50% { transform: translateX(-5px) } }
@keyframes tick { 0% { transform: scale(.4) } 60% { transform: scale(1.25) } 100% { transform: scale(1) } }
@keyframes flash-ok { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c-leaf) 55%, transparent) } 100% { box-shadow: 0 0 0 14px transparent } }
@keyframes ring { 0% { box-shadow: 0 0 0 9999px rgba(28,43,34,.55), 0 0 0 4px var(--c-sun), 0 0 0 4px rgba(255,201,60,.7) } 100% { box-shadow: 0 0 0 9999px rgba(28,43,34,.55), 0 0 0 4px var(--c-sun), 0 0 0 16px rgba(255,201,60,0) } }
/* ילדים של .stagger נכנסים אחד אחרי השני */
.stagger > * { animation: rise 420ms var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: 60ms } .stagger > *:nth-child(3) { animation-delay: 120ms } .stagger > *:nth-child(4) { animation-delay: 180ms }
.stagger > *:nth-child(5) { animation-delay: 240ms } .stagger > *:nth-child(6) { animation-delay: 300ms } .stagger > *:nth-child(7) { animation-delay: 360ms } .stagger > *:nth-child(n+8) { animation-delay: 420ms }

/* ── הודעות ── */
#toast-container { position: fixed; bottom: 20px; right: 50%; transform: translateX(50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--c-ink); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 0.92rem; font-weight: 700; box-shadow: var(--shadow-lg); animation: modal-in 300ms var(--spring); display: flex; align-items: center; gap: 8px; max-width: 100%; }
.toast.success { background: #12703f; }
.toast.error { background: var(--c-danger); }
.toast.out { opacity: 0; transform: translateY(8px); transition: opacity var(--t-med), transform var(--t-med); }
.toast .i { animation: tick 380ms var(--spring); }

/* ── שונות ── */
.badge { display: inline-flex; align-items: center; gap: 4px; background: var(--c-accent); color: var(--c-primary); font-size: 0.74rem; font-weight: 800; padding: 2px 9px; border-radius: 8px; white-space: nowrap; }
.empty { text-align: center; color: var(--c-muted); padding: 26px 16px; font-size: 0.96rem; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty-emoji { font-size: 2.6rem; line-height: 1; animation: pop .5s var(--ease), bob 3.2s ease-in-out .6s infinite; }
.empty p { margin: 0; max-width: 36ch; }
.divider { border: none; border-top: 1px solid var(--c-border); margin: 16px 0; }
.muted { color: var(--c-muted); }
.tiny { font-size: .8rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; letter-spacing: 0.08em; direction: ltr; unicode-bidi: isolate; }
.chip-season { display: inline-flex; align-items: center; gap: 5px; background: var(--c-surface); color: var(--c-primary); border: 1px solid var(--c-border); border-radius: 8px; padding: 3px 10px; font-size: .78rem; font-weight: 700; white-space: nowrap; }

/* ── פוטר ── */
.site-footer { text-align: center; padding: 26px 16px 20px; margin-top: 36px; border-top: 1px solid var(--c-border); color: var(--c-muted); font-size: 0.82rem; background: var(--c-bg); }
.site-footer nav { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a, .site-footer button.link { color: var(--c-muted); background: none; border: none; padding: 6px 2px; font: inherit; text-decoration: underline dotted; cursor: pointer; }
.site-footer a:hover, .site-footer button.link:hover { color: var(--c-primary); }
.site-footer .legal { font-size: 0.72rem; direction: ltr; margin-top: 10px; opacity: 0.85; max-width: 70ch; margin-inline: auto; }

.fb-undelivered { background: #fdecec; border: 2px solid #f0b4b4; color: #7a1f1f; border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin: 0 0 12px; animation: rise var(--t-med) var(--ease); }
.fb-cat { min-height: 40px; }

/* ── מסך טעינה ── */
.loader-screen { position: fixed; inset: 0; z-index: 5000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: var(--c-bg); color: var(--c-text); transition: opacity 0.4s; }
.loader-screen .logo-mark { animation: bob 1.4s ease-in-out infinite; }
.loader-screen .bar { width: 160px; height: 6px; background: var(--c-border); border-radius: 4px; overflow: hidden; }
.loader-screen .bar::after { content: ''; display: block; height: 100%; width: 40%; background: var(--c-primary); border-radius: 4px; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(160%) } 100% { transform: translateX(-260%) } }
.loader-screen.gone { opacity: 0; pointer-events: none; }
.loader-title { font-weight: 800; font-size: 1.1rem; }

/* ── קונפטי ── */
.confetti-piece { position: fixed; z-index: 4000; pointer-events: none; top: -12px; border-radius: 2px; }

/* ── מד סיסמה ── */
.pw-meter { display: flex; gap: 4px; margin-top: 6px; }
.pw-meter span { flex: 1; height: 6px; border-radius: 3px; background: var(--c-border); transition: background var(--t-med); }
.pw-meter[data-score="1"] span:nth-child(-n+1), .pw-meter[data-score="2"] span:nth-child(-n+2) { background: var(--c-warn); }
.pw-meter[data-score="3"] span:nth-child(-n+3) { background: var(--c-leaf); }
.pw-meter[data-score="4"] span { background: var(--c-leaf); }

/* ── הצגת מפתח ── */
.code-box { display: flex; align-items: center; justify-content: center; gap: 10px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; letter-spacing: 0.1em; direction: ltr; background: #fff4d6; color: #6b4f00; border: 2px dashed #e9c25f; border-radius: 12px; padding: 10px 14px; user-select: all; overflow-wrap: anywhere; text-align: center; }

/* ── בורר פלטות ── */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.palette-option { height: 44px; border-radius: 12px; border: 3px solid transparent; cursor: pointer; display: flex; overflow: hidden; transition: transform var(--t-fast) var(--spring), border-color var(--t-fast); padding: 0; background: #eee; align-items: center; justify-content: center; font-size: 1.2rem; }
.palette-option:hover { transform: scale(1.08) rotate(-2deg); }
.palette-option.selected { border-color: var(--c-ink); }
.palette-option span { flex: 1; height: 100%; }

@media (max-width: 600px) {
  .modal { border-radius: 16px; max-height: 94vh; }
  .modal-body { padding: 16px; }
  .btn { font-size: 0.92rem; }
  .btn-sm { min-height: 40px; }
}
