/* Minimal, clean UI (no framework) */
:root{
  --bg:#0b0f14;
  --panel:#0f1620;
  --panel2:#0c121a;
  --text:#e6edf3;
  --muted:#9aa7b4;
  --line:#223041;
  --primary:#4aa3ff;
  --danger:#ff5a6b;
  --chip:#142236;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --r:14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}
*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; font-family:var(--sans); background:var(--bg); color:var(--text); }
.app{ height:100%; display:flex; }
.sidebar{
  width:360px; background:linear-gradient(180deg,var(--panel),var(--panel2));
  border-right:1px solid var(--line);
  display:flex; flex-direction:column; padding:16px; gap:14px;
}
.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:44px; height:44px; border-radius:12px; background:var(--chip);
  display:flex; align-items:center; justify-content:center; font-weight:800;
  border:1px solid var(--line);
}
.title{ font-weight:800; letter-spacing:.2px; }
.gearBtn{
  border:0;
  background:transparent;
  cursor:pointer;
  font-size:16px;
  line-height:1;
  padding:6px 8px;
  border-radius:10px;
  color:var(--muted);
}
.gearBtn:hover{ background:rgba(255,255,255,.06); color:var(--text); }
.gearBtn:active{ transform: translateY(1px); }
.sub{ color:var(--muted); font-size:12px; margin-top:2px; }
.courseMeta{ padding:12px; border:1px solid var(--line); border-radius:var(--r); background:rgba(255,255,255,.02); }
.courseMeta label{ display:block; font-size:12px; color:var(--muted); margin:10px 0 6px; }
.courseMeta label:first-child{ margin-top:0; }
.courseMeta input, .courseMeta select{
  width:100%; padding:10px 10px; border-radius:12px; border:1px solid var(--line);
  background:#0b121b; color:var(--text);
}
.row{ display:flex; gap:10px; }
.col{ flex:1; }
.sectionHeader{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.itemList{
  flex:1; overflow:auto; padding-right:4px;
  display:flex; flex-direction:column; gap:10px;
}
.item{
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  border-radius:var(--r);
  padding:10px;
  display:flex; gap:10px; align-items:flex-start;
  cursor:pointer;
}
.item:hover{ background:rgba(255,255,255,.04); }
.item.active{ outline:2px solid rgba(74,163,255,.6); }
.badge{
  font-size:11px; padding:4px 8px; border-radius:999px; background:var(--chip); border:1px solid var(--line);
  color:var(--muted);
}
.itemMain{ flex:1; min-width:0; }
.itemTitle{ font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.itemMeta{ margin-top:6px; display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.gear{
  width:34px; height:34px; border-radius:12px; border:1px solid var(--line);
  background:transparent; color:var(--muted);
  display:flex; align-items:center; justify-content:center;
}
.gear:hover{ color:var(--text); background:rgba(255,255,255,.04); }
.sidebarFooter{ display:flex; gap:10px; }
.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  cursor:pointer;
  flex:1;
}
.btn:hover{ background:rgba(255,255,255,.06); }
.btn.primary{ background:rgba(74,163,255,.15); border-color:rgba(74,163,255,.4); }
.btn.primary:hover{ background:rgba(74,163,255,.22); }
.btn.danger{ background:rgba(255,90,107,.12); border-color:rgba(255,90,107,.35); }
.btn.danger:hover{ background:rgba(255,90,107,.18); }
.main{ flex:1; display:flex; flex-direction:column; min-width:0; }

/* Course create overlay (iframe) */
.cc-overlay{ position:fixed; inset:0; z-index:9999; display:none; }
.cc-overlay__backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }
.cc-overlay__panel{
  position:relative;
  width:min(1200px, calc(100vw - 28px));
  height:min(840px, calc(100vh - 28px));
  margin:14px auto;
  background:#fff;
  color:#0f172a;
  border:1px solid rgba(0,0,0,.10);
  border-radius:18px;
  box-shadow:0 16px 60px rgba(0,0,0,.45);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.cc-overlay__top{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 14px; border-bottom:1px solid rgba(0,0,0,.10); background:#fff; }
.cc-overlay__body{ flex:1; }
.cc-overlay__body iframe{ width:100%; height:100%; border:0; background:#fff; }
.topbar{
  height:62px; display:flex; align-items:center; justify-content:space-between;
  padding:0 18px; border-bottom:1px solid var(--line); background:rgba(255,255,255,.02);
}
.crumb{ color:var(--muted); font-family:var(--mono); font-size:12px; }
.actions{ display:flex; gap:10px; }
.editorPane{ flex:1; overflow:auto; padding:18px; }
.emptyState{
  border:1px dashed var(--line); border-radius:var(--r); padding:26px; max-width:760px;
}
.emptyState .emoji{ font-size:28px; }
.emptyState .h1{ font-weight:900; font-size:20px; margin-top:10px; }
.emptyState .p{ color:var(--muted); margin-top:6px; line-height:1.5; }

.card{
  max-width:920px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  border-radius:var(--r);
  padding:14px;
  box-shadow:var(--shadow);
}
.card h2{ margin:0 0 10px; }
.field{ margin-top:12px; }
.field label{ display:block; font-size:12px; color:var(--muted); margin-bottom:6px; }
.field input, .field select, .field textarea{
  width:100%; padding:10px 10px; border-radius:12px; border:1px solid var(--line);
  background:#0b121b; color:var(--text);
}
.richbar{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.richbar button{
  padding:8px 10px; border-radius:12px; border:1px solid var(--line);
  background:rgba(255,255,255,.03); color:var(--text); cursor:pointer;
}
.richbar button:hover{ background:rgba(255,255,255,.06); }
.rich{
  min-height:220px;
  border:1px solid var(--line);
  border-radius:12px;
  padding:12px;
  background:#0b121b;
}

/* Rich editor: image figure (Word-like resize via drag) */
.rich .ev-figure{
  display:inline-block;
  max-width:100%;
  resize: horizontal;
  overflow:auto;
  border:1px dashed rgba(255,255,255,.25);
  border-radius:12px;
  padding:6px;
  background: rgba(255,255,255,.04);
}
.rich .ev-figure img{
  width:100%;
  height:auto;
  display:block;
  border-radius:10px;
}

/* Word-like table picker */
.ev-tablePicker{
  position:fixed;
  z-index:99999;
  background:#ffffff;
  color:#111827;
  border:1px solid rgba(17,24,39,.14);
  border-radius:14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  padding:12px;
  width: 260px;
}
.ev-tablePicker .tp-title{ font-weight:800; margin-bottom:10px; color:#111827; }
.ev-tablePicker .tp-grid{
  display:grid;
  grid-template-columns: repeat(10, 18px);
  gap:6px;
  padding-bottom:10px;
}
.ev-tablePicker .tp-cell{
  width:18px;
  height:18px;
  border:2px solid rgba(17,24,39,.25);
  border-radius:4px;
  background:transparent;
}
.ev-tablePicker .tp-cell.is-active{
  background: rgba(59,130,246,.18);
  border-color: rgba(59,130,246,.55);
}
.ev-tablePicker .tp-dims{ color: rgba(17,24,39,.65); font-size:12px; }
.rich:focus{ outline:2px solid rgba(74,163,255,.35); }
.grid2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.hr{ height:1px; background:var(--line); margin:14px 0; }
.menu{
  position:fixed; left:16px; top:16px;
  background:#0b121b; border:1px solid var(--line); border-radius:14px;
  box-shadow:var(--shadow);
  overflow:hidden;
  width:260px;
  z-index:50;
}
.menu.hidden{ display:none; }
.menu button{
  width:100%;
  padding:12px 12px;
  background:transparent;
  border:0;
  color:var(--text);
  text-align:left;
  cursor:pointer;
}
.menu button:hover{ background:rgba(255,255,255,.06); }

.modalOverlay{
  position:fixed; inset:0; background:rgba(0,0,0,.55); z-index:60;
  display:flex; align-items:center; justify-content:center;
}
.modal{
  width:min(720px, calc(100vw - 24px));
  border-radius:18px; border:1px solid var(--line);
  background:#0b121b; box-shadow:var(--shadow);
  padding:14px;
}
.modalTop{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.kv{ display:flex; gap:12px; flex-wrap:wrap; margin-top:12px; }
.kv .chip{ background:var(--chip); border:1px solid var(--line); padding:8px 10px; border-radius:999px; color:var(--muted); font-size:12px; }

/* Quiz choice chips: prevent .field input{width:100%} from breaking layout inside chips */
.kv .chip{
  display:flex;
  align-items:center;
  gap:10px;
}
.kv .chip input,
.kv .chip select,
.kv .chip textarea{
  width:auto; /* override .field input{width:100%} */
}
.kv .chip input[type="radio"]{
  flex:0 0 auto;
}
.kv .chip input.cText{
  flex:1 1 260px;
  min-width:220px;
}
.kv .chip .btn{
  flex:0 0 auto;
}
.small{ color:var(--muted); font-size:12px; line-height:1.5; }

/* === Embed + Light Theme overrides (portal uyumlu) === */
.ev-light{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --panel2:#ffffff;
  --text:#0f172a;
  --muted:#5b6472;
  --line:rgba(15,23,42,.12);
  --primary:#2563eb;
  --danger:#dc2626;
  --chip:rgba(37,99,235,.08);
  --shadow: 0 10px 30px rgba(2,6,23,.10);
}
.ev-light .sidebar{ background: linear-gradient(180deg,var(--panel),var(--panel2)); }
.ev-light .topbar{ background: rgba(255,255,255,.85); border-bottom:1px solid var(--line); }
.ev-light input,.ev-light textarea,.ev-light select{
  background:#fff;
  border:1px solid var(--line);
  color:var(--text);
}
.ev-light .btn{ background: #fff; border:1px solid var(--line); }
.ev-light .btn.primary{ background: rgba(37,99,235,.10); border-color: rgba(37,99,235,.35); }
.ev-embed .courseMeta{ display:none !important; }

/* Light theme: add menu */
.ev-light .menu{
  background:#ffffff;
  border:1px solid rgba(15,23,42,.12);
}
.ev-light .menu button{ color:#0f172a; }
.ev-light .menu button:hover{ background: rgba(15,23,42,.04); }

/* Light theme: rich editor background */
.ev-light .rich{
  background:#ffffff !important;
  color: var(--text) !important;
}
.ev-light .rich *{ color: inherit; }

.card2{ padding:12px; border:1px solid rgba(15,23,42,.10); border-radius:14px; background: rgba(255,255,255,.65); margin-top:12px; }
.ev-light .card2{ background:#fff; }

/* Builder in-course skin */
.ev-builder-in-course{
  background:#f6f7fb;
}
.ev-builder-in-course .sidebar{
  background:#fff;
  border-right:1px solid rgba(15,23,42,.08);
}
.ev-builder-in-course .btn.primary{
  background: rgba(127,29,29,.10);
  border-color: rgba(127,29,29,.35);
}
.ev-builder-in-course .btn.primary:hover{ background: rgba(127,29,29,.14); }


/* Light theme: modal panel should be white (no navy) */
.ev-light .modal{
  background:#ffffff !important;
  color: var(--text) !important;
}
.ev-light .modal .pill, .ev-light .modal .chip, .ev-light .modal .tag{
  background: rgba(37,99,235,.08) !important;
  color: var(--text) !important;
}
.ev-light .backdrop{ background: rgba(2,6,23,.35) !important; }


/* --- Drag & drop reorder --- */
.dragHandle{
  width:24px;
  height:34px;
  border-radius:10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  color:var(--muted);
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:grab;
  user-select:none;
}
.dragHandle:active{ cursor:grabbing; }
.item.dragOver{ outline:2px dashed rgba(74,163,255,.45); }
.item.dragging{ opacity:.6; }
