/* SITE-OWNED: each site edits its own copy of this file (see
   baseline-manifest.txt). Loaded after style.css on every page, so rules
   here add to or override the shared Baseline styles. Put all
   site-specific CSS here; never edit style.css in a site. */

/* Bookmarks: folder tree, bookmark list, reminders, modals, and this
   site's own tuning of the Space theme's transparency. */

/* ===========================================================
   Theme tokens -- light is the default/unchanged look (:root).
   [data-theme="dark"] and [data-theme="space"] override just the
   color tokens; every rule below reads colors through var(...) so
   switching the attribute on <body> re-themes the whole page.
   Space reuses dark's tokens almost entirely (the user described
   it as "a deviation on the dark profile") and adds a background
   image + translucent surfaces on top.
   =========================================================== */
:root {
  --bg: #ffffff;

  --nav-bg: #2f3542;
  --nav-text: #cfd3da;
  --nav-link: #ffffff;
  --nav-link-hover: #70a1ff;

  --title-bg: #ffffff;
  --title-text: #000000;

  --errormsg-bg: #fdecea;
  --errormsg-border: #f3b4b0;
  --errormsg-text: #b3261e;

  --successmsg-bg: #e8f5e9;
  --successmsg-border: #a8d8ab;
  --successmsg-text: #1e7e34;

  /* card-like surfaces (profile/auth cards, the bookmark browser) --
     translucent only in space, opaque everywhere else */
  --surface: #ffffff;
  --surface-border: #dde2ea;
  --card-blur: none;
  --shadow-card: 0 2px 10px rgba(0,0,0,0.1);

  /* modals stay opaque in every theme, deliberately not tied to
     --surface -- a floating dialog should always be crisp to read */
  --modal-surface: #ffffff;
  --modal-shadow: 0 20px 60px -20px rgba(0,0,0,.4);
  --modal-backdrop: rgba(20,25,40,.45);

  --sidebar-bg: #eef1f6;
  --row-hover: #dde2ea;

  --text-primary: #1b2130;
  --text-muted: #6b7385;
  --label-color: #555555;

  --input-border: #d5d8dc;
  --input-focus: #70a1ff;

  --btn-primary-bg: #2f3542;
  --btn-primary-hover: #1e2530;
  --btn-primary-text: #ffffff;

  --btn-secondary-bg: #ffffff;
  --btn-secondary-border: #d5d8dc;
  --btn-secondary-hover-border: #70a1ff;
  --btn-secondary-text: #2f3542;

  --icon-bg: #ffffff;
  --icon-border: #dde2ea;
  --icon-color: #6b7385;

  --accent: #2f6fed;
  --accent-bg: #e9f0ff;
  --accent-contrast: #ffffff;
  --danger: #d1495b;

  --space-bg-image: none;
}

[data-theme="dark"],
[data-theme="space"] {
  --bg: #10131a;

  --nav-bg: #1a1e27;
  --nav-text: #aab0bd;
  --nav-link: #e7eaf0;
  --nav-link-hover: #8fb4ff;

  --title-bg: #10131a;
  --title-text: #e7eaf0;

  --errormsg-bg: #3a2226;
  --errormsg-border: #6b3238;
  --errormsg-text: #f28b8b;

  --successmsg-bg: #1e3324;
  --successmsg-border: #2f5c3c;
  --successmsg-text: #7fd99a;

  --surface: #1c212c;
  --surface-border: #2a3040;
  --card-blur: none;
  --shadow-card: 0 2px 10px rgba(0,0,0,0.4);

  --modal-surface: #1c212c;
  --modal-shadow: 0 20px 60px -20px rgba(0,0,0,.7);
  --modal-backdrop: rgba(6,8,14,.6);

  --sidebar-bg: #171b24;
  --row-hover: #262c3a;

  --text-primary: #e7eaf0;
  --text-muted: #8891a3;
  --label-color: #aab0bd;

  --input-border: #2a3040;
  --input-focus: #8fb4ff;

  --btn-primary-bg: #4a7dfd;
  --btn-primary-hover: #6d97ff;
  --btn-primary-text: #ffffff;

  --btn-secondary-bg: #1c212c;
  --btn-secondary-border: #2a3040;
  --btn-secondary-hover-border: #8fb4ff;
  --btn-secondary-text: #e7eaf0;

  --icon-bg: #232838;
  --icon-border: #2a3040;
  --icon-color: #aab0bd;

  --accent: #8fb4ff;
  --accent-bg: #232c42;
  --accent-contrast: #10131a;
  --danger: #e5677c;
}

/* space = dark, plus a full-page background image and translucent
   surfaces so it shows through. $space-bg-image is set inline, per
   page, in PHP (this week's rotating image). */
[data-theme="space"] {
  --surface: rgba(24,28,38,.48);
  --sidebar-bg: rgba(15,18,25,.42);
  --row-hover: rgba(255,255,255,.08);
  --icon-bg: rgba(255,255,255,.06);
  --card-blur: blur(14px) saturate(140%);
}

/* space theme: .title is otherwise a full-width bar, which over the
   background image reads as a stray black stripe running edge to edge.
   Shrink it to a snug, centered capsule around just the heading text
   instead, on every page (login/profile/etc, not just bookmark/reminder)
   since .title is the same shared header everywhere. */
[data-theme="space"] .title {
  width: fit-content;
  margin: 16px auto 0;
  padding: 6px 28px;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
}

[data-theme="space"] .title h1 { margin: 0; }

/* ----------------------------------------- */
/* Bookmarks browser (class=bookmark-page) -- directory-style folder tree
   + bookmark rows. Everything scoped under .bookmark-page, same reasoning
   as .profile-page: generic names like .row/.tree/.actions can't collide
   with anything else in this site-wide stylesheet. */
.bookmark-page {
  display: grid;
  grid-template-columns: 260px 1fr;
  max-width: 980px;
  margin: 20px auto;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: var(--card-blur);
  -webkit-backdrop-filter: var(--card-blur);
  box-shadow: var(--shadow-card);
}

.bookmark-page .sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--surface-border);
  padding: 16px 8px;
}

.bookmark-page .section-head { display: flex; align-items: center; justify-content: space-between; }

.bookmark-page .sidebar-label { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-muted); padding: 0 12px 8px; }

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

.bookmark-page .tree li.tree-row { display: flex; align-items: center; gap: 2px; }

.bookmark-page .tree-row .tree-delete { flex: none; margin-right: 6px; }

.bookmark-page .tree a {
  display: flex; align-items: center; padding: 7px 12px; border-radius: 6px;
  color: var(--text-primary); text-decoration: none; font-size: 14px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
}

.bookmark-page .tree a:hover { background: var(--row-hover); }

.bookmark-page .tree a.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }

.bookmark-page .tree a.top { font-weight: 600; }

.bookmark-page .add-btn {
  flex: none; border: 1px solid var(--icon-border); background: var(--icon-bg); color: var(--icon-color);
  border-radius: 6px; width: 24px; height: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.bookmark-page .add-btn:hover { color: var(--accent); border-color: var(--accent); }

.bookmark-page .main .add-btn { width: 30px; height: 30px; }

.bookmark-page .main { padding: 20px 26px 30px; }

.bookmark-page .main .section-head { margin-bottom: 16px; }

.bookmark-page .main h2 { font-family: Georgia, "Times New Roman", serif; font-size: 20px; margin: 0; color: var(--text-primary); }

.bookmark-page .row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 8px; }

.bookmark-page .row:hover { background: var(--row-hover); }

.bookmark-page .row + .row { border-top: 1px solid var(--surface-border); }

.bookmark-page .swatch {
  flex: none; width: 30px; height: 30px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font: 600 12px/1 Helvetica, Verdana, sans-serif; color: #ffffff;
}

.bookmark-page .meta { min-width: 0; flex: 1; }

.bookmark-page .row .name { font-size: 14.5px; font-weight: 600; color: var(--text-primary); text-decoration: none; display: block; }

.bookmark-page .row .name:hover { color: var(--accent); }

.bookmark-page .actions { display: flex; gap: 4px; flex: none; }

/* a form wrapping a single delete button shouldn't affect the flex layout
   of its parent row -- display:contents makes the <form> "transparent" */
.bookmark-page .inline-form { display: contents; }

.bookmark-page .actions button, .bookmark-page .tree-delete {
  border: 1px solid var(--icon-border); background: var(--icon-bg); color: var(--icon-color);
  border-radius: 6px; width: 30px; height: 30px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.bookmark-page .actions .copy:hover, .bookmark-page .actions .favorite:hover { color: var(--accent); border-color: var(--accent); }

.bookmark-page .actions .danger:hover, .bookmark-page .tree-delete:hover { color: var(--danger); border-color: var(--danger); }

.bookmark-page .no-links { color: var(--text-muted); font-size: 13.5px; padding: 6px 8px; }

/* add-folder / add-bookmark / add-to-favorites dialog -- deliberately NOT
   scoped under .bookmark-page: this overlay sits as a sibling after that
   container closes (so its position:fixed isn't affected by anything),
   and "modal-backdrop"/"modal"/"modal-buttons" are already distinctive
   enough names not to need the extra scoping. Uses --modal-surface (always
   opaque) rather than --surface, so it stays crisp over any theme. */
.modal-backdrop {
  position: fixed; inset: 0; background: var(--modal-backdrop);
  display: none; align-items: center; justify-content: center; z-index: 10;
}

.modal-backdrop.open { display: flex; }

.modal { background: var(--modal-surface); border-radius: 12px; padding: 22px 24px; width: 320px; box-shadow: var(--modal-shadow); }

.modal h3 { font-family: Georgia, "Times New Roman", serif; margin: 0 0 16px; font-size: 17px; color: var(--text-primary); }

.modal label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin: 12px 0 5px; }

.modal label:first-of-type { margin-top: 0; }

.modal input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: 6px;
  font-size: 14px; box-sizing: border-box; background: var(--modal-surface); color: var(--text-primary);
}

.modal input:focus { outline: none; border-color: var(--accent); }

.modal-buttons { display: flex; gap: 8px; margin-top: 18px; }

.modal-buttons button { flex: 1; padding: 9px; border-radius: 6px; font-size: 13.5px; cursor: pointer; border: 1px solid var(--surface-border); }

.modal-buttons .primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.modal-buttons .cancel { background: var(--modal-surface); color: var(--text-muted); }

@media (max-width: 640px) {
  .bookmark-page { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .bookmark-page .sidebar { border-right: none; border-bottom: 1px solid var(--surface-border); }
}

/* ----------------------------------------- */
/* the edit-reminder modal reuses .modal but adds <select>/<textarea>,
   which .modal input's rules don't cover */
.modal select, .modal textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: 6px;
  font-size: 14px; box-sizing: border-box; background: var(--modal-surface); color: var(--text-primary);
  font-family: inherit;
}

.modal select:focus, .modal textarea:focus { outline: none; border-color: var(--accent); }

.modal textarea { resize: vertical; }

/* ===== Reminders ===== */
/* same card treatment as .bookmark-page -- opaque in light/dark, translucent
   + blurred over the background image in space, via the shared --surface/
   --card-blur tokens */
.reminder-page {
  max-width: 980px; margin: 20px auto; box-sizing: border-box;
  border: 1px solid var(--surface-border); border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow-card);
  backdrop-filter: var(--card-blur); -webkit-backdrop-filter: var(--card-blur);
}

/* same idea as .bookmark-page .sidebar -- a visually distinct band using
   --sidebar-bg, separating the quick-add/tabs/filter "controls" from the
   reminder list itself. No overflow:hidden on .reminder-page (it would
   clip the category-filter-popover), so the top corners are rounded here
   to match the card's own radius instead. */
.reminder-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid var(--surface-border);
  border-radius: 11px 11px 0 0;
  padding: 20px 26px 18px;
}

.reminder-list { padding: 18px 26px 30px; }

.reminder-quickadd { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }

.reminder-quickadd input[type="text"] {
  flex: 1; padding: 10px 12px; border: 1px solid var(--input-border); border-radius: 8px;
  font-size: 14.5px; background: var(--surface); color: var(--text-primary); box-sizing: border-box;
}

.reminder-quickadd input[type="text"]:focus { outline: none; border-color: var(--input-focus); }

.reminder-quickadd select {
  flex: none; padding: 10px 8px; border: 1px solid var(--input-border); border-radius: 8px;
  font-size: 13.5px; background: var(--surface); color: var(--text-primary);
}

.reminder-quickadd select:focus { outline: none; border-color: var(--input-focus); }

.reminder-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

.reminder-tabs { display: flex; gap: 4px; }

.reminder-tabs a { padding: 6px 12px; border-radius: 6px; font-size: 13.5px; text-decoration: none; color: var(--text-muted); font-weight: 600; }

.reminder-tabs a:hover { background: var(--row-hover); }

.reminder-tabs a.active { background: var(--accent-bg); color: var(--accent); }

.reminder-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.filter-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-muted);
  padding: 4px 8px; border-radius: 6px; border: 1px solid var(--surface-border); cursor: pointer;
}

.category-filter { position: relative; }

.category-filter-btn { display: inline-flex; align-items: center; gap: 6px; }

.category-filter-badge { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex: none; }

.category-filter-popover {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 20;
  flex-direction: column; gap: 2px; background: var(--modal-surface); border: 1px solid var(--surface-border);
  border-radius: 8px; box-shadow: var(--modal-shadow); padding: 8px; min-width: 190px;
  max-height: 260px; overflow-y: auto;
}

.category-filter-popover.open { display: flex; }

.category-filter-popover .filter-chip { border: none; padding: 5px 8px; width: 100%; box-sizing: border-box; }

.category-filter-popover .filter-chip:hover { background: var(--row-hover); }

.category-filter-sep { height: 1px; background: var(--surface-border); margin: 4px 0; }

.select-all-chip strong { font-weight: 600; color: var(--text-primary); }

.reminder-page button.primary, .reminder-page button.secondary, .reminder-page button.danger {
  border-radius: 6px; padding: 7px 14px; font-size: 13.5px; cursor: pointer; border: 1px solid var(--surface-border);
}

.reminder-page button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.reminder-page button.secondary { background: var(--surface); color: var(--text-primary); }

.reminder-page button.danger { background: var(--surface); color: var(--icon-color); }

.reminder-page button.danger:hover { color: var(--danger); border-color: var(--danger); }

.reminder-page button.icon-btn { flex: none; width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; }

.reminder-page .add-btn {
  flex: none; border: 1px solid var(--icon-border); background: var(--icon-bg); color: var(--icon-color);
  border-radius: 6px; width: 24px; height: 24px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

.reminder-page .add-btn:hover { color: var(--accent); border-color: var(--accent); }

.reminder-page .no-links { color: var(--text-muted); font-size: 13.5px; padding: 6px 8px; }

.reminder-page .inline-form { display: contents; }

.reminder-row { display: flex; align-items: flex-start; gap: 12px; padding: 8px 10px; border-radius: 8px; }

.reminder-row:hover { background: var(--row-hover); }

.reminder-row + .reminder-row { border-top: 1px solid var(--surface-border); }

.reminder-body { flex: 1; min-width: 0; }

.reminder-note { font-size: 14.5px; color: var(--text-primary); white-space: pre-wrap; }

.reminder-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }

.reminder-actions { display: flex; gap: 6px; flex: none; }

.priority-badge {
  flex: none; min-width: 28px; text-align: center; font: 700 12px/1.6 Helvetica, Verdana, sans-serif;
  padding: 4px 6px; border-radius: 6px; background: var(--accent-bg); color: var(--accent);
}

.category-badge {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: var(--icon-bg); border: 1px solid var(--icon-border); color: var(--text-muted);
}

.followup-date.overdue { color: var(--danger); font-weight: 600; }

.daterange-field { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-muted); }

.daterange-field input[type="date"] {
  padding: 5px 7px; border: 1px solid var(--surface-border); border-radius: 6px;
  font-size: 12.5px; background: var(--surface); color: var(--text-primary);
}

.daterange-field input[type="date"]:focus { outline: none; border-color: var(--input-focus); }

.modal.wide { width: 380px; }

.category-manage-list { display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }

.category-manage-row { display: flex; align-items: center; gap: 6px; }

.category-manage-row .inline-form { display: contents; }

.category-manage-row .category-rename-input {
  flex: 1; width: auto; padding: 7px 9px; border: 1px solid var(--surface-border); border-radius: 6px;
  font-size: 13.5px; box-sizing: border-box; background: var(--modal-surface); color: var(--text-primary);
}

.category-manage-row .category-rename-input:focus { outline: none; border-color: var(--accent); }

/* .reminder-page button.icon-btn/.primary/.secondary/.danger don't reach
   here -- this modal is a sibling of .reminder-page, not a descendant */
.category-manage-row button {
  flex: none; width: 32px; height: 32px; padding: 0; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--surface-border); display: flex; align-items: center; justify-content: center;
}

.category-manage-row button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.category-manage-row button.secondary { background: var(--surface); color: var(--text-primary); }

.category-manage-row button.danger { background: var(--surface); color: var(--icon-color); }

.category-manage-row button.danger:hover { color: var(--danger); border-color: var(--danger); }

.category-manage-sep { height: 1px; background: var(--surface-border); margin: 12px 0; }

.note-history { margin-top: 12px; max-height: 160px; overflow-y: auto; }

.note-history-label { font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }

.note-history-entry {
  font-size: 13px; color: var(--text-primary); padding: 5px 0;
  border-top: 1px solid var(--surface-border); white-space: pre-wrap;
}

.note-history-entry:first-of-type { border-top: none; }

.note-history-date { font-weight: 600; color: var(--text-muted); margin-right: 6px; }

.reminder-notes-section { padding: 4px 26px 26px; border-top: 1px solid var(--surface-border); }

.reminder-notes-section h3 {
  font-family: Georgia, "Times New Roman", serif; font-size: 15px; margin: 18px 0 10px; color: var(--text-primary);
}

.reminder-notes-section .notes-range { font-family: inherit; font-size: 12.5px; font-weight: normal; color: var(--text-muted); }

.reminder-note-entry { padding: 8px 10px; border-radius: 8px; }

.reminder-note-entry:hover { background: var(--row-hover); }

.reminder-note-entry + .reminder-note-entry { border-top: 1px solid var(--surface-border); }

.note-entry-head { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 3px; }

.note-entry-date { font-weight: 600; color: var(--text-primary); }

.note-entry-text { font-size: 14px; color: var(--text-primary); white-space: pre-wrap; }

.priority-fields { display: flex; gap: 8px; }

.priority-fields select { flex: 1; }
