/* ──────────────────────────────────────────────────────────────
   base.css — צבעים, כפתורים, טפסים, כרטיסים, חלונות, הודעות.
   משותף לדף הבית, ללוח ולדפי המשפט. הפלטה בהירה וחמה; הצבעים
   של כל קבוצה מחליפים את --c-* בלוח (ראו lib/widgets.js).
   ────────────────────────────────────────────────────────────── */
:root {
  --c-primary: #2f6df6;
  --c-secondary: #ff6b6b;
  --c-bg: #fff8ee;
  --c-accent: #e8efff;
  --c-surface: #ffffff;
  --c-border: #e9e3d6;
  --c-text: #1f2937;
  --c-muted: #667085;
  --c-sun: #ffd166;
  --c-mint: #2ec27e;
  --c-grape: #8b5cf6;
  --c-coral: #ff6b6b;
  --c-danger: #e03131;
  --c-warn: #f59f00;
  --c-ink: #1f2937;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 2px 12px rgba(31, 41, 55, 0.07);
  --shadow-lg: 0 14px 40px rgba(31, 41, 55, 0.16);
  --ease: cubic-bezier(.22, .8, .36, 1);
  --t-fast: 150ms;
  --t-med: 240ms;
  --font: '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); color: var(--c-text); direction: rtl; min-height: 100vh; line-height: 1.55; -webkit-font-smoothing: antialiased; }
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; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !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; }

/* ── כפתורים ── */
.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.12);
  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.12); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; filter: none; transform: none; }
.btn-secondary { background: var(--c-secondary); }
.btn-sun { background: var(--c-sun); color: var(--c-ink); }
.btn-mint { background: var(--c-mint); }
.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: 36px; padding: 5px 14px; font-size: 0.86rem; }
.btn-xs { min-height: 30px; 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); }
.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(47, 109, 246, 0.15); }
.input-lg { min-height: 58px; font-size: 1.15rem; padding: 12px 18px; border-radius: 16px; }
.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; }
.field.invalid input { border-color: var(--c-danger); }
textarea { resize: vertical; min-height: 80px; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.94rem; min-height: 32px; }
.checkbox input { width: 20px; height: 20px; 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: 14px 18px; border-bottom: 1px solid var(--c-border); cursor: pointer; user-select: none; min-height: 54px; }
.card-header h2 { margin: 0; font-size: 1.04rem; font-weight: 900; color: var(--c-text); flex: 1; display: flex; align-items: center; gap: 8px; }
.card-emoji { font-size: 1.25em; line-height: 1; }
.card-actions { display: flex; gap: 6px; align-items: center; }
.card-chevron { transition: transform var(--t-med) var(--ease); color: var(--c-muted); }
.card.collapsed .card-chevron { transform: rotate(-90deg); }
.card.collapsed .card-body { display: none; }
.card-body { padding: 16px 18px; }
.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(31, 41, 55, 0.5); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.modal-overlay.open { display: flex; animation: fade-in var(--t-fast) var(--ease); }
.modal { background: var(--c-surface); border-radius: 22px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; animation: rise var(--t-med) var(--ease); }
.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.12rem; font-weight: 900; color: var(--c-text); display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; width: 36px; height: 36px; border-radius: 50%; color: var(--c-muted); display: grid; place-items: center; }
.modal-close:hover { background: var(--c-accent); color: var(--c-danger); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px 18px; display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes rise { from { opacity: 0; transform: translateY(14px) } 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) } }

/* ── הודעות ── */
#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: 30px; font-size: 0.92rem; font-weight: 700; box-shadow: var(--shadow-lg); animation: rise var(--t-med) var(--ease); display: flex; align-items: center; gap: 8px; max-width: 100%; }
.toast.success { background: var(--c-mint); }
.toast.error { background: var(--c-danger); }
.toast.out { opacity: 0; transition: opacity var(--t-med); }

/* ── שונות ── */
.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: 12px; 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); }
.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: #eaf7ef; color: #1d7a4b; border-radius: 20px; padding: 3px 11px; 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; }
.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: 0; 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.8; max-width: 70ch; margin-inline: auto; }

/* ── מסך טעינה ── */
.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: wiggle 1.6s 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-fast); }
.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-mint); }
.pw-meter[data-score="4"] span { background: var(--c-mint); }

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

/* ── בורר פלטות ── */
.palette-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
.palette-option { height: 40px; border-radius: 12px; border: 3px solid transparent; cursor: pointer; display: flex; overflow: hidden; transition: transform var(--t-fast), 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.06); }
.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; }
}
