:root {
  --ink: #2a2620;
  --muted: #6b6558;
  --red: #a6321f;
  --red-dark: #7c2417;
  --bg: #faf7f0;
  --card: #ffffff;
  --border: #e4ddc9;
  --ok: #2f7a3d;
  --bad: #a6321f;
  --warn: #a67a1f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

header.topbar h1 {
  font-size: 19px;
  margin: 0;
  color: var(--red);
}

header.topbar .who {
  font-size: 13px;
  color: var(--muted);
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card h2 {
  margin-top: 0;
  font-size: 16px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

label {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 4px;
}

input, select, button, textarea {
  font: inherit;
}

input[type=text], input[type=email], input[type=password], input[type=number], select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

button {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  cursor: pointer;
}

button:hover { background: var(--red-dark); }

button.secondary {
  background: #fff;
  color: var(--red);
}

button.secondary:hover { background: #fbeeea; }

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #f1ede0;
  color: var(--muted);
}

.pill.ok { background: #e6f3e7; color: var(--ok); }
.pill.bad { background: #fbeaea; color: var(--bad); }

.msg { font-size: 13px; margin-top: 8px; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--bad); }

.hidden { display: none !important; }

.exam-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-wrap: wrap;
}

.exam-list-item:last-child { border-bottom: none; }

.exam-code {
  font-family: ui-monospace, monospace;
  font-size: 16px;
  letter-spacing: 1px;
  background: #f1ede0;
  padding: 3px 8px;
  border-radius: 6px;
}

.qgrid {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.qcard {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  background: #fffdf8;
}

.qcard img { width: 100%; border-radius: 4px; display: block; }
.qcard .no { font-weight: bold; font-size: 13px; }

.small { font-size: 12px; color: var(--muted); }

a { color: var(--red); }

.answer-select { width: 62px; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button.tab {
  background: #fff; color: var(--muted); border: 1px solid var(--border);
}
.tabs button.tab.active { background: var(--red); color: #fff; border-color: var(--red); }

/* ---- Soru havuzu / sınav taslağı kücük görseller ---- */
.q-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 5px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: block;
  background: #f1ede0;
}

table tr[data-idx] { cursor: pointer; }
table tr[data-idx]:hover { background: #fbf8ef; }

/* ---- Soru önizleme penceresi (lightbox) ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 17, 12, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 92vw;
  max-height: 92vh;
}

.modal-content {
  background: var(--card);
  border-radius: 10px;
  padding: 16px;
  max-width: min(860px, 82vw);
  max-height: 86vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.modal-content img {
  max-width: 100%;
  max-height: 62vh;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
}

.modal-meta { text-align: center; }
.modal-actions button { min-width: 180px; }

.modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  line-height: 1;
  background: var(--ink);
  border-color: var(--ink);
}

.modal-nav {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
}
.modal-nav:hover { background: #fbeeea; color: var(--red); }
.modal-nav:disabled { opacity: 0.3; cursor: not-allowed; }

/* ---- Sınav taslağı: sürükle-bırak sıralama ---- */
.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  user-select: none;
}
#draftTbody tr[draggable="true"] { cursor: grab; }
#draftTbody tr.dragging { opacity: 0.4; background: #f1ede0; }

details > summary { cursor: pointer; }
details[open] > summary { margin-bottom: 4px; }
