:root {
  --bg: #0f1220;
  --surface: #191d33;
  --surface-2: #222741;
  --border: #2c3252;
  --text: #eef0fb;
  --muted: #9aa0c3;
  --primary: #6c7dff;
  --primary-hover: #8090ff;
  --logo-blue: #3f6cff;
  --danger: #ff6b8b;
  --ok: #4fd6a0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  background-image: url("/img/bg.png");
  background-repeat: repeat;   /* tekrarlı yerleştir */
  background-size: auto;       /* doğal boyut — büyütme yok */
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* Short views sit centered in the space below the logo */
#home, #pending { margin: auto 0; width: 100%; }

/* Footer pinned to the bottom of the page */
.page-foot {
  position: relative;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 18px 20px;
}
.app-version {
  position: absolute;
  right: 16px;
  bottom: 8px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

/* Brand logo, top-left */
.brand-corner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  align-self: flex-start;
}
.brand-icon { width: 42px; height: 42px; color: var(--logo-blue); flex: none; }
.brand-word {
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  font-weight: 800;
  font-size: 27px;
  letter-spacing: -0.5px;
}
.w-copy { color: #fff; }
.w-it { color: var(--logo-blue); }

.view { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Home ---------- */
.hero { text-align: center; margin-bottom: 32px; }
.hero-title { font-size: 28px; margin: 8px 0; }
.lede { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto; }

.name-row {
  max-width: 420px;
  margin: 0 auto 22px;
  text-align: center;
}
.name-row label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.name-input {
  width: 100%;
  font-size: 18px;
  text-align: center;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
}
.name-input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* E2E controls */
.enc-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 10px;
  user-select: none;
}
.enc-toggle input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.enc-pass {
  width: 100%;
  font-size: 15px;
  padding: 11px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  margin-bottom: 10px;
}
.enc-pass:focus { outline: 2px solid var(--primary); border-color: transparent; }
.enc-hint { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.enc-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ok);
  border: 1px solid var(--ok);
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
}

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 6px; font-size: 19px; }
.card p { margin: 0 0 18px; color: var(--muted); }
/* Birincil aksiyonu (buton / form) kart altına sabitle -> iki kart arasinda hizali */
#btn-new { width: 100%; margin-top: auto; }
.join-form { margin-top: auto; }

.join-form { display: flex; flex-direction: column; gap: 14px; }
.code-boxes { display: flex; gap: 8px; }
.code-box {
  flex: 1 1 0;
  min-width: 0;
  height: 56px;
  padding: 0;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.code-box:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}
.code-box.filled { border-color: var(--primary); }

.privacy-note {
  margin: 0 auto;
  max-width: 720px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- Buttons ---------- */
.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, transform 0.05s, border-color 0.15s;
}
.btn:hover { border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-small { padding: 7px 12px; font-size: 13px; }
.btn-ghost { background: transparent; }
.file-btn { display: inline-flex; align-items: center; }

/* ---------- Session ---------- */
.session-bar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.label { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.code-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.session-code {
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--primary-hover);
}
.session-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}
.pill-time { font-variant-numeric: tabular-nums; color: var(--text); }
.pill-time.warn { color: var(--danger); border-color: var(--danger); }

.qrcode { line-height: 0; background: white; padding: 6px; border-radius: 8px; }
.qrcode img, .qrcode canvas { display: block; }

.composer {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.text-input {
  width: 100%;
  resize: vertical;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
}
.text-input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.composer-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 12px; }

.dropzone { margin-top: 18px; border-radius: var(--radius); transition: outline 0.15s; }
.dropzone.dragover { outline: 2px dashed var(--primary); outline-offset: 6px; background: rgba(108, 125, 255, 0.06); }

.board { display: flex; flex-direction: column; gap: 12px; }
.board-empty { text-align: center; color: var(--muted); padding: 40px 0; }

.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  animation: fade 0.2s ease;
}
.item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 10px; }
.item-heading { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.item-author {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.item-kind { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.item-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.text-wrap { position: relative; }
.item-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 14px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 46px 10px 12px; /* right room for the copy icon */
  max-height: 260px;
  overflow: auto;
}
/* Shared square icon button (copy / download) */
.icon-btn {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--primary); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.copied { color: var(--ok); border-color: var(--ok); opacity: 1; }
.icon-btn svg { width: 16px; height: 16px; display: block; }

/* Overlay variant: pinned to the top-right of a text/media box, revealed on hover */
.icon-overlay { position: absolute; top: 8px; right: 8px; opacity: 0.55; }
.text-wrap:hover .icon-overlay,
.media-wrap:hover .icon-overlay,
.icon-overlay:focus-visible { opacity: 1; }

.media-wrap { position: relative; display: inline-block; max-width: 100%; }
.item-caption {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
  color: var(--text);
}
.item-actions { display: flex; gap: 8px; margin-top: 10px; }
.item-locked { color: var(--muted); font-size: 14px; padding: 4px 2px; }
.item-img { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; }
.file-row { display: flex; align-items: center; gap: 12px; }
.file-icon { font-size: 28px; }
.file-info { flex: 1; min-width: 0; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { color: var(--muted); font-size: 13px; }

.error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }

/* Danger button (Temizle) */
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }

/* Admin: join-request panel */
.requests {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.requests-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
}
.request-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
.request-row:first-child { border-top: none; }
.req-name { font-weight: 700; }
.req-msg { flex: 1; color: var(--muted); font-size: 13px; }
.btn-approve { background: var(--ok); border-color: var(--ok); color: #08231a; }
.btn-approve:hover { filter: brightness(1.08); }
.btn-reject { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-reject:hover { background: rgba(255, 107, 139, 0.1); }

/* Pending-approval view */
.pending-wrap { text-align: center; padding: 60px 20px; }
.pending-wrap h2 { margin: 18px 0 8px; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-weight: 700; letter-spacing: 3px; color: var(--primary-hover); }
.spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: fade 0.2s ease;
}
.toast.ok { border-color: var(--ok); }
.toast.err { border-color: var(--danger); }

/* Session bar stacks before the cards do */
@media (max-width: 720px) {
  .session-bar { grid-template-columns: 1fr; }
  .qrcode { justify-self: start; }
}

/* Phones */
@media (max-width: 560px) {
  main { padding: 16px 14px 40px; }
  .brand-corner { margin-bottom: 18px; }
  .brand-icon { width: 36px; height: 36px; }
  .brand-word { font-size: 22px; }

  .hero { margin-bottom: 22px; }
  .hero-title { font-size: 22px; }
  .lede { font-size: 15px; }
  .name-row { margin-bottom: 18px; }

  .cards { gap: 14px; }
  .card { padding: 18px; }

  .code-boxes { gap: 6px; }
  .code-box { height: 50px; font-size: 20px; }

  .session-bar { padding: 16px; gap: 12px; }
  .session-code { font-size: 26px; letter-spacing: 4px; }

  .composer { padding: 12px; }
  .composer-actions { justify-content: stretch; }
  .composer-actions .btn { flex: 1 1 auto; text-align: center; }

  .toast { left: 12px; right: 12px; transform: none; text-align: center; }
  .app-version { position: static; right: auto; bottom: auto; display: block; text-align: center; margin-top: 10px; }
}
