/* =============================
   TCM Learn Python – Lessons
   DEDUPED CSS (structure intact)
   ============================= */

/* בסיס כללי */
body {
  margin: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  display: flex;
  height: 100vh;
  font-size: 16px;
  line-height: 1.6;
}

/* מצב כהה */
body.dark-mode {
  background-color: #1e1e1e;
  color: #d4d4d4;
}
body.dark-mode .sidebar { background-color: #252526; }
body.dark-mode .editor  { background-color: #1e1e1e; }
body.dark-mode .output  { background-color: #1e1e1e; }
body.dark-mode pre,
body.dark-mode textarea {
  background-color: #2d2d30;
  color: #ffffff;
  border: 1px solid #444;
}
body.dark-mode .output pre {
  background-color: #262626;
  color: #dcdcdc;
  border: 1px solid #444;
}

/* מצב בהיר */
body.light-mode {
  background-color: #f5f5f5;
  color: #222;
}
body.light-mode .sidebar { background-color: #f0f0f0; }
body.light-mode .editor  { background-color: #ffffff; }
body.light-mode .output  { background-color: #f9f9f9; }
body.light-mode pre,
body.light-mode textarea {
  background-color: #fff;
  color: #222;
  border: 1px solid #ccc;
}
body.light-mode .output pre {
  background-color: #eaeaea;
  color: #222;
  border: 1px solid #bbb;
}
body.light-mode #output {
  background-color: #ffffff;
  color: #222;
  border: 1px solid #ccc;
}

/* פרופורציות מבנה */
.sidebar {
  width: 35%;
  padding: 20px;
  padding-left: 20px;
  padding-right: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 2px solid #00ffff;
  box-sizing: border-box;
  max-height: 100vh;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
#lesson-content {
  flex: 1;
  min-width: 250px;
  max-width: none;
  overflow-y: auto;
  padding-bottom: 10px;
  box-sizing: border-box;
}
.editor {
  width: 45%;
  padding: 20px;
  box-sizing: border-box;
  border-right: 2px solid #00ffff;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.output {
  width: 35%;
  padding: 20px;
  box-sizing: border-box;
  height: 100vh;
  border-left: 2px solid #00ffff;
  margin-right: 10px;
  display: flex;
  flex-direction: column;
}

/* תיבת Output – שליטה בגובה ומרווח */
.output-box {
  height: 365px;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}
.output-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* אזור התקדמות */
.progress-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  margin-top: 5px;
  padding-top: 10px;
  border-top: 1px solid #444;
}
.progress-heading {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 10px;
  text-align: left;
}

/* 📦 Containers לשורות התקדמות */
.lesson-progress-container,
.overall-progress-container {
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.lesson-title,
.overall-title {
  font-size: 14px;
  font-weight: bold;
  min-width: 120px;
  text-align: right;
}

/* Progress bar */
.progress-bar {
  position: relative;
  flex-grow: 1;
  height: 12px;
  background-color: #333;
  border-radius: 8px;
  overflow: hidden;
}
.progress-lessons,
.progress-practices,
.progress-project {
  height: 100%;
  width: var(--progress-width, 0%);
  transition: width 0.3s ease;
}
.progress-lessons { background-color: #0f9cd0; }
.progress-practices { background-color: #ffa726; }
.progress-project  { background-color: #7e57c2; }
.progress-percent-label {
  min-width: 40px;
  font-size: 13px;
  font-weight: bold;
  text-align: left;
  color: #ccc;
}

/* ✅ טקסט אחוזים מעל progress-lessons */
.progress-lessons { position: relative; }
.progress-lessons::after {
  content: attr(data-percent);
  position: absolute;
  right: 5px;
  top: 0; bottom: 0;
  display: flex;
  align-items: center;
  font-size: 12px;
  font-weight: bold;
  color: white;
}
.progress-lessons[data-percent="0%"]::after { display: none; }
.progress-percent-text {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
  margin-left: 5px;
}
body.dark-mode .progress-lessons { background-color: #0f9cd0; }
body.dark-mode .progress-lessons::after { color: #fff; }
body.dark-mode .progress-percent-text { color: #aaa; }
body.light-mode .progress-lessons { background-color: #007acc; }
body.light-mode .progress-lessons::after { color: #fff; }
body.light-mode .progress-percent-text { color: #666; }

/* תיבת TCM – תופסת את כל הגובה הנותר */
.tcm-box {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* תוכן הפלט */
#output {
  flex: 1;
  width: 100%;
  min-height: 150px;
  background-color: #111;
  color: #0ff;
  padding: 10px;
  border: 1px solid #0ff;
  border-radius: 4px;
  overflow-y: auto;
  box-sizing: border-box;
  margin-top: 1px;
}

/* קונטיינר כללי */
.main-container {
  display: flex;
  width: 100vw;
  height: 100vh;
}

/* תיבת העוזר */
#tcm-box {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  border: 1px solid #0ff;
  border-radius: 4px;
  background-color: #111;
  box-sizing: border-box;
  margin-top: 10px;
}
#tcm-output {
  width: 100%;
  height: 350px;
  padding: 10px;
  border-radius: 6px;
  box-sizing: border-box;
  background-color: #111;
  color: #0ff;
  border: 1px solid #0ff;
  gap: 12px;
  scroll-behavior: smooth;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Modal לקלט */
#custom-input-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal-content {
  background: #222;
  padding: 20px;
  border-radius: 8px;
  color: #fff;
  min-width: 300px;
}
#modal-content input {
  width: 100%;
  margin-top: 10px;
}

/* מצבים כהה/בהיר ל־tcm-output */
body.dark-mode #tcm-output {
  background-color: #111;
  color: #0ff;
  border: 1px solid #0ff;
}
body.light-mode #tcm-output {
  background-color: #ffffff !important;
  color: #222 !important;
  border: 1px solid #ccc !important;
}

/* טקסט וכפתורים */
h2 {
  margin-top: 0;
  font-size: 20px;
  font-weight: 600;
}

/* עורך הקוד הראשי (textarea fallback) */
#code {
  height: 250px !important;
  flex: none !important;
  width: 100%;
  resize: vertical;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  padding: 12px;
  border-radius: 6px;
  box-sizing: border-box;
  background-color: #2d2d30;
  color: #ffffff;
  border: 1px solid #00ffff;
}

pre {
  padding: 12px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  overflow-x: auto;
}

/* שורת כפתורים */
.button-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  box-sizing: border-box;
}
.small-button {
  padding: 8px 16px;
  min-width: 100px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background: linear-gradient(135deg, #007acc, #005b99);
  color: white;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.button-row button {
  flex: 1 1 auto;
  min-width: 80px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background-color: #01130a;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  transition: background-color 0.3s ease, transform 0.1s ease;
}
.button-row button:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
}
@media (max-width: 600px) {
  .button-row { flex-wrap: wrap; }
}
button:hover {
  background: linear-gradient(135deg, #0099ff, #007acc);
  transform: translateY(-2px);
}
button:active {
  transform: translateY(0);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* 🎨 כהה/בהיר עבור כפתורים כלליים */
body.dark-mode button,
body.dark-mode .button-row button,
body.dark-mode #solution-button {
  background-color: #3a3f44 !important;
  color: #ffffff !important;
  border: none !important;
  background-image: none !important;
}
body.dark-mode button:hover,
body.dark-mode .button-row button:hover,
body.dark-mode #solution-button:hover {
  background-color: #5a6268 !important;
  transform: translateY(-2px);
}
body.light-mode button,
body.light-mode .button-row button,
body.light-mode #solution-button {
  background-color: #e2e5e9 !important;
  color: #222 !important;
  border: none !important;
  background-image: none !important;
}
body.light-mode button:hover,
body.light-mode .button-row button:hover,
body.light-mode #solution-button:hover {
  background-color: #d0d4d8 !important;
  transform: translateY(-2px);
}

/* כפתור פתרון */
#solution-button {
  flex: 1 1 auto;
  min-width: 80px;
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
  border: none;
  background-color: #3a3f44;
  color: #ffffff;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
  transition: background-color 0.3s ease, transform 0.1s ease;
}

/* אייקונים בשורת הפעולות */
.button-row button i {
  font-size: 18px;
  pointer-events: none;
  transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
}
.button-row button:nth-child(1):hover i { color: #00e676; } /* RUN */
.button-row button:nth-child(2):hover i,
.button-row button:nth-child(3):hover i { color: #42a5f5; } /* Prev/Next */
.button-row button:nth-child(4) i {
  color: var(--neon-color, #ffd600);
  filter: drop-shadow(1px 1px 3px var(--neon-color, #ffd600));
}
.button-row button:nth-child(5) i { color: #ce93d8; }       /* Mode */
.button-row button:nth-child(6):hover i { color: #26c6da; } /* Copy */

/* Sidebar: מידות ותוכן */
.sidebar {
  width: 350px;
  box-sizing: border-box;
  padding: 10px;
  overflow-y: auto;
}
.sidebar ul {
  width: 100%;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  box-sizing: border-box;
}
.sidebar li { width: 100%; }
.sidebar li div {
  width: 100%;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ביטול המשולש */
.sidebar li div::after,
.sidebar li.open > div::after { content: ""; }
.sidebar li.open > div::after { transform: rotate(90deg); }
.sidebar ul ul {
  margin-top: 5px;
  margin-left: 10px;
  padding-left: 10px;
  display: none;
}

/* נושאים */
.topic-item {
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease, color 0.3s ease, border-left 0.3s ease;
  margin-bottom: 4px;
}
.topic-item:hover,
.topic-item.active { background-color: transparent; color: inherit; }
.topic-item.active {
  background-color: #007acc;
  color: white;
  font-weight: bold;
  border-left: 4px solid #00ccff;
}
body.dark-mode .topic-item.active {
  background-color: #3a3f4b;
  font-weight: 600;
  border-left: 4px solid #00bcd4;
  padding-left: 8px;
  color: #ffffff;
}
body.light-mode .topic-item.active {
  background-color: #d0ebf9;
  font-weight: 600;
  border-left: 4px solid #1e88e5;
  padding-left: 8px;
  color: #000000;
}

/* Lesson פעיל */
#lesson-list > li.active-lesson > div {
  background-color: #3a3f4b;
  font-weight: bold;
  padding-left: 8px;
  border-left: 4px solid #00bcd4;
  color: #ffffff;
}
body.light-mode #lesson-list > li.active-lesson > div {
  background-color: #d0ebf9;
  color: #000000;
  border-left: 4px solid #1e88e5;
}

/* ✔ תוקן עבור <li> ו־.topic-item כולל subtopics */
.sidebar li,
.sidebar li.topic-item {
  display: block;
  width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

/* V-icon */
.v-icon {
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  color: gray;
}
.v-icon.enabled {
  color: dodgerblue;
  font-weight: bold;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  box-shadow: none;
}
.v-icon.auto-enabled { display: none !important; color: limegreen; }
.v-icon:not(.enabled):not(.auto-enabled) { color: gray; }
.v-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 18px;
  margin-right: 5px;
}
.topic-item .v-icon { margin-right: 5px; }

/* Modals (locked / payment) */
.modal {
  position: fixed;
  z-index: 999;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background-color: #ffffff;
  padding: 30px;
  border-radius: 14px;
  width: 420px;
  text-align: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  position: relative;
}
.modal-content h2 {
  margin-top: 0;
  font-size: 24px;
  color: #222;
}
.modal-content p {
  font-size: 16px;
  color: #333;
  margin-bottom: 10px;
}
.modal-content .register-btn {
  margin-top: 15px;
  padding: 12px 24px;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.modal-content .register-btn:hover { background-color: #0056b3; }
.close {
  position: absolute;
  right: 16px;
  top: 12px;
  font-size: 24px;
  font-weight: bold;
  color: #aaa;
  cursor: pointer;
}
.close:hover { color: #000; }

/* 🎯 Access Status Box above lessons list (גרסה אחת בלבד) */
.access-status-message {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid #00ffff;
  border-radius: 10px;
  background-color: #101820;
  color: #00f6ff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  box-shadow: 0 0 6px rgba(0, 255, 255, 0.2);
  max-width: 100%;
  white-space: normal;
}
.access-status-message i { margin-right: 6px; }
body.light-mode .access-status-message {
  background-color: #e8f9ff;
  border-color: #007acc;
  color: #004c70;
  box-shadow: 0 0 6px rgba(0, 122, 204, 0.2);
}

/* 🔒 User status box (top-right) – מוסתר בדף השיעורים */
#user-status-box { display: none !important; }

/* 🔘 Buttons container: aligned side by side */
.sidebar-nav-buttons {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* ✨ Pill-style buttons */
.pill-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: bold;
  border: 1px solid #ccc;
  border-radius: 999px;
  background-color: white;
  color: #0a1a2f;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
body.dark-mode .pill-btn {
  background-color: #2c2c2c;
  color: #ffffff;
  border: 1px solid #444;
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.05);
}
body.light-mode .pill-btn {
  background-color: #ffffff;
  color: #0a1a2f;
  border: 1px solid #ccc;
}
.pill-btn:hover {
  background-color: #007bff;
  color: white;
  transform: translateY(-1px);
}
.pill-btn i { margin-right: 6px; }

/* Scrollbar – lesson-content */
body.dark-mode #lesson-content::-webkit-scrollbar-track { background-color: #000000; }
body.light-mode #lesson-content::-webkit-scrollbar-track { background-color: #ffffff; }
#lesson-content::-webkit-scrollbar-thumb {
  background-color: var(--neon-color, #d3dcdc);
  border-radius: 4px;
}
#lesson-content::-webkit-scrollbar-thumb:hover { background-color: #8d9090; }
#lesson-content::-webkit-scrollbar { width: 8px; }

/* Scrollbar – sidebar */
body.dark-mode .sidebar::-webkit-scrollbar-track { background-color: #000000; }
body.light-mode .sidebar::-webkit-scrollbar-track { background-color: #ffffff; }
.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--neon-color, #d3dcdc);
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background-color: #8d9090; }
.sidebar::-webkit-scrollbar { width: 8px; }

/* ✅ גבול נאון לתיבות (כהה) */
body.dark-mode textarea,
body.dark-mode #code,
body.dark-mode #output,
body.dark-mode #tcm-input,
body.dark-mode #tcm-output,
body.dark-mode #tcm-box {
  border: 1px solid #00ffff;
}

/* גלילה כללית – מצב כהה */
body.dark-mode ::-webkit-scrollbar { width: 10px; height: 10px; }
body.dark-mode ::-webkit-scrollbar-track { background: #000000; }
body.dark-mode ::-webkit-scrollbar-thumb { background: #444444; border-radius: 5px; }
body.dark-mode ::-webkit-scrollbar-thumb:hover { background: #888888; }
body.dark-mode * {
  scrollbar-width: thin;
  scrollbar-color: #444444 #000000;
}

/* תצוגת שיחה */
body.dark-mode .tcm-exchange {
  background-color: #1b1b1b;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
body.light-mode .tcm-exchange {
  background-color: #f1f1f1;
  padding: 10px;
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid #ccc;
}
.tcm-exchange .user-question {
  font-weight: bold;
  color: #0be91a;
  margin-bottom: 4px;
}
.tcm-exchange .assistant-reply {
  color: #007acc;
  font-family: 'Courier New', monospace;
}

/* lesson-content scrollbar thumb */
#lesson-content::-webkit-scrollbar { width: 8px; }

/* ===== Subscription box (sidebar) ===== */
:root{
  --neon: #00e7ff;
  --neon-glow: rgba(0,231,255,.35);
}

.subscription-box{
  border: 1px solid var(--neon);
  border-radius: 12px;
  background: #0f171d;
  box-shadow: 0 0 12px var(--neon-glow);
  color: #cfefff;
}

.subscription-box .subscription-line{
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #a8f7ff;
}

.subscription-box .subscription-line strong{
  color: #00e7ff;
  font-weight: 800;
}

.subscription-box--small{
  margin: 8px 0 0 0;
  padding: 10px 12px;
}

/* שמירה על נראות טובה במצב בהיר */
.light-mode .subscription-box{
  background: #eefbff;
  color: #00333a;
  box-shadow: 0 0 10px rgba(0, 160, 180, .25);
}
.light-mode .subscription-box .subscription-line strong{
  color: #007a8a;
}
