/* מאור · עיצוב האתר */
:root {
  --cream: #FDFBF7;
  --lav: #9D84B7;          /* כותרות גדולות */
  --lav-deep: #6A5491;     /* כפתורים ראשיים, קישורים */
  --ink: #43345A;          /* טקסט גוף, ניגודיות גבוהה */
  --muted: #6B6077;
  --gold: #D4AF37;         /* קווים והדגשות */
  --gold-ink: #7D6214;     /* טקסט זהב קטן, נגיש */
  --mist: #F4EFF8;
  --line: #E6DDF0;
  --white: #FFFFFF;
  --danger: #9B2C3A;
  --ok: #2F6B4F;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(67, 52, 90, .05), 0 8px 24px rgba(67, 52, 90, .07);
  --font: "Assistant", "Segoe UI", Arial, sans-serif;
  --hand: "Caveat", "Assistant", cursive;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img { max-width: 100%; height: auto; }
a { color: var(--lav-deep); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
h1, h2, h3 { color: var(--lav); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-weight: 300; font-size: clamp(2rem, 5vw, 2.75rem); }
h2 { font-weight: 400; font-size: 1.6rem; }
h3 { font-weight: 600; font-size: 1.15rem; color: var(--ink); }
p { margin: 0 0 1em; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--white); padding: .5rem 1rem; border-radius: var(--radius-sm); z-index: 50; }
.skip:focus { top: 1rem; }
[hidden] { display: none !important; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }
.narrow { width: min(560px, 100% - 2.5rem); margin-inline: auto; }

/* סימן מסחרי */
.wordmark { font-family: var(--font); font-weight: 300; color: var(--lav); text-decoration: none; letter-spacing: .01em; }
.wordmark.small { font-size: 1.6rem; line-height: 1; }
.hand { font-family: var(--hand); font-weight: 500; font-style: normal; color: var(--gold-ink); }

/* כפתורים */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .6rem 1.4rem;
  font: 600 1rem/1.2 var(--font);
  border-radius: 999px; border: 1.5px solid transparent;
  background: var(--lav-deep); color: var(--white);
  cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #57437A; color: var(--white); }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--gold); }
.btn.secondary:hover { background: #FBF5E3; }
.btn.quiet { background: transparent; color: var(--lav-deep); border-color: var(--line); }
.btn.quiet:hover { background: var(--mist); }
.btn.danger { background: transparent; color: var(--danger); border-color: #E7C6CB; }
.btn.small { min-height: 38px; padding: .35rem 1rem; font-size: .92rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* טפסים */
label { display: block; font-weight: 600; margin-bottom: .35rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=url], select, textarea {
  width: 100%; min-height: 48px; padding: .6rem .9rem;
  font: 400 1rem/1.5 var(--font); color: var(--ink);
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
}
input:focus, select:focus, textarea:focus { border-color: var(--lav); outline: none; box-shadow: 0 0 0 3px rgba(212, 175, 55, .35); }
textarea { min-height: 120px; resize: vertical; }
.field { margin-bottom: 1.25rem; }
.ltr { direction: ltr; text-align: right; }
.code-input { letter-spacing: .25em; font-weight: 600; text-transform: uppercase; }
.msg { border-radius: var(--radius-sm); padding: .8rem 1rem; margin: 1rem 0; }
.msg.error { background: #FBEFF1; color: var(--danger); }
.msg.ok { background: #EEF6F1; color: var(--ok); }
.privacy-note { font-size: .9rem; color: var(--muted); margin-top: .4rem; }

/* כותרת ותחתית */
.topbar { padding: 1.25rem 0; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.footer { padding: 2rem 0 2.5rem; color: var(--muted); font-size: .95rem; }
.footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: center; align-items: baseline; text-align: center; }
.footer .contact { margin: 0; flex-basis: 100%; font-weight: 600; color: var(--ink); }
.footer .contact a { margin-inline-start: .4rem; }

/* דף הבית */
.home { display: grid; place-items: center; text-align: center; padding: 3rem 0 2rem; }
.sunrise { position: relative; display: inline-block; padding-top: 3.2rem; }
.sunrise svg { position: absolute; left: 50%; top: 0; transform: translateX(-50%); width: min(340px, 80vw); height: auto; }
.home .wordmark { font-size: clamp(4.5rem, 16vw, 8.5rem); line-height: 1; display: block; position: relative; }
.home .tagline { font-size: 1.2rem; max-width: 30ch; margin: 1.6rem auto 2.2rem; color: var(--ink); }

/* כרטיס מרכזי */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1.5rem, 4vw, 2.5rem); }
.page-title { text-align: center; margin: 1.5rem 0 1.5rem; }

/* דף קורס */
.course-head { padding: 1rem 0 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; }
.course-head .desc { max-width: 70ch; color: var(--ink); }
.course-cover { width: 100%; max-height: 240px; object-fit: cover; border-radius: var(--radius); margin-bottom: 1.2rem; }
.preview-banner { background: #FBF5E3; color: var(--gold-ink); text-align: center; padding: .55rem 1rem; font-weight: 600; }
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 2rem; align-items: start; }
.sidebar { position: sticky; top: 1rem; }
.progress { margin-bottom: 1rem; }
.progress-track { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--gold); transition: width .3s; }
.progress-label { font-size: .9rem; color: var(--muted); margin-top: .35rem; }
.unit-list { list-style: none; margin: 0; padding: 0; }
.unit-list button {
  width: 100%; text-align: start; display: flex; gap: .6rem; align-items: flex-start;
  padding: .7rem .8rem; border: 0; border-radius: var(--radius-sm); background: transparent;
  font: 400 1rem/1.45 var(--font); color: var(--ink); cursor: pointer;
}
.unit-list button:hover { background: var(--mist); }
.unit-list button[aria-current="true"] { background: var(--mist); font-weight: 600; box-shadow: inset -3px 0 0 var(--gold); }
.unit-list .num { flex: 0 0 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; border: 1px solid var(--line); color: var(--muted); }
.unit-list .done .num { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.mobile-units { display: none; margin-bottom: 1rem; }
.unit-body h2 { margin-bottom: 1rem; }
.block { margin-bottom: 1.75rem; }
.rich { max-width: 72ch; }
.rich ul, .rich ol { padding-inline-start: 1.4rem; }
.frame-wrap { position: relative; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--white); }
.frame-wrap iframe { display: block; width: 100%; border: 0; min-height: 320px; }
.frame-wrap:fullscreen { border-radius: 0; }
.frame-wrap:fullscreen iframe { height: 100vh !important; }
.frame-tools { display: flex; justify-content: flex-end; margin-top: .5rem; }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #2b2238; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.file-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); flex-wrap: wrap; }
.file-icon { flex: 0 0 48px; height: 56px; border-radius: 8px; background: var(--mist); display: grid; place-items: center; font-weight: 700; font-size: .8rem; color: var(--lav-deep); }
.file-info { flex: 1; min-width: 160px; }
.file-info strong { display: block; word-break: break-word; }
.file-info span { color: var(--muted); font-size: .92rem; }
.unit-nav { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 2rem; }
.done-toggle[aria-pressed="true"] { background: var(--gold); color: var(--ink); border-color: var(--gold); }

/* אווירה רכה */
.vibe-soft::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("soft-decor.svg") center top / cover no-repeat;
  opacity: .5;
}

/* ניהול */
.admin-bar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin: 1rem 0 1.5rem; }
.course-rows { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.course-rows li { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: 1rem .25rem; border-bottom: 1px solid var(--line); }
.course-rows .meta { color: var(--muted); font-size: .92rem; }
.badge { display: inline-block; padding: .1rem .65rem; border-radius: 99px; font-size: .82rem; font-weight: 600; background: var(--mist); color: var(--lav-deep); margin-inline-start: .4rem; }
.badge.active { background: #EEF6F1; color: var(--ok); }
.badge.frozen { background: #EEF0F4; color: #4A5568; }
.badge.draft { background: #FBF5E3; color: var(--gold-ink); }
.section { border-top: 1px solid var(--line); padding: 1.75rem 0; }
.section > h2 { font-size: 1.35rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.radio-row { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; }
.radio-row label { font-weight: 400; display: flex; gap: .45rem; align-items: center; margin: 0; }
.code-row { display: flex; gap: .6rem; }
.code-row input { flex: 1; }
.email-list { list-style: none; padding: 0; margin: .75rem 0 0; max-height: 280px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }
.email-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .35rem .8rem; border-bottom: 1px solid var(--line); direction: ltr; }
.email-list li:last-child { border-bottom: 0; }
.units-admin { list-style: none; padding: 0; margin: 0; }
.unit-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); margin-bottom: .9rem; }
.unit-card.dragging { opacity: .5; }
.unit-card.drop-target { box-shadow: 0 0 0 2px var(--gold); }
.unit-top { display: flex; gap: .5rem; align-items: center; padding: .6rem .8rem; }
.drag { cursor: grab; color: var(--muted); padding: .3rem; border: 0; background: none; font-size: 1.1rem; }
.unit-top input { flex: 1; min-height: 42px; }
.unit-blocks { padding: 0 1rem 1rem; }
.block-edit { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: .9rem; margin-bottom: .8rem; background: var(--cream); }
.block-edit header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; font-weight: 600; }
.rte-tools { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.rte-tools button { min-height: 34px; padding: .2rem .7rem; border: 1px solid var(--line); background: var(--white); border-radius: 6px; font: 600 .9rem var(--font); color: var(--ink); cursor: pointer; }
.rte { min-height: 120px; padding: .7rem .9rem; background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-sm); }
.rte:focus { border-color: var(--lav); outline: none; }
.sticky-actions { position: sticky; bottom: 0; background: rgba(253, 251, 247, .96); border-top: 1px solid var(--line); padding: .8rem 0; display: flex; flex-wrap: wrap; gap: .6rem; z-index: 5; }
.upload-progress { font-size: .9rem; color: var(--muted); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: min(560px, 92vw); width: 100%; color: var(--ink); background: var(--white); }
dialog::backdrop { background: rgba(67, 52, 90, .35); }
.log-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.log-table th, .log-table td { text-align: start; padding: .45rem .3rem; border-bottom: 1px solid var(--line); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.toast { position: fixed; bottom: 1.25rem; inset-inline: 0; margin: auto; width: fit-content; max-width: 90vw; background: var(--ink); color: var(--white); padding: .7rem 1.2rem; border-radius: 99px; z-index: 100; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-units { display: block; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
