/*
 * app.css: משתני העיצוב והמעטפת המשותפת של כל המסכים.
 * כל הצבעים, הגופנים, הצללים והמידות של הממשק מוגדרים כאן בבלוק :root בלבד.
 * מחוץ לבלוק אין צבעים קבועים. צבעי התבניות בקנבס מגיעים מהמפרט, לא מכאן.
 */
:root {
  /* קנבס: רקע מאחורי הסלייד ומסגרת בחירה. צבעי התבניות עצמן מגיעים מהמפרט */
  --canvas-bg: #000000;
  --canvas-select: #4da3ff;
  --canvas-select-handle: #ffffff;
  --watermark: rgba(255, 255, 255, .55);
  --watermark-shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --cutout-glow: drop-shadow(0 0 30px rgba(0, 0, 0, .8));
  /* מצב עיצוב (?design=1) */
  --design-accent: #ff4d8d;
  --design-accent-soft: rgba(255, 77, 141, .10);

  /* משטחים */
  --bg: #0d1217;
  --surface-1: #131a21;
  --surface-2: #19222b;
  --surface-3: #212c37;
  --surface-4: #2a3744;
  --overlay: rgba(5, 8, 12, .72);
  --border: #26313d;
  --border-strong: #364453;

  /* טקסט */
  --text: #eef2f6;
  --text-muted: #a9b5c2;
  --text-faint: #8796a6;
  --text-on-accent: #ffffff;
  --divider-on-accent: rgba(255, 255, 255, .25);

  /* אקסנט */
  --accent: #ff5a1f;
  --accent-text: #ff7a45;
  --accent-btn: #d63f08;
  --accent-btn-hover: #b83404;
  --accent-grad: linear-gradient(180deg, #d2440a 0%, #c23805 100%);
  --accent-soft: rgba(255, 90, 31, .14);
  --accent-softer: rgba(255, 90, 31, .07);
  --accent-ring: rgba(255, 90, 31, .45);

  /* מצבים */
  --success: #3ccf86;
  --success-soft: rgba(60, 207, 134, .14);
  --warning: #ffb547;
  --warning-soft: rgba(255, 181, 71, .14);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .14);
  --info: #6cb6ff;
  --info-soft: rgba(108, 182, 255, .14);

  /* דוברים ושאלת מראיין */
  --spk-a: #ff8f5c;
  --spk-b: #7cc0ff;
  --question: #ffd800;
  --question-soft: rgba(255, 216, 0, .12);

  /* פונטים */
  --font-ui: "Segoe UI", system-ui, -apple-system, "Noto Sans Hebrew", Arial, sans-serif;
  --font-canvas: "SimplerPro_V3", "Simpler", "Secular One", "Segoe UI", Arial, sans-serif;
  --font-mono: Consolas, "Cascadia Mono", ui-monospace, monospace;
  --fs-xs: 11.5px;
  --fs-s: 12.5px;
  --fs-m: 14px;
  --fs-l: 16px;
  --fs-xl: 20px;
  --fs-xxl: 26px;

  /* צללים ורדיוסים */
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-3: 0 24px 64px rgba(0, 0, 0, .55);
  --shadow-accent: 0 6px 20px rgba(214, 63, 8, .35);
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;

  /* מידות פריסה */
  --topbar-h: 60px;
  --rail-w: 76px;
  --gap: 12px;
  --pad: 14px;

  /* נקודות שבירה. ב-@media אי אפשר להשתמש במשתנה, לכן הערכים מוזכרים שם בהערה */
  --bp-desktop: 1280px;
  --bp-wide: 1600px;
}

/* ------------------------------------------------------------------ בסיס */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-m);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
.ic { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.ic-s { width: 16px; height: 16px; }
.ic-l { width: 26px; height: 26px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ מסגרת ראשית */
.app {
  display: grid;
  height: 100dvh;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr) auto;
  grid-template-areas:
    "top top"
    "nav main"
    "nav foot";
}
.app[data-layout="page"] { height: auto; min-height: 100dvh; grid-template-rows: var(--topbar-h) 1fr; }
.app > .topbar { grid-area: top; }
.app > .rail { grid-area: nav; }
.app > main { grid-area: main; min-width: 0; min-height: 0; }
.app > .footbar { grid-area: foot; }

.topbar {
  display: flex; align-items: center; gap: var(--gap);
  padding: 0 18px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xl); font-weight: 700; white-space: nowrap; }
.brand-mark { color: var(--accent); font-family: var(--font-canvas); font-size: 40px; line-height: 1; font-weight: 800; transform: translateY(6px); letter-spacing: -2px; }
.brand-sep { width: 1px; height: 28px; background: var(--border-strong); margin: 0 6px; }
.project-title {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 7px 12px; font-weight: 600; min-width: 0;
}
.project-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sq { border-radius: var(--radius-s); }
.icon-btn .dot { position: absolute; top: 7px; inset-inline-end: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface-1); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border-strong);
}
.role-badge { font-size: var(--fs-xs); padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border); }
.role-badge.admin { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-ring); }

/* ניווט מימין */
.rail {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  padding: 12px 8px;
  background: var(--surface-1);
  border-inline-start: 0;
  border-inline-end: 1px solid var(--border);
}
.rail-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 2px; border-radius: var(--radius-m);
  color: var(--text-muted); font-size: var(--fs-xs); text-align: center; line-height: 1.2;
  border: 0; background: transparent; cursor: pointer; text-decoration: none;
}
.rail-item .ic { width: 24px; height: 24px; }
.rail-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.rail-item.active { background: var(--accent-soft); color: var(--accent-text); }
.rail-item.primary { color: var(--accent-text); }
/* "צור פוסט חדש": כפתור פעולה בראש הניווט, עם פלוס על רקע כתום */
.rail-cta { color: var(--text); font-weight: 600; margin-bottom: 6px; }
.rail-cta-ic { width: 40px; height: 40px; border-radius: var(--radius-m); display: grid; place-items: center; background: var(--accent-grad); color: var(--text-on-accent); box-shadow: var(--shadow-1); }
.rail-cta:hover .rail-cta-ic { background: var(--accent-btn-hover); }
.rail-cta .rail-cta-ic .ic { width: 22px; height: 22px; }
.rail-spacer { flex: 1; }

/* באנר "מיועד למחשב" */
.desktop-banner {
  display: none;
  align-items: center; gap: 10px; justify-content: center;
  padding: 8px 14px; background: var(--warning-soft); color: var(--warning);
  border-bottom: 1px solid var(--border); font-size: var(--fs-s);
}
/* --bp-desktop: 1280px */
@media (max-width: 1279.98px) {
  .desktop-banner { display: flex; }
}
.desktop-banner.dismissed { display: none; }

/* ------------------------------------------------------------------ רכיבים */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-m);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: var(--text-on-accent); box-shadow: var(--shadow-accent); }
.btn.primary:hover { background: var(--accent-btn-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger); border-color: var(--danger-soft); background: transparent; }
.btn.small { height: 32px; padding: 0 12px; font-size: var(--fs-s); border-radius: var(--radius-s); }
.btn.large { height: 50px; padding: 0 26px; font-size: var(--fs-l); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-group { display: inline-flex; }
.btn-group .btn:first-child { border-start-end-radius: 0; border-end-end-radius: 0; }
.btn-group .btn:last-child { border-start-start-radius: 0; border-end-start-radius: 0; border-inline-start: 1px solid var(--divider-on-accent); padding: 0 10px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: var(--fs-m); display: flex; align-items: center; gap: 6px; }
.req { color: var(--accent-text); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic { position: absolute; inset-inline-start: 12px; color: var(--text-muted); pointer-events: none; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-m);
  color: var(--text); outline: none;
}
.input-wrap > .ic + .input { padding-inline-start: 40px; }
textarea.input { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.suggested { border-style: dashed; border-color: var(--info); }
.input.error { border-color: var(--danger); }
.hint { font-size: var(--fs-s); color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.hint.suggest { color: var(--info); }
.hint.error { color: var(--danger); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-3); color: var(--text-muted); font-size: var(--fs-s); white-space: nowrap;
  border: 1px solid var(--border);
}
.chip.accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-ring); }
.chip.success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.chip.warning { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.question { background: var(--question-soft); color: var(--question); border-color: transparent; }
.chip button { border: 0; background: transparent; color: inherit; padding: 0; cursor: pointer; display: inline-flex; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 14px; border: 0; background: transparent; color: var(--text-muted);
  font-weight: 600; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-m); padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--text-muted); padding: 6px 12px; border-radius: var(--radius-s); cursor: pointer; font-weight: 600; font-size: var(--fs-s); display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--accent-btn); color: var(--text-on-accent); }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-l); }
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-l); min-height: 0; display: flex; flex-direction: column; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px var(--pad); font-weight: 700; font-size: var(--fs-l); }
.panel-body { padding: 0 var(--pad) var(--pad); overflow: auto; min-height: 0; flex: 1; }

.check {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 20px; height: 20px; flex: none; border-radius: 6px;
  border: 2px solid var(--border-strong); background: var(--surface-2); cursor: pointer;
  display: inline-grid; place-content: center;
}
/* וי רגיל (✓) גם ב-RTL: קווים פיזיים שמאל ותחתון מסובבים, ולא inline-start/end שמתהפכים בעברית */
.check::after { content: ""; width: 10px; height: 5px; border: 2.5px solid var(--text-on-accent); border-top: 0; border-right: 0; transform: translate(0, -1px) rotate(-45deg); opacity: 0; }
.check:checked { background: var(--accent-btn); border-color: var(--accent-btn); }
.check:checked::after { opacity: 1; }

.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { appearance: none; -webkit-appearance: none; margin: 0; width: 100%; height: 100%; border-radius: 999px; background: var(--surface-4); cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: inset-inline-start .15s; }
.switch input:checked { background: var(--accent-btn); }
.switch input:checked::after { inset-inline-start: 19px; }

.range { width: 100%; accent-color: var(--accent); height: 4px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-grad); border-radius: inherit; }
.progress.success > span { background: var(--success); }
/* התקדמות בלי אחוז ידוע: פס שנע הלוך וחזור */
.progress.indeterminate > span { width: 35%; animation: progress-slide 1.2s ease-in-out infinite alternate; }
@keyframes progress-slide { from { margin-inline-start: 0; } to { margin-inline-start: 65%; } }
@media (prefers-reduced-motion: reduce) { .progress.indeterminate > span { animation: none; width: 100%; opacity: .5; } }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  text-align: center; color: var(--text-muted); padding: 32px 16px;
}
.empty .ic { width: 40px; height: 40px; color: var(--text-faint); }
.empty h3 { color: var(--text); font-size: var(--fs-l); }

.alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-m);
  background: var(--warning-soft); color: var(--text); border: 1px solid var(--warning-soft);
}
.alert > .ic { color: var(--warning); margin-top: 1px; }
.alert.danger { background: var(--danger-soft); }
.alert.danger > .ic { color: var(--danger); }
.alert.info { background: var(--info-soft); }
.alert.info > .ic { color: var(--info); }
.alert.success { background: var(--success-soft); }
.alert.success > .ic { color: var(--success); }
.alert b { display: block; margin-bottom: 2px; }

/* ------------------------------------------------------------------ תפריט התראות */
.dropdown {
  position: absolute; top: calc(var(--topbar-h) - 6px); inset-inline-end: 70px;
  width: 360px; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-l); box-shadow: var(--shadow-3); z-index: 40; overflow: hidden;
}
.dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); font-weight: 700; }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif.unread { background: var(--accent-softer); }
.notif-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.notif-ic.transcribed { background: var(--info-soft); color: var(--info); }
.notif-ic.export { background: var(--success-soft); color: var(--success); }
.notif-ic.error { background: var(--danger-soft); color: var(--danger); }
.notif b { display: block; }
.notif .muted { font-size: var(--fs-s); }
.notif time { font-size: var(--fs-xs); color: var(--text-faint); }

/* ------------------------------------------------------------------ חלונות */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--overlay); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 24px; overflow: auto;
}
.modal {
  position: relative; width: min(760px, 100%);
  background: var(--surface-1); border: 1px solid var(--border-strong);
  border-radius: 26px; box-shadow: var(--shadow-3); overflow: hidden;
}
.modal-close { position: absolute; top: 20px; inset-inline-end: 20px; z-index: 2; border: 1px solid var(--border-strong); border-radius: var(--radius-m); width: 44px; height: 44px; background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.modal-close:hover { background: var(--surface-3); }
.modal-foot { display: flex; justify-content: center; gap: 16px; padding: 20px 28px; border-top: 1px solid var(--border); background: var(--surface-1); }

/* חלון יצירת פוסט חדש */
.np-head { position: relative; padding: 34px 36px 26px; overflow: hidden; }
.np-swoosh { position: absolute; top: 0; inset-inline-end: 0; width: 260px; height: 210px; pointer-events: none; transform: scaleX(1); }
.ic.flip { transform: scaleX(-1); }
.np-swoosh path { fill: var(--accent); }
.np-title { display: flex; align-items: center; gap: 12px; font-size: 32px; }
.np-title .brand-mark { font-size: 64px; transform: translateY(14px); }
.np-sub { color: var(--text-muted); font-size: var(--fs-l); margin-top: 4px; }
.np-body { padding: 0 28px 24px; display: grid; gap: 18px; background: var(--surface-1); }
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: var(--radius-l);
  padding: 22px; text-align: center; display: grid; gap: 8px; justify-items: center;
  background: var(--surface-2);
}
.dropzone .ic-l { width: 46px; height: 46px; color: var(--accent); }
.dropzone-title { font-size: var(--fs-l); font-weight: 600; }
.dropzone-title a { font-weight: 700; color: var(--accent-text); }
.dropzone.error { border-color: var(--danger); background: var(--danger-soft); }
.dropzone.has-file { border-style: solid; border-color: var(--accent-ring); }
.dropzone.over { border-color: var(--accent); background: var(--accent-softer); }
.file-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: start; }
.file-row .grow { flex: 1; min-width: 0; display: grid; gap: 6px; }
.file-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 42px; padding: 6px 10px 6px 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-m); }
.tag-input .ic { color: var(--text-muted); }
.tag-input input { flex: 1; min-width: 80px; border: 0; background: transparent; outline: none; height: 28px; }

/* ------------------------------------------------------------------ הודעות קופצות */
.toasts { position: fixed; bottom: 96px; inset-inline-start: 50%; transform: translateX(50%); display: grid; gap: 8px; z-index: 120; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius-m); padding: 10px 16px; box-shadow: var(--shadow-2); }
.toast .ic { color: var(--success); }

/* ------------------------------------------------------------------ עמודים רגילים */
.page { padding: 24px 28px 40px; display: grid; gap: 20px; align-content: start; max-width: 1600px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-xxl); }
.page-head .grow { flex: 1; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.toolbar .input-wrap { width: 280px; }
.toolbar select.input { width: 200px; }

.forbidden { display: grid; place-items: center; min-height: 60vh; }

/* ------------------------------------------------------------------ סימן המרכאות של המותג */
.quote-mark { width: 34px; height: 26px; fill: var(--accent); flex: none; }
.np-title .quote-mark { width: 58px; height: 44px; }
.tag-input.suggested { border-style: dashed; border-color: var(--info); }
