/* Bookmarks — single hand-written stylesheet. No build step. */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e2e2e2;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --danger: #b91c1c;
  --surface: #f6f6f6;
  --positive-bg: #ecfdf5;
  --positive-fg: #065f46;
  --negative-bg: #fef2f2;
  --negative-fg: #991b1b;
  --info-bg: #eff6ff;
  --info-fg: #1e40af;
  --warning-bg: #fffbeb;
  --warning-fg: #92400e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #e8e8e8;
    --muted: #9a9a9a;
    --border: #2e2e2e;
    --accent: #60a5fa;
    --accent-fg: #0b1220;
    --danger: #f87171;
    --surface: #1d1d1d;
    --positive-bg: #052e22;
    --positive-fg: #6ee7b7;
    --negative-bg: #3b0a0a;
    --negative-fg: #fca5a5;
    --info-bg: #0b2447;
    --info-fg: #93c5fd;
    --warning-bg: #3a2a05;
    --warning-fg: #fcd34d;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom);
}

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

h1 {
  font-size: 1.4rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  word-break: break-all;
}

/* ── Header / nav ─────────────────────────────────────────────────────── */

.site-header {
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top);
}

.site-nav {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  text-decoration: none;
}

.signout-form {
  display: inline;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
}

/* ── Layout ───────────────────────────────────────────────────────────── */

.content {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.flash {
  max-width: 44rem;
  margin: 0.75rem auto 0;
  padding: 0.6rem 1rem;
  border-radius: 8px;
}

.flash-positive { background: var(--positive-bg); color: var(--positive-fg); }
.flash-negative { background: var(--negative-bg); color: var(--negative-fg); }
.flash-info     { background: var(--info-bg);     color: var(--info-fg); }
.flash-warning  { background: var(--warning-bg);  color: var(--warning-fg); }

/* ── Forms ────────────────────────────────────────────────────────────── */

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 26rem;
}

.stacked-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 600;
  font-size: 0.9rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"] {
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  min-height: 44px;
  width: 100%;
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  align-self: flex-start;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.inline-form input {
  flex: 1;
  min-width: 14rem;
}

.form-error {
  color: var(--negative-fg);
  background: var(--negative-bg);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  max-width: 26rem;
}

.hint {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.auth-links {
  margin-top: 1.25rem;
  color: var(--muted);
}

.danger-form {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}

/* ── Bookmark list ────────────────────────────────────────────────────── */

.list-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.list-header h1 {
  margin: 0;
}

.search-form {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 15rem;
  max-width: 24rem;
}

.active-filter {
  color: var(--muted);
}

.bookmark-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bookmark {
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.bookmark-main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.bookmark-title {
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.bookmark-url {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}

.bookmark-date {
  color: var(--muted);
}

.tag {
  background: var(--surface);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  text-decoration: none;
  color: var(--fg);
}

.edit-link {
  margin-left: auto;
}

.empty-state {
  color: var(--muted);
  padding: 2rem 0;
  text-align: center;
}

.pagination {
  margin-top: 1.25rem;
  text-align: center;
}

/* ── Settings ─────────────────────────────────────────────────────────── */

.settings-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.session-list,
.key-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.session-row,
.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
}

.session-info,
.key-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.session-agent,
.key-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.session-detail,
.key-detail {
  color: var(--muted);
  font-size: 0.82rem;
}

.session-current {
  color: var(--positive-fg);
  background: var(--positive-bg);
  border-radius: 999px;
  padding: 0.15rem 0.7rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.secret-reveal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
}

.secret-reveal .secret {
  display: block;
  margin-top: 0.4rem;
  padding: 0.45rem 0.6rem;
  user-select: all;
  -webkit-user-select: all;
}

.secret-label {
  margin: 0.8rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* The draggable bookmarklet link — styled like a chip so it reads as "a
   thing you grab", not a normal hyperlink. */
.bookmarklet-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: grab;
}

/* ── QR codes (extension setup page) ──────────────────────────────────── */

.qr {
  display: inline-block;
  padding: 0.5rem;
  margin-top: 0.5rem;
  background: #ffffff; /* QR quiet zone must stay white in dark mode too */
  border-radius: 8px;
  line-height: 0;
}

.qr svg {
  width: 160px;
  height: 160px;
}
