/* TIRGUL.ai — ערכת צבעים כהה בגוני הלוגו (14.9.2026). יעמיק בהמשך. */

:root {
  --bg: #0b1424;            /* רקע הדף: כחול כהה מאוד */
  --bg-header: #011b40;     /* הרקע של קובץ הלוגו, כדי שהלוגו ייטמע בכותרת */
  --card: #132038;          /* כרטיסים */
  --card-2: #1a2b48;        /* משטח מוגבה בתוך כרטיס */
  --line: #26395c;
  --ink: #e7edf7;           /* טקסט */
  --muted: #9db0cc;
  --sky: #1aa3f0;           /* הכחול הבהיר של הלוגו */
  --sky-bright: #5cc4ff;
  --sky-dim: rgba(26, 163, 240, .16);
  --code-bg: #060b16;
  --ok: #7ee2a8;   --ok-bg: rgba(46, 204, 113, .14);
  --bad: #ff9d9d;  --bad-bg: rgba(255, 92, 92, .14);
  --warn: #ffd666; --warn-bg: rgba(255, 196, 0, .12);
  --radius: 12px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

a { color: var(--sky-bright); }
h1 { color: #fff; font-size: 1.7rem; margin: 0 0 .6rem; }
h2 { color: var(--sky-bright); font-size: 1.25rem; margin: 1.2rem 0 .5rem; }
.muted { color: var(--muted); }
.small-note { font-size: .95rem; margin-top: 1rem; }

/* --- מסגרת --- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1.5rem; background: var(--bg-header); border-bottom: 3px solid var(--sky);
}
.logo-link { display: inline-block; line-height: 0; }
.logo { height: 46px; display: block; }
.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.site-nav a:hover { color: var(--sky-bright); }
.who { color: var(--muted); }
.container { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.site-footer { text-align: center; color: var(--muted); padding: 1.5rem; font-size: .9rem; max-width: 60rem; margin: 0 auto; line-height: 1.7; }
.notice { background: var(--warn-bg); color: var(--warn); padding: .6rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; }

/* --- כרטיסים --- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-bottom: 1rem; }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

/* --- כפתורים --- */
.button {
  display: inline-block; padding: .55rem 1.2rem; border-radius: 999px; border: 2px solid var(--sky);
  background: transparent; color: var(--sky-bright); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.button:hover { background: var(--sky-dim); }
.button.primary { background: var(--sky); border-color: var(--sky); color: #fff; }
.button.primary:hover { background: var(--sky-bright); border-color: var(--sky-bright); color: #06111f; }
.button.accent { background: #fff; border-color: #fff; color: #062a5a; }
.button.accent:hover { background: #d9efff; border-color: #d9efff; }
.button.big { font-size: 1.15rem; padding: .8rem 2rem; }
.button.link { border: none; background: none; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-top: 1rem; }
.actions.between { justify-content: space-between; }
.actions form { display: inline; }

/* --- דף הבית --- */
.hero { text-align: center; padding-top: 1rem; }
.hero .lead { font-size: 1.1rem; max-width: 40rem; margin: 0 auto 1.5rem; }
.video-frame { max-width: 720px; margin: 0 auto 1.5rem; aspect-ratio: 16 / 9; background: var(--code-bg); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--muted); }

/* --- רשימת תתי-הנושאים --- */
.topic-list { list-style: none; padding: 0; margin: 0; }
.topic-group {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  color: var(--sky-bright); font-weight: 700; margin: 1.3rem 0 .4rem; font-size: 1rem;
}
.video-link { font-size: .9rem; font-weight: 600; text-decoration: none; color: var(--muted); white-space: nowrap; }
.video-link:hover { color: var(--sky-bright); }
.topic-row { margin-bottom: .4rem; }
.topic-link {
  display: grid; grid-template-columns: 4rem 1fr auto; gap: 1rem; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem;
  color: var(--ink); text-decoration: none;
}
.topic-link:hover { border-color: var(--sky); background: var(--card-2); }
.topic-key { font-family: Consolas, monospace; color: var(--muted); direction: ltr; }
.topic-title { font-weight: 600; }
.topic-progress { color: var(--muted); font-size: .95rem; white-space: nowrap; }

/* --- דף התרגיל --- */
.exercise-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.crumbs { color: var(--muted); font-size: .9rem; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--sky-bright); }
.qtype { font-size: .95rem; font-weight: 500; color: var(--muted); margin-inline-start: .5rem; }
.level-badge { background: var(--sky); color: #fff; border-radius: 999px; padding: .35rem 1rem; font-weight: 700; white-space: nowrap; direction: ltr; }

.question, .solution { font-size: 1.05rem; }

/* קוד: תמיד משמאל לימין */
pre {
  direction: ltr; text-align: left; unicode-bidi: isolate;
  background: var(--code-bg); color: #e6edf7; border: 1px solid var(--line); padding: .9rem 1.1rem; border-radius: 10px;
  overflow-x: auto; font-family: Consolas, "Courier New", monospace; font-size: .95rem; line-height: 1.5;
}
code { font-family: Consolas, "Courier New", monospace; direction: ltr; unicode-bidi: isolate; }
:not(pre) > code { background: var(--sky-dim); color: #9ad6ff; padding: .05rem .35rem; border-radius: 5px; font-size: .95em; }

/* צביעת תחביר (Pygments, מחלקות הטוקנים הסטנדרטיות). הצבעים בהשראת עורכי קוד כהים. */
.highlight { direction: ltr; }
.highlight pre { margin: 0 0 1rem; }
.highlight .c, .highlight .c1, .highlight .cm { color: #7f8ea3; font-style: italic; }   /* הערות */
.highlight .k, .highlight .kc, .highlight .kd, .highlight .kr { color: #ff7ab2; }        /* מילים שמורות: if, else, for, while, return, true, false */
.highlight .kt { color: #4fd1c5; }                                                        /* טיפוסים: int, string, double, char, bool, void */
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sc, .highlight .se, .highlight .sa { color: #ffd37a; }  /* מחרוזות ותווים, כולל הגרשיים */
.highlight .m, .highlight .mi, .highlight .mf { color: #b5a4ff; }                        /* מספרים */
.highlight .o { color: #7fdbff; }                                                        /* אופרטורים: = + - * / % == != && || */
.highlight .p { color: #c9d4e5; }                                                        /* סוגריים, נקודה, נקודה-פסיק */
.highlight .n, .highlight .nn { color: #e7edf7; }                                        /* שמות: משתנים, Console, WriteLine */
.highlight .nc, .highlight .nf, .highlight .nb { color: #8fd0ff; }                       /* מחלקות ופעולות כשהן מזוהות */
.highlight .w { color: inherit; }

/* אזור המענה */
.answer-form { margin-top: 1rem; }
textarea {
  width: 100%; font: inherit; padding: .8rem 1rem; border: 2px solid var(--line); border-radius: 10px;
  background: var(--code-bg); color: var(--ink); resize: vertical;
}
textarea::placeholder { color: var(--muted); opacity: .8; }
textarea:focus { outline: none; border-color: var(--sky); }
textarea.code-input { direction: ltr; text-align: left; font-family: Consolas, "Courier New", monospace; font-size: .95rem; tab-size: 4; }
textarea.hebrew-input { direction: rtl; }

/* עורך הקוד (Monaco) שמחליף את תיבת הקוד כשה-CDN זמין */
.code-editor { border: 2px solid var(--line); border-radius: 10px; overflow: hidden; min-height: 240px; margin-bottom: .5rem; background: var(--code-bg); }
.code-editor:focus-within { border-color: var(--sky); }

.choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; max-width: 30rem; }
.choice {
  font: inherit; font-size: 1.3rem; font-weight: 700; padding: .7rem 0; border-radius: 10px;
  border: 2px solid var(--sky); background: transparent; color: var(--ink); cursor: pointer;
}
.choice:hover { background: var(--sky-dim); }
.choice.chosen { background: var(--sky); color: #fff; }

.feedback { margin-top: 1rem; padding: .8rem 1rem; border-radius: 10px; display: flex; gap: .6rem; flex-wrap: wrap; }
.feedback.correct { background: var(--ok-bg); color: var(--ok); }
.feedback.incorrect { background: var(--bad-bg); color: var(--bad); }
.feedback.unavailable, .feedback.blocked, .feedback.error { background: var(--warn-bg); color: var(--warn); }

.solution { border-color: var(--sky); }

/* חלונית הדירוג */
.rate-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; max-width: 34rem; width: calc(100% - 2rem);
  direction: rtl; font: inherit; background: var(--card); color: var(--ink);
}
.rate-dialog::backdrop { background: rgba(0, 6, 18, .7); }
.rate-dialog h2 { margin-top: 0; color: #fff; }
.rating-options { display: grid; gap: .6rem; margin-bottom: .8rem; }
.rating {
  display: flex; align-items: center; gap: .8rem; font: inherit; text-align: right; padding: .6rem .8rem; border-radius: 10px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card-2); color: var(--ink);
}
.rating:hover { border-color: var(--sky); background: var(--sky-dim); }
.rating-3 { border-color: var(--sky); }
.rating-num {
  flex: 0 0 auto; min-width: 3rem; text-align: center; direction: ltr; unicode-bidi: isolate;
  font-weight: 700; font-family: Consolas, monospace; background: var(--code-bg); color: var(--sky-bright);
  border-radius: 999px; padding: .15rem .5rem;
}

/* מאגר תרגילים למורים */
table.resources { border-collapse: collapse; width: 100%; background: var(--card); font-size: .95rem; }
table.resources th, table.resources td { border: 1px solid var(--line); padding: .5rem .7rem; vertical-align: top; text-align: right; }
table.resources th { background: var(--card-2); color: var(--sky-bright); white-space: nowrap; }
table.resources .topic-cell { white-space: nowrap; }
table.resources .num { direction: ltr; text-align: center; }
.button.small { padding: .25rem .8rem; font-size: .9rem; }

/* מדיניות פרטיות */
.legal h2 { margin-top: 1.4rem; }
.legal ul { padding-inline-start: 1.4rem; }

/* הודעות קצה */
.message { text-align: center; padding: 2rem 1.5rem; }
.message .actions { justify-content: center; }

/* ניהול */
.stats { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1.4rem; min-width: 9rem; text-align: center; }
.stat-num { display: block; font-size: 1.6rem; font-weight: 700; color: var(--sky-bright); direction: ltr; }
.stat-label { color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table.checks { border-collapse: collapse; width: 100%; font-size: .9rem; background: var(--card); }
table.checks th, table.checks td { border: 1px solid var(--line); padding: .4rem .6rem; vertical-align: top; text-align: right; }
table.checks th { background: var(--card-2); color: var(--sky-bright); }
.nowrap { white-space: nowrap; direction: ltr; text-align: left; }
pre.small { font-size: .8rem; padding: .4rem .6rem; max-width: 22rem; white-space: pre-wrap; margin: 0; }
td.verdict.correct { color: var(--ok); font-weight: 600; }
td.verdict.incorrect { color: var(--bad); font-weight: 600; }

@media (max-width: 600px) {
  .site-header { padding: .6rem 1rem; }
  .logo { height: 32px; }
  .topic-link { grid-template-columns: 3.2rem 1fr; }
  .topic-progress { grid-column: 2; }
  .topic-group { flex-direction: column; align-items: flex-start; gap: .2rem; }
  .exercise-head { flex-direction: column; }
}
