/* ============================================================
   OmNote — Full visual Library view + home quick bar
   Loaded after dark-mode.css. Uses dashboard tokens so light
   and dark themes both work automatically.
   ============================================================ */

/* ---------- Sidebar "Library" header row + expand button ---------- */
.nav-group-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 8px;
}
.nav-group-label-row .nav-group-label { padding: 0; }
.nav-group-expand {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--dash-ink-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.nav-group-expand:hover {
  background: #f1f5f6;
  border-color: var(--dash-line-2);
  color: var(--dash-teal);
}
html.dark .nav-group-expand:hover { background: rgba(255, 255, 255, .06); }
.nav-group-expand i, .nav-group-expand svg { width: 14px; height: 14px; }

/* ---------- Home quick bar ---------- */
#home-library-bar {
  margin: 20px 32px 0;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(14, 124, 134, .08), rgba(14, 124, 134, .02));
  border: 1px solid var(--dash-line-2);
  border-radius: 14px;
}
#home-view.home-empty #home-library-bar { display: none; }
.hlb-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hlb-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--dash-teal-soft);
  color: var(--dash-teal);
  display: grid; place-items: center;
}
.hlb-icon i, .hlb-icon svg { width: 20px; height: 20px; }
.hlb-title {
  font-family: var(--dash-font-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--dash-ink);
}
.hlb-sub { font-size: 12.5px; color: var(--dash-ink-3); margin-top: 2px; }
.hlb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hlb-actions .btn-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
}
.hlb-actions .btn-action i, .hlb-actions .btn-action svg { width: 15px; height: 15px; }

/* ---------- Library view shell ---------- */
body.library-open #topbar .topbar-center { display: none; }
#library-view {
  flex: 1;
  min-height: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 28px 32px 64px;
  background: var(--dash-canvas);
  animation: lib-view-in .25s ease both;
}
@keyframes lib-view-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lib-shell { max-width: 1240px; margin: 0 auto; transition: max-width .25s ease; }
.lib-shell.is-wide { max-width: 100%; }

/* Header */
.lib-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.lib-head-main { min-width: 0; }
.lib-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dash-teal);
  margin-bottom: 6px;
}
.lib-kicker-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dash-teal);
  box-shadow: 0 0 10px rgba(14, 124, 134, .5);
}
.lib-title {
  font-family: var(--dash-font-head);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--dash-ink);
  margin: 0;
  letter-spacing: -.02em;
}
.lib-subtitle { color: var(--dash-ink-3); font-size: .92rem; margin: 8px 0 0; max-width: 560px; line-height: 1.5; }
.lib-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lib-actions .btn-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 15px;
}
.lib-actions .btn-action i, .lib-actions .btn-action svg { width: 15px; height: 15px; }
.lib-icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--dash-surface);
  border: 1px solid var(--dash-line-2);
  border-radius: 9px;
  color: var(--dash-ink-2);
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.lib-icon-btn:hover { border-color: var(--dash-teal); color: var(--dash-teal); }
.lib-icon-btn.is-active {
  background: var(--dash-teal-soft);
  border-color: var(--dash-teal);
  color: var(--dash-teal);
}
.lib-icon-btn i, .lib-icon-btn svg { width: 17px; height: 17px; }

/* Toolbar */
.lib-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.lib-search {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--dash-surface);
  border: 1px solid var(--dash-line-2);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--dash-ink-3);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.lib-search:focus-within {
  border-color: var(--dash-teal);
  box-shadow: 0 0 0 3px rgba(14, 124, 134, .12);
}
.lib-search > i, .lib-search > svg { width: 16px; height: 16px; flex-shrink: 0; }
.lib-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--dash-font-body);
  font-size: 14px;
  color: var(--dash-ink);
  min-width: 0;
}
.lib-search input::placeholder { color: var(--dash-ink-3); }
.lib-search-clear {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--dash-ink-3);
  cursor: pointer;
  flex-shrink: 0;
}
.lib-search-clear:hover { background: var(--dash-canvas); color: var(--dash-ink); }
.lib-search-clear i, .lib-search-clear svg { width: 13px; height: 13px; }
.lib-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--dash-surface);
  border: 1px solid var(--dash-line-2);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--dash-ink-3);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.lib-sort:focus-within { border-color: var(--dash-teal); }
.lib-sort > i, .lib-sort > svg { width: 15px; height: 15px; }
.lib-sort select {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--dash-font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--dash-ink-2);
  cursor: pointer;
}
.lib-sort select option { color: var(--dash-ink); background: var(--dash-surface); }

/* Stats strip */
.lib-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.lib-stat {
  background: var(--dash-surface);
  border: 1px solid var(--dash-line);
  border-radius: 12px;
  padding: 12px 14px;
}
.lib-stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--dash-ink-3);
}
.lib-stat-label i, .lib-stat-label svg { width: 13px; height: 13px; }
.lib-stat-value {
  font-family: var(--dash-font-head);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--dash-ink);
  margin-top: 5px;
  line-height: 1.1;
}
.lib-stat.warn .lib-stat-value { color: var(--dash-red); }

/* Breadcrumbs */
.lib-crumbs {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--dash-ink-3);
}
.lib-crumbs > i, .lib-crumbs > svg { width: 14px; height: 14px; opacity: .6; }
.lib-crumb {
  background: none;
  border: none;
  padding: 3px 2px;
  font-family: var(--dash-font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--dash-teal);
  cursor: pointer;
}
.lib-crumb.current { color: var(--dash-ink); cursor: default; }
.lib-crumb.current:not(:first-child) { cursor: default; }
.lib-search-note { color: var(--dash-ink-3); font-size: 12.5px; font-weight: 600; }

/* Sections */
.lib-section { margin-bottom: 28px; }
.lib-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--dash-font-head);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--dash-ink);
  margin-bottom: 12px;
}
.lib-section-head > i, .lib-section-head > svg { width: 16px; height: 16px; color: var(--dash-teal); }
.lib-count-pill {
  background: var(--dash-teal-soft);
  color: var(--dash-teal-dark);
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 9px;
}

/* Folder cards */
.lib-folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.lib-folder-card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-line);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .18s ease, transform .15s ease, background .15s ease;
}
.lib-folder-card:hover {
  border-color: var(--dash-teal);
  box-shadow: 0 10px 26px -18px rgba(10, 61, 74, .45);
  transform: translateY(-2px);
}
.lib-folder-card.is-active {
  border-color: var(--dash-teal);
  background: var(--dash-teal-soft);
}
.lib-folder-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.lib-folder-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--dash-teal-soft);
  color: var(--dash-teal);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.lib-folder-card.is-active .lib-folder-icon { background: rgba(14, 124, 134, .18); }
.lib-folder-icon i, .lib-folder-icon svg { width: 19px; height: 19px; }
.lib-folder-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--dash-ink);
  margin-top: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-folder-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--dash-ink-3);
  font-weight: 600;
}
.lib-folder-meta span { display: inline-flex; align-items: center; gap: 5px; }
.lib-folder-meta i, .lib-folder-meta svg { width: 13px; height: 13px; }
.lib-folder-due { color: var(--dash-red); }

/* Doc cards */
.lib-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.lib-doc-card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-line);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .15s ease, box-shadow .18s ease, transform .15s ease;
}
.lib-doc-card:hover {
  border-color: var(--dash-teal);
  box-shadow: 0 12px 28px -20px rgba(10, 61, 74, .5);
  transform: translateY(-2px);
}
.lib-doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.lib-doc-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--dash-teal-soft);
  color: var(--dash-teal-dark);
  font-family: var(--dash-font-head);
  font-weight: 700;
  font-size: 15px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.lib-card-acts {
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: .35;
  transition: opacity .15s ease;
}
.lib-folder-card:hover .lib-card-acts,
.lib-doc-card:hover .lib-card-acts { opacity: 1; }
.lib-act-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--dash-ink-3);
  cursor: pointer;
  transition: background .13s ease, color .13s ease, border-color .13s ease;
}
.lib-act-btn:hover { background: var(--dash-canvas); border-color: var(--dash-line-2); color: var(--dash-teal); }
.lib-act-btn.danger:hover { color: var(--dash-red); border-color: rgba(192, 57, 43, .3); }
.lib-act-btn i, .lib-act-btn svg { width: 14px; height: 14px; }
.lib-doc-title {
  font-weight: 700;
  font-size: 14.5px;
  color: var(--dash-ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.lib-doc-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--dash-ink-3);
  background: var(--dash-canvas);
  border: 1px solid var(--dash-line);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.lib-pill i, .lib-pill svg { width: 12px; height: 12px; }
.lib-pill.due {
  background: rgba(244, 63, 94, .1);
  color: #d9345c;
  border-color: rgba(244, 63, 94, .25);
}
html.dark .lib-pill.due { color: #fda4af; }
.lib-doc-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--dash-line);
  overflow: hidden;
}
.lib-doc-progress > span {
  display: block;
  height: 100%;
  background: var(--dash-teal);
  border-radius: 999px;
  transition: width .3s ease;
}
.lib-doc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--dash-line);
  font-size: 12px;
  color: var(--dash-ink-3);
  font-weight: 600;
}
.lib-doc-foot .lib-doc-folder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-doc-foot i, .lib-doc-foot svg { width: 13px; height: 13px; flex-shrink: 0; }
.lib-open-cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--dash-teal);
  font-weight: 700;
  white-space: nowrap;
}
.lib-doc-card:hover .lib-open-cta i,
.lib-doc-card:hover .lib-open-cta svg { transform: translateX(2px); }
.lib-open-cta i, .lib-open-cta svg { width: 13px; height: 13px; transition: transform .15s ease; }

/* Dark mode: keep the search + sort controls seamless inside their pills
   (dark-mode.css styles every input/select with !important). */
html.dark .lib-search input {
  background: transparent !important;
  border: none !important;
  color: var(--dash-ink) !important;
}
html.dark .lib-sort select {
  background: transparent !important;
  border: none !important;
  color: var(--dash-ink-2) !important;
}
html.dark .lib-sort select option { background: #16242a; color: var(--dash-ink); }

/* Empty states */
.lib-empty {
  background: var(--dash-surface);
  border: 1px dashed var(--dash-line-2);
  border-radius: 16px;
  padding: 64px 28px;
  text-align: center;
}
.lib-empty.small { padding: 44px 24px; }
.lib-empty-icon {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--dash-teal-soft);
  color: var(--dash-teal);
  display: grid; place-items: center;
}
.lib-empty-icon i, .lib-empty-icon svg { width: 26px; height: 26px; }
.lib-empty h3 {
  font-family: var(--dash-font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--dash-ink);
  margin: 0 0 6px;
}
.lib-empty p { color: var(--dash-ink-3); font-size: .92rem; margin: 0 0 18px; }
.lib-empty-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
}
.lib-empty-cta i, .lib-empty-cta svg { width: 16px; height: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  #library-view { padding: 20px 16px 48px; }
  #home-library-bar { margin: 16px 18px 0; }
  .lib-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lib-header { align-items: flex-start; }
}
@media (max-width: 560px) {
  .lib-title { font-size: 1.5rem; }
  .lib-doc-grid { grid-template-columns: 1fr; }
  .lib-folder-grid { grid-template-columns: 1fr 1fr; }
  .hlb-actions { width: 100%; }
  .hlb-actions .btn-action { flex: 1; justify-content: center; }
}
