/* StartBookmarks v2.1 | © 2026 Tous droits réservés — Tanis · Stephan.R · France */
/* ===================================================
   MAIN CSS — Layout, components, utilities
   =================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  height: 100%;
}

body {
  font-family: var(--font-family, 'Inter', 'Segoe UI', system-ui, sans-serif);
  background: var(--bg-base);
  color: var(--text-primary);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: background 0.3s, color 0.3s;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }

/* ---------- HEADER ---------- */
#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-icon {
  width: 22px; height: 22px;
  color: var(--accent);
}

.app-title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  white-space: nowrap;
}

/* Search */
.header-search {
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon-svg {
  position: absolute;
  left: 12px;
  width: 16px; height: 16px;
  color: var(--text-secondary);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 36px;
  padding: 0 14px 0 38px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 18px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#search-input:focus {
  background: var(--bg-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--input-focus);
}

#search-input::placeholder { color: var(--text-muted); }

/* Search suggestions */
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 200;
  max-height: 320px;
  overflow-y: auto;
}

.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-primary);
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.search-suggestion-item:last-child { border-bottom: none; }
.search-suggestion-item:hover,
.search-suggestion-item.focused { background: var(--bg-hover); }

.suggestion-favicon {
  width: 16px; height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  object-fit: contain;
}

.suggestion-info { flex: 1; min-width: 0; }
.suggestion-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggestion-url { font-size: 0.75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.suggestion-web-icon {
  width: 16px; height: 16px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}

.header-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }
.header-btn.active { background: var(--accent-dim); color: var(--accent-text); border-color: var(--accent); }

/* Hamburger trigger — desktop hidden, shown only on narrow screens */
.nav-toggle { display: none; padding: 6px; }
.nav-toggle svg { width: 20px; height: 20px; }

/* Admin button — accent outline to stand out (admins only) */
.header-btn-admin { border-color: var(--accent); color: var(--accent); }
.header-btn-admin:hover { background: var(--accent-dim); color: var(--accent-text); border-color: var(--accent); }
/* Pastille de signalements non lus */
.admin-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff;
  font-size: 0.62rem; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; line-height: 1; box-shadow: 0 0 0 2px var(--header-bg, var(--bg-base));
}

/* Premium banner (free accounts) */
.premium-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 16px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--accent-dim), transparent);
  border: 1px solid var(--accent);
}
.premium-banner-text { font-size: .85rem; color: var(--text-primary); font-weight: 500; }
.premium-banner-btn {
  flex-shrink: 0;
  padding: 6px 16px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff; font-weight: 600; font-size: .82rem;
  cursor: pointer; transition: filter .15s;
}
.premium-banner-btn:hover { filter: brightness(1.12); }

/* ---------- PAGES NAV ---------- */
#pages-nav {
  position: fixed;
  top: 56px; left: 0; right: 0;
  height: 40px;
  z-index: 90;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 4px;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
}

#pages-nav::-webkit-scrollbar { height: 3px; }

.pages-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.page-tab {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 9px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  position: relative;
}

.page-tab:hover { background: var(--bg-hover); color: var(--text-primary); }

.page-tab.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 8px; right: 8px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.page-tab-name {
  outline: none;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

/* Wrapper — collapsed by default, expands on tab hover */
.page-tab-btns {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  margin-left: 0;
  transition: max-width 0.2s, opacity 0.15s, margin-left 0.15s;
  flex-shrink: 0;
}
.page-tab:hover .page-tab-btns {
  max-width: 120px;
  opacity: 1;
  margin-left: 6px;
}

/* Single ··· options trigger — opens the page menu popover */
.page-more-btn {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.page-more-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.add-page-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px dashed var(--border-hover);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
}
.add-page-btn svg { width: 12px; height: 12px; }
.add-page-btn:hover { background: var(--accent-dim); color: var(--accent-text); border-color: var(--accent); }

/* ---------- MAIN CONTENT ---------- */
#main-content {
  margin-top: 96px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  z-index: 2; /* above page-bg-overlay (z-index:1) */
}

.page-container {
  padding: 20px;
  /* no min-height here — col-lanes-container handles it */
}

/* Page background overlay (image behind blocks, fixed to viewport) */
#page-bg-overlay {
  position: fixed;
  top: 96px; left: 0; right: 0; bottom: 0;
  z-index: 1;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.4s;
  display: none;
}

/* ---------- FLEX COLUMN LAYOUT ---------- */
.col-lanes-container {
  display: flex;
  align-items: flex-start;
  min-height: calc(100vh - 136px);
}

.col-lane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 60px;
  flex-shrink: 0;
}

/* Column label (shown in edit mode) */
.col-lane-header {
  display: none;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 0 2px;
  color: var(--text-muted);
  opacity: 0.7;
  pointer-events: none;
  flex-shrink: 0;
}
body.edit-mode .col-lane-header { display: block; }

body.edit-mode .col-lane {
  border-right: 2px solid var(--border-hover);
  min-height: 140px;
}
body.edit-mode .col-lane:nth-child(even) { background: rgba(255,255,255,0.025); }
body.edit-mode .col-lane:last-child { border-right: none; }

/* Block wrapper */
.block {
  padding: 6px;
  box-sizing: border-box;
  transition: opacity 0.15s;
  width: 100%;
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* Animation d'arrivée des blocs (au rendu d'une page) */
@keyframes blockIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .block-anim-in { animation: blockIn 0.42s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
}

/* ── Aperçu admin (lecture seule) ──────────────────── */
body.view-as .header-actions,
body.view-as #nav-toggle,
body.view-as #add-block-btn,
body.view-as #add-page-btn { display: none !important; }
.view-as-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3000;
  background: var(--accent); color: #fff; text-align: center;
  font-size: 0.85rem; padding: 8px 14px;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}

/* Block card — the visible element */
.block-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
  height: 100%;
}

.block-card:hover { border-color: var(--border-hover); }

/* Block header */
.block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  min-height: 40px;
}

.block-title {
  font-size: var(--block-title-fs, 0.8rem);
  font-weight: 600;
  color: var(--page-title-color, var(--text-secondary));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-header-tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Block content */
.block-content {
  padding: 10px;
}

/* Edit mode block controls */
.block-controls {
  display: none;
  align-items: center;
  gap: 2px;
  position: relative;
}

body.edit-mode .block-controls { display: flex; }
body.edit-mode .block-card { border-color: var(--border-hover); }
body.edit-mode .block-card:hover { box-shadow: 0 0 0 2px var(--accent); }

/* ··· trigger button — always visible in edit mode */
.block-more-btn {
  color: var(--text-muted);
  flex-shrink: 0;
}
.block-more-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

/* Popover menu — overlaid on ··· click, revealed when .block-controls has .open.
   position:fixed (coords set in JS) so it escapes the block-card's overflow:hidden
   and renders above neighbouring blocks. */
.block-menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  min-width: 190px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
}
.block-controls.open .block-menu,
.block-menu.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.block-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.block-menu-item:hover { background: var(--bg-hover); }
.block-menu-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-muted); }
.block-menu-item:hover svg { color: var(--text-primary); }
/* active grid/list view */
.block-menu-item.active { background: var(--accent-dim); color: var(--accent-text); }
.block-menu-item.active svg { color: var(--accent-text); }
/* destructive action */
.block-menu-item.danger { color: var(--danger); }
.block-menu-item.danger svg { color: var(--danger); }
.block-menu-item.danger:hover { background: var(--danger-dim); }

.block-menu-sep {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}

/* ── Context menu (clic droit) ── */
.ctx-menu {
  position: fixed; z-index: 1100;
  min-width: 180px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  animation: ctxIn 0.12s ease;
}
@keyframes ctxIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.ctx-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  border: none; background: transparent;
  color: var(--text-primary); font-size: 0.9rem; text-align: left;
  border-radius: 6px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ctx-item:hover { background: var(--bg-hover); }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: var(--danger-dim); }
.ctx-ic { width: 18px; text-align: center; flex-shrink: 0; font-size: 0.95rem; }
.ctx-sep { height: 1px; margin: 4px 2px; background: var(--border); }

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  padding: 4px;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.drag-handle:hover { color: var(--text-primary); background: var(--bg-hover); }
.drag-handle:active { cursor: grabbing; }

/* SortableJS states */
.block.sortable-ghost { opacity: 0.3; }
.block.sortable-chosen .block-card { box-shadow: 0 0 0 2px var(--accent); }
.block.sortable-drag .block-card { box-shadow: var(--shadow-lg); }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  z-index: 80;
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { transform: scale(1.08); box-shadow: var(--shadow-lg); }
.fab:active { transform: scale(0.96); }

/* ---------- OVERLAY & PANELS ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 150;
  /* Pas de flou : on garde seulement l'assombrissement pour voir les changements
     de thème en direct derrière le panneau d'options. */
}

/* Side panel */
.side-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 160;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.side-panel.hidden { transform: translateX(100%); }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* ---------- MODAL ---------- */
#modal-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index:666;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-header h3 { font-size: 1rem; font-weight: 600; color: var(--text-primary); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.modal-footer:empty { display: none; }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.btn-secondary:hover { background: var(--bg-active); }

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.btn-icon svg { width: 15px; height: 15px; }
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-icon.danger:hover { background: var(--danger-dim); color: var(--danger); }

.btn-sm { padding: 5px 10px; font-size: 0.8rem; }

/* ---------- FORM CONTROLS ---------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--input-focus);
}

.form-control::placeholder { color: var(--text-muted); }

textarea.form-control {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 80px;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b819a' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  padding-right: 32px;
}
/* Liste déroulante native : fond/texte lisibles (sinon texte clair sur fond clair) */
.form-control option,
select option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.form-row {
  display: flex;
  gap: 10px;
}
.form-row .form-group { flex: 1; }

/* ---------- TOGGLE SWITCH ---------- */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-wrap:last-child { border-bottom: none; }
.toggle-wrap label { font-size: 0.875rem; color: var(--text-primary); cursor: pointer; }

.toggle {
  position: relative;
  width: 36px; height: 20px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--input-border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ---------- SECTION HEADING (options panel) ---------- */
.section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 0 8px;
}
.section-title:first-child { padding-top: 0; }

/* ---------- COLOR PICKER ---------- */
.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { border-color: var(--text-primary); transform: scale(1.1); }

.color-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

input[type="color"] {
  width: 36px; height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  padding: 2px;
}

/* ---------- TOAST ---------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  pointer-events: all;
  max-width: 360px;
  text-align: center;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--accent); }
.toast.warning { background: var(--warning); }
.toast.fadeout { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(0.95); }
}

/* ---------- UTILITY ---------- */
.hidden { display: none !important; }
.edit-only { display: none; }
body.edit-mode .edit-only { display: flex; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 10px 0;
}

/* Column resize pill */
.col-resize-bar {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.col-pill {
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.col-pill:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }
.col-pill.active { background: var(--accent-dim); color: var(--accent-text); border-color: var(--accent); }


/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  /* Collapse the header into: brand icon · search · edit-btn · hamburger */
  #header { gap: 8px; padding: 0 12px; }
  .app-title { display: none; }
  /* Show only the edit button in the actions bar — rest stays in the hamburger menu */
  .header-actions > *:not(#edit-btn) { display: none !important; }
  #edit-btn-label { display: none; }    /* icon only, saves space */
  #edit-btn { padding: 6px 10px; }
  .nav-toggle { display: flex; }
  .header-search { margin: 0; flex: 1; min-width: 0; }
  .col-lanes-container { flex-wrap: wrap; }
  .col-lane { flex: 1 1 50% !important; min-width: 50%; }
}

@media (max-width: 480px) {
  .col-lane { flex: 1 1 100% !important; min-width: 100%; }
  .page-container { padding: 12px; }
}

/* ===================================================
   LOCK SCREEN
   =================================================== */
.lock-screen {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
}
.lock-screen.hidden { display: none; }

/* ===== AUTH SCREEN (login / register) ===== */
.auth-screen {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.auth-screen.hidden { display: none; }

.auth-card {
  width: 100%; max-width: 360px;
  display: flex; flex-direction: column; gap: 18px;
  padding: 36px 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--accent);
  font-size: 1.25rem; font-weight: 700;
}
.auth-tabs {
  display: flex; gap: 6px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 4px;
}
.auth-tab {
  flex: 1; padding: 9px 0;
  border: none; border-radius: 7px;
  background: transparent; color: var(--text-secondary);
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
}
.auth-tab.active { background: var(--accent); color: #fff; }

#auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 0.78rem; color: var(--text-secondary); font-weight: 600;
}
.auth-label input {
  padding: 11px 13px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-primary);
  font-size: 0.92rem;
}
.auth-label input:focus { outline: none; border-color: var(--accent); }

.auth-submit {
  margin-top: 4px; padding: 12px 0;
  border: none; border-radius: 9px;
  background: var(--accent); color: #fff;
  font-size: 0.92rem; font-weight: 700; cursor: pointer;
  transition: filter .15s;
}
.auth-submit:hover { filter: brightness(1.08); }
.auth-submit:disabled { opacity: .6; cursor: default; }

.auth-error { min-height: 1em; margin: 0; color: #e5484d; font-size: 0.8rem; text-align: center; }
.auth-hint  { margin: 0; color: var(--text-muted); font-size: 0.76rem; text-align: center; }

.lock-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px;
  padding: 48px 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
}

.lock-icon { font-size: 2.4rem; }

.lock-prompt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

.lock-dots {
  display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center;
  max-width: 240px;
  min-height: 16px; align-items: center;
}
.lock-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid var(--border-hover);
  background: transparent;
  transition: background 0.15s, transform 0.1s;
}
.lock-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.15);
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%,60%  { transform: translateX(-6px); }
  40%,80%  { transform: translateX(6px); }
}
.lock-dot.shake { animation: shake 0.5s ease; }

.lock-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.lock-key {
  width: 62px; height: 62px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-surface-2);
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 500;
  transition: background 0.12s, transform 0.08s;
  display: flex; align-items: center; justify-content: center;
}
.lock-key:hover  { background: var(--bg-hover); }
.lock-key:active { transform: scale(0.92); }
.lock-key-del    { background: transparent; color: var(--text-secondary); font-size: 1.1rem; }
.lock-key-ok     { background: var(--accent); color: #fff; border-color: var(--accent); }
.lock-key-ok:hover { background: var(--accent-hover); }

.lock-error {
  font-size: 0.82rem;
  color: var(--danger);
  min-height: 1.2em;
  text-align: center;
}

/* ===================================================
   PROFILE SCREEN
   =================================================== */
.profile-screen {
  position: fixed; inset: 0; z-index: 9998;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
}
.profile-screen.hidden { display: none; }

.profile-screen-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 24px;
  padding: 48px 32px;
}
.profile-screen-inner h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-cards {
  display: flex; flex-wrap: wrap; gap: 16px;
  justify-content: center;
  max-width: 600px;
}
.profile-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  padding: 24px 20px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  min-width: 110px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  position: relative;
}
.profile-card:hover { border-color: var(--accent); background: var(--bg-hover); transform: translateY(-2px); }
.profile-card.active { border-color: var(--accent); }

.profile-avatar {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; font-weight: 700;
  color: #fff;
}
.profile-card-name {
  font-size: 0.9rem; font-weight: 500;
  text-align: center;
  max-width: 90px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-lock-icon {
  position: absolute; top: 8px; right: 8px;
  font-size: 0.75rem; opacity: 0.7;
}

/* ── Profile rows in Options panel ── */
.profiles-list {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 4px;
}
.profile-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: var(--bg-surface-2);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.profile-row.active { border-color: var(--accent); }
.profile-dot-sm {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.profile-row-name {
  flex: 1;
  font-size: 0.85rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.profile-row-actions { display: flex; align-items: center; gap: 4px; }
.badge-active { font-size: 0.75rem; color: var(--accent); font-weight: 700; }
.btn-xs {
  padding: 2px 8px;
  font-size: 0.72rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
}
.btn-xs:hover { background: var(--bg-hover); }
.btn-xs.danger { color: var(--danger); }
.btn-xs.danger:hover { background: var(--danger-dim); }

/* Options panel footer — version & copyright */
.options-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.6;
  text-align: center;
  letter-spacing: 0.02em;
}

/* ===================================================
   FOCUS MODE
   =================================================== */
/* Focus toggle — always available (even outside edit mode), revealed on hover */
.block-focus-toggle {
  opacity: 0.4;
  color: var(--text-muted);
  padding: 3px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.block-focus-toggle svg { width: 14px; height: 14px; }
.block:hover .block-focus-toggle { opacity: 0.85; }
.block-focus-toggle:hover { opacity: 1; color: var(--text-primary); background: var(--bg-hover); }
/* Focused block: keep the toggle visible + accent so it can be exited */
body.focus-mode .block.block-focused .block-focus-toggle { opacity: 1; color: var(--accent); }

/* In focus mode: dim all blocks except the focused one */
body.focus-mode .block {
  opacity: 0.07;
  pointer-events: none;
  transition: opacity 0.3s;
}
body.focus-mode .block.block-focused {
  opacity: 1;
  pointer-events: auto;
  z-index: 10;
  position: relative;
}
/* Hide non-essential chrome in focus mode */
body.focus-mode #header         { opacity: 0.3; pointer-events: none; }
body.focus-mode #pages-nav      { opacity: 0.3; pointer-events: none; }
body.focus-mode #add-block-btn  { display: none; }

/* ===================================================
   GLASSMORPHISM THEME — card overrides
   =================================================== */
[data-theme="glass"] .block-card {
  background: rgba(255,255,255,0.07) !important;
  backdrop-filter: blur(var(--glass-blur, 14px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 14px));
  border: 1px solid rgba(255,255,255,0.14);
}
[data-theme="glass"] #header {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--header-bg) !important;
}
[data-theme="glass"] #pages-nav {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* ===================================================
   MINIMAL THEME — clean borders
   =================================================== */
[data-theme="minimal"] .block-card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.08);
}
[data-theme="minimal"] #header,
[data-theme="minimal"] #pages-nav {
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: none;
}

/* ===================================================
   POP THEME — thème STRUCTUREL (au-delà des couleurs)
   Cartes flottantes à coin asymétrique, sans bordure,
   barre d'accent à gauche ; titres en pastille arrondie ;
   icônes de favoris rondes et sans fond.
   =================================================== */
[data-theme="pop"] .block-card {
  position: relative;
  border: none;
  border-radius: 22px 22px 22px 7px;       /* coin bas-gauche « cassé » */
  background: var(--bg-surface);
  box-shadow: 0 6px 22px rgba(0,0,0,0.30);
}
[data-theme="pop"] .block-card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.40);
}
/* Barre d'accent verticale collée au bord gauche (rappel « titre vertical ») */
[data-theme="pop"] .block-card::before {
  content: ''; position: absolute; left: 0; top: 16px; bottom: 16px;
  width: 4px; border-radius: 0 4px 4px 0;
  background: var(--accent); opacity: 0.85;
}
[data-theme="pop"] .block-header {
  border-bottom: none;
  padding: 14px 14px 2px 20px;
  min-height: 0;
}
/* Titre en pastille (plus de bandeau MAJUSCULES en haut) */
[data-theme="pop"] .block-title {
  display: inline-block;
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 700;
  color: var(--accent-text, var(--accent));
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: 999px;
  max-width: 100%;
}
[data-theme="pop"] .block-content { padding: 8px 16px 16px 20px; }

/* Favoris : icônes parfaitement rondes, sans fond (anneau discret en repli) */
[data-theme="pop"] .bm-icon-wrap,
[data-theme="pop"] .bm-icon-wrap-sm {
  background: none !important;
  border: none !important;
  box-shadow: inset 0 0 0 1px var(--border);
}
/* Lignes de favoris en mode liste : survol en pilule */
[data-theme="pop"] .bm-item-list { border-radius: 14px; }

/* ===================================================
   SPINE THEME — thème STRUCTUREL : titre vertical latéral
   La carte devient horizontale : colonne « tranche » à gauche
   (titre à la verticale + outils empilés), contenu à droite.
   =================================================== */
[data-theme="spine"] .block-card {
  display: flex;
  flex-direction: row;
  border-radius: 16px;
  overflow: hidden;
}
[data-theme="spine"] .block-header {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 40px;
  min-height: 0;
  padding: 12px 0;
  gap: 8px;
  border-bottom: none;
  border-right: 1px solid var(--border);
  background: var(--bg-surface-2);
}
[data-theme="spine"] .block-title {
  writing-mode: vertical-rl;
  transform: rotate(180deg);      /* lecture bas → haut */
  text-align: left;
  flex: 1 1 auto;
  max-height: 100%;
}
[data-theme="spine"] .block-header-tools {
  flex-direction: column;
  flex-shrink: 0;
}
[data-theme="spine"] .block-controls { flex-direction: column; }
[data-theme="spine"] .block-content {
  flex: 1 1 auto;
  min-width: 0;                   /* évite les débordements des widgets */
}

/* ===================================================
   BRUTALIST THEME — thème STRUCTUREL : bordures franches
   Coins droits, grosse bordure, ombre portée nette décalée.
   =================================================== */
[data-theme="brutal"] .block-card {
  border: 2px solid var(--text-primary);
  border-radius: 0;
  box-shadow: 6px 6px 0 var(--accent);
  background: var(--bg-surface);
  transition: box-shadow 0.12s, transform 0.12s;
}
[data-theme="brutal"] .block-card:hover {
  box-shadow: 9px 9px 0 var(--accent);
  transform: translate(-1px, -1px);
}
[data-theme="brutal"] .block-header {
  border-bottom: 2px solid var(--text-primary);
  background: var(--bg-surface);
}
[data-theme="brutal"] .block-title {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-primary);
}
/* Icônes à bordure franche (forme par défaut = carré via --bm-icon-radius) */
[data-theme="brutal"] .bm-icon-wrap,
[data-theme="brutal"] .bm-icon-wrap-sm {
  border: 2px solid var(--text-primary) !important;
  background: var(--bg-surface) !important;
}
[data-theme="brutal"] .bm-item-list { border-radius: 0; }

/* ===================================================
   PAGE TEMPLATE PICKER (in Add Page modal)
   =================================================== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 4px;
}
.template-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 12px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.template-card:hover   { border-color: var(--accent-dim); background: var(--bg-hover); }
.template-card.selected { border-color: var(--accent); background: var(--accent-dim); }
.template-card-icon  { font-size: 1.5rem; }
.template-card strong { font-size: 0.82rem; }
.template-card-desc  { font-size: 0.7rem; color: var(--text-muted); line-height: 1.3; }

