/* tmp.durcek.dev — sibling of durcek.dev. Tokens reused from the lander. */
:root {
  --bg: #ffffff;
  --text: #111111;
  --accent: #4f46e5;
  --muted: rgba(127, 127, 127, 0.55);
  --line: rgba(127, 127, 127, 0.25);
  --panel: rgba(127, 127, 127, 0.06);
}
[data-theme="dark"] {
  --bg: #111111;
  --text: #f5f5f5;
}

* { box-sizing: border-box; }

/* the [hidden] attribute must always win over later display:flex/grid rules */
[hidden] { display: none !important; }

/* rendered text is not selectable/highlightable; editable fields stay usable */
body { -webkit-user-select: none; -ms-user-select: none; user-select: none; }
input, textarea { -webkit-user-select: text; -ms-user-select: text; user-select: text; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inconsolata", monospace;
  text-transform: lowercase;
  transition: background 0.2s ease, color 0.2s ease;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
  position: relative;
}

h1 {
  margin: 0.2rem 0 1.6rem;
  font-size: clamp(2rem, 8vw, 4.5rem);
  font-weight: 500;
}
h2 { font-weight: 500; margin: 0; font-size: 1.25rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  text-transform: lowercase;
  font-size: 1rem;
  color: var(--text);
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
button:hover { border-color: var(--accent); color: var(--accent); }

input, textarea {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  width: 100%;
}
textarea { resize: vertical; }
#shared-text { resize: none; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }

/* ---- top bar ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.theme-toggle {
  border: none; background: none; padding: 0;
  color: var(--text); font-size: 1.3rem; cursor: pointer; opacity: 0.6;
}
.theme-toggle:hover { opacity: 1; color: var(--accent); }
.auth-area { display: flex; gap: 1rem; align-items: center; font-size: 0.95rem; }
.who { color: var(--muted); }
.navlink { color: var(--accent); }

/* ---- shared text strip ---- */
.strip { margin-bottom: 2rem; }
.strip-row {
  display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem;
}
.count { color: var(--muted); font-size: 0.85rem; }
.status { color: var(--muted); font-size: 0.85rem; }
.status.err { color: #e11d48; }

/* ---- store buttons ---- */
.stores { display: flex; gap: 1rem; }
.store-btn { font-size: 1.05rem; padding: 0.6rem 1.4rem; }
.store-btn.active { border-color: var(--accent); color: var(--accent); }

/* ---- inline gallery panel (under the buttons) ---- */
.panel { margin-top: 1.25rem; }
.panel-head {
  display: flex; align-items: center; gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.panel-title { font-size: 1rem; color: var(--muted); }
.panel-head .add-btn {
  border: 1px solid var(--line); border-radius: 6px;
  width: 1.9rem; height: 1.9rem; padding: 0; font-size: 1.2rem;
}
.panel-head .add-btn:hover { border-color: var(--accent); color: var(--accent); }
.panel-body { max-height: 65vh; overflow: auto; }

/* ---- modal (login only) ---- */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 1rem; z-index: 50; overflow: auto;
}
.modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%; max-width: 780px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.modal-narrow { max-width: 360px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line);
}
.modal-actions { display: flex; gap: 0.5rem; }
.add-btn, .close-btn {
  border: none; font-size: 1.3rem; line-height: 1; padding: 0.2rem 0.6rem;
}
.modal-body { padding: 1.1rem; max-height: 72vh; overflow: auto; }
.empty { color: var(--muted); }

/* ---- add panel ---- */
.addpanel {
  display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 0.9rem; margin-bottom: 1.1rem;
}
.addpanel .priv { display: flex; align-items: center; gap: 0.4rem; width: auto; }
.addpanel .priv-cb { width: auto; accent-color: var(--accent); }
.addpanel button { align-self: flex-start; }
.orsep { color: var(--muted); font-size: 0.85rem; text-align: center; text-transform: lowercase; }
textarea.paste { font-size: 0.9rem; }

/* ---- custom file drop zone (replaces native file input UI) ---- */
/* real input kept in DOM but visually hidden (still focusable / a11y-friendly) */
.vh-file {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; border: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.dropzone {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  min-height: 4.5rem; padding: 1.3rem 1rem;
  text-align: center; cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--text) 30%, transparent);
  border-radius: 8px;
  background: transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.dropzone.dragover {
  border-style: solid;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.dz-hint { color: color-mix(in srgb, var(--text) 55%, transparent); font-size: 0.9rem; }
.dz-file { display: inline-flex; align-items: center; gap: 0.45rem; max-width: 100%; }
.dz-name {
  max-width: 22rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dz-size { color: color-mix(in srgb, var(--text) 50%, transparent); font-size: 0.85rem; }
.dz-clear {
  border: none; background: none; color: inherit; cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0 0.2rem;
}
.dz-clear:hover { color: var(--accent); }

/* ---- file tiles ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}
.tile {
  border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; display: flex; flex-direction: column;
  position: relative; background: var(--panel);
}
.tile-link { display: block; aspect-ratio: 1 / 1; cursor: pointer; }
.thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.fileicon {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.fileicon .ext {
  border: 1px solid var(--accent); color: var(--accent);
  border-radius: 6px; padding: 0.3rem 0.6rem; font-size: 0.95rem;
}
.tile-meta { padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.1rem; }
.tile-meta .name {
  font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-meta .sub { font-size: 0.75rem; color: var(--muted); }

/* item controls (lock + trash) */
.controls { display: inline-flex; gap: 0.3rem; }
.tile .controls {
  position: absolute; top: 0.4rem; right: 0.4rem;
  background: var(--bg); border-radius: 6px; padding: 0.1rem;
}
.ctrl {
  border: none; background: none; padding: 0.15rem 0.3rem;
  font-size: 0.95rem; cursor: pointer; line-height: 1;
}
.ctrl:hover { color: var(--accent); }
.ctrl.danger:hover { color: #e11d48; }

/* ---- code blocks ---- */
.codeitem { margin-bottom: 1.3rem; }
.code-head {
  display: flex; align-items: center; gap: 0.8rem;
  margin-bottom: 0.4rem; flex-wrap: wrap;
}
.code-head .name { font-weight: 500; }
.code-head .sub { color: var(--muted); font-size: 0.8rem; }
.code-head .controls { margin-left: auto; }
pre.code-pre {
  margin: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.8rem 1rem; overflow: auto; max-height: 420px;
  text-transform: none; font-size: 0.85rem;
}
pre.code-pre code { text-transform: none; }

/* ---- login ---- */
#login-form { display: flex; flex-direction: column; gap: 0.7rem; }
#login-form button { align-self: flex-start; }

/* ---- log table ---- */
.logtable { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.logtable th, .logtable td {
  text-align: left; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.logtable th { color: var(--muted); font-weight: 500; }
.logtable td { font-variant-numeric: tabular-nums; }

/* ============================ revamp: tabs / preview ===================== */

/* ---- tabs (all | code | images | +) ---- */
.tabs { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.25rem; }
.tab { font-size: 1.05rem; padding: 0.5rem 1.2rem; }
.tab.active { border-color: var(--accent); color: var(--accent); }
.tab-add { margin-left: auto; width: 2.5rem; padding: 0.5rem 0; font-size: 1.3rem; line-height: 1; }

.panel { margin-top: 1.25rem; }
.panel-body { max-height: none; }

/* private lock badge on a tile (read-only; actions live in the preview) */
.lock-badge {
  position: absolute; top: 0.4rem; right: 0.4rem;
  background: var(--bg); border-radius: 6px; padding: 0.05rem 0.3rem;
  font-size: 0.8rem; line-height: 1.4;
}

/* ---- custom checkbox (matches the app) ---- */
input[type="checkbox"].app-check {
  appearance: none; -webkit-appearance: none; margin: 0;
  width: 1.05rem; height: 1.05rem; border-radius: 4px;
  border: 1px solid color-mix(in srgb, var(--text) 35%, transparent);
  background: transparent; cursor: pointer; position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}
input[type="checkbox"].app-check:hover { border-color: var(--accent); }
input[type="checkbox"].app-check:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"].app-check:checked::after {
  content: ''; position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px; border: solid var(--bg); border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"].app-check:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 1px;
}
.priv { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; }
.priv-text { font-size: 0.95rem; }
.add-name { width: 100%; }

/* ---- on/off switch (private toggle in preview) ---- */
.switch { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative; width: 2.3rem; height: 1.25rem; border-radius: 999px;
  background: color-mix(in srgb, var(--text) 25%, transparent);
  transition: background 0.15s ease;
}
.switch-knob {
  position: absolute; top: 2px; left: 2px;
  width: calc(1.25rem - 4px); height: calc(1.25rem - 4px);
  border-radius: 50%; background: var(--bg);
  transition: transform 0.15s ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(1.05rem); }
.switch input:focus-visible + .switch-track {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: 2px;
}
.switch-text { font-size: 0.9rem; }

/* ---- preview modal ---- */
.modal-preview { max-width: 820px; }
.preview-title {
  max-width: 70%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-area {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); padding: 0.6rem; margin-bottom: 1rem;
  min-height: 6rem; max-height: 60vh; overflow: auto;
}
.pv-img { max-width: 100%; max-height: 56vh; object-fit: contain; display: block; }
.preview-area pre.code-pre {
  width: 100%; max-height: 56vh; margin: 0; border: none; background: transparent;
}
.pv-none {
  display: flex; flex-direction: column; align-items: center; gap: 0.7rem;
  padding: 1.5rem; color: var(--muted);
}
.pv-none .fileicon { width: 4rem; height: 4rem; }

.meta-list {
  display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem;
  margin: 0 0 1rem; font-size: 0.9rem;
}
.meta-list dt { color: var(--muted); }
.meta-list dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview-actions { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.act-btn {
  font-family: inherit; text-transform: lowercase; font-size: 1rem;
  color: var(--text); background: none; border: 1px solid var(--line);
  border-radius: 6px; padding: 0.4rem 0.9rem; cursor: pointer; text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.act-btn:hover { border-color: var(--accent); color: var(--accent); }
.danger-btn { margin-left: auto; }
.danger-btn:hover { border-color: #e11d48; color: #e11d48; }
