/* ==========================================================================
   NOTES — SIMPLE & CLASSIC
   Reference points: Apple Notes (3-column calm layout), Bear (typography),
   Google Keep (fast capture). Rule: one thing per job, everything else in "⋯".
   Loaded last so it overrides earlier layers without touching their logic.
   ========================================================================== */

/* ---- Global sidebar: five core items, the rest folded ---- */
.library-nav .sidebar-section-title { display: none; }
.library-nav .nav-group > summary { opacity: .7; font-weight: 500; letter-spacing: .04em; }

/* ---- Top bar: keep search + account, drop the noise ---- */
#global-ai-btn { background: transparent; border-color: var(--color-border); color: var(--color-text-secondary); }
#compact-sync .sync-dot + #study-sync-state,
#compact-sync #study-sync-state { display: none; }

/* ---- Notes sidebar (folders) ---- */
#sidebar.notes-collections-pane .collections-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: none; color: var(--color-text-secondary);
}
#sidebar .nav-item { min-height: 34px; padding: 6px 10px; font-size: 14px; border-radius: 8px; }
#sidebar .nav-item.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
#sidebar .nav-icon { opacity: .8; }
#sidebar .collections-divider { margin: 8px 0; opacity: .5; }

/* ---- Note list: search first, nothing else competing ---- */
#list .list-heading { margin-bottom: 8px; }
#list .explorer-title-box h2 { font-size: 18px; font-weight: 650; }
#list .explorer-summary { font-size: 12px; color: var(--color-muted); }
#list #tag-filter,
#list #fav-filter-label { display: none; }
#list .filters { gap: 6px; }
#list #sort-filter { font-size: 12px; border: 0; background: transparent; color: var(--color-text-secondary); padding-inline: 0; }
#list .search-input-wrapper input { border-radius: 10px; background: var(--color-surface-sunken); border-color: transparent; }
#list .search-input-wrapper input:focus { background: var(--color-surface); border-color: var(--color-primary); }
#notes .note-item, #notes > button {
  border: 0; border-radius: 10px; box-shadow: none; background: transparent;
}
#notes > button[aria-current="true"], #notes > button.active { background: var(--color-primary-light); }

/* ---- Editor: paper, not a control panel ---- */
.editor-active-canvas { max-width: 780px; margin-inline: auto; }
.editor-top { border-bottom: 0; margin-bottom: 4px; padding-bottom: 0; }
#save-state { background: transparent; border: 0; color: var(--color-muted); font-weight: 500; padding: 0; }

/* One overflow menu instead of 5 buttons */
.note-menu { position: relative; }
.note-menu > summary {
  list-style: none; cursor: pointer; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 8px; font-size: 20px; line-height: 1; color: var(--color-text-secondary);
}
.note-menu > summary::-webkit-details-marker { display: none; }
.note-menu > summary:hover, .note-menu[open] > summary { background: var(--color-surface-sunken); }
.note-menu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60; min-width: 220px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: 12px; box-shadow: var(--shadow-xl, 0 12px 32px rgba(0,0,0,.18));
}
.note-menu-panel button {
  width: 100%; height: 36px; justify-content: flex-start; text-align: left; padding: 0 10px;
  border: 0; background: transparent; border-radius: 8px; font-size: 14px; color: var(--color-text);
}
.note-menu-panel button:hover { background: var(--color-surface-sunken); }

/* Title like a document title */
.document-title-input {
  font-size: 30px; font-weight: 700; border: 0; background: transparent; padding-inline: 0; box-shadow: none;
}
.document-title-input:focus { box-shadow: none; outline: none; }

/* Metadata: one quiet line */
.document-metadata-bar { border: 0; background: transparent; padding: 0; gap: 12px; font-size: 13px; color: var(--color-text-secondary); }
.document-metadata-bar .meta-label { display: none; }
.document-metadata-bar select, .document-metadata-bar input[type="text"], #tags {
  border: 0; background: var(--color-surface-sunken); border-radius: 8px; font-size: 13px; padding: 4px 10px;
}
.meta-toggles .toggle-pill { border: 0; background: transparent; padding: 4px 6px; font-size: 13px; color: var(--color-text-secondary); }

/* Toolbar: only the essentials visible; the rest stays under "More ›" */
#toolbar { border-block: 0; border-bottom: 1px solid var(--color-border); padding-block: 4px; position: sticky; top: 0; background: var(--color-surface); z-index: 5; }
#table, #image-file + *, #toolbar > #link + #table { display: none; }

/* Capture / editor tools: hidden row, tucked into a discreet disclosure */
.capture-tools { display: none; }
.capture-settings { margin: 0 0 8px; font-size: 12px; opacity: .75; }
.capture-settings:not([open]) > :not(summary) { display: none; }
.capture-settings > summary { cursor: pointer; color: var(--color-muted); }

/* Footer: calm */
.document-footer { border-top: 0; font-size: 12px; color: var(--color-muted); }
.document-footer .btn-trash-action { background: transparent; border: 0; color: var(--color-muted); }
.document-footer .btn-trash-action:hover { color: var(--color-danger); }

/* Empty state: a sentence, not a poster */
.editor-empty-state .shortcut-hint { display: none; }
.editor-empty-state h2 { font-size: 18px; font-weight: 600; }

/* ---- Polish after first visual check ---- */
.document-metadata-bar #tags,
.document-metadata-bar select#location {
  background: var(--color-surface-sunken); color: var(--color-text); border: 0; border-radius: 8px;
  min-height: 32px; font-size: 13px; padding: 4px 10px;
}
.document-metadata-bar #tags::placeholder { color: var(--color-muted); }
.meta-toggles input[type="checkbox"] { width: 14px; height: 14px; }
.meta-toggles { margin-left: auto; display: flex; gap: 4px; }
/* Folders first, handwritten notebooks after the notes */
.collections-nav-list { display: flex; flex-direction: column; }
#nav-digital-notebooks { order: 5; }
#all { order: 1; }
#groups { order: 2; }
.collections-divider { order: 3; }
#trash { order: 6; }

/* Dark-theme safety for metadata fields (earlier layers force a light fill) */
.document-metadata-bar select, .document-metadata-bar input { background: var(--color-surface-sunken) !important; color: var(--color-text) !important; }
.document-metadata-bar .meta-field { background: transparent !important; border: 0 !important; padding: 0 !important; }
.document-metadata-bar .meta-field select, .document-metadata-bar .meta-field input { background: var(--color-surface-sunken) !important; }

/* ==========================================================================
   LIBRARY — SIMPLE: title, search, one filter, upload. Nothing else on top.
   ========================================================================== */
#library-workspace .library-header-main .eyebrow,
#library-workspace .library-subheading,
#library-workspace #resource-status,
#library-workspace #resource-favs,
#library-workspace .lib-fav-label,
#library-workspace #storage-meter { display: none !important; }
#library-workspace .library-heading { padding-bottom: 8px; border-bottom: 0; }
#library-workspace #library-heading { font-size: 26px; font-weight: 700; }
#library-workspace .lib-docs-badge { background: transparent; border: 0; color: var(--color-muted); font-size: 13px; }
#library-workspace .library-tab-buttons { background: transparent; border: 0; gap: 4px; }
#library-workspace .library-tab-buttons button { border: 0; background: transparent; color: var(--color-text-secondary); border-radius: 8px; }
#library-workspace .library-tab-buttons button.active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }
#library-workspace .library-controls { background: transparent; border: 0; padding: 0; box-shadow: none; }
#library-workspace #storage-summary { font-size: 12px; color: var(--color-muted); background: transparent; border: 0; padding: 0; }
#library-workspace .resource-grid > * { box-shadow: none; border-radius: 12px; }

/* ==========================================================================
   ROUND 2 — less on screen everywhere
   ========================================================================== */

/* Global sidebar: 5 core items, then a single quiet "More" folder (closed by default). */
.library-nav .nav-group { margin-top: 6px; border-top: 1px solid var(--color-border); padding-top: 6px; }
.library-nav .nav-group > summary {
  display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none;
  padding: 8px 12px; border-radius: 8px; font-size: 14px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--color-text-secondary); opacity: 1;
}
.library-nav .nav-group > summary::-webkit-details-marker { display: none; }
.library-nav .nav-group > summary:hover { background: var(--color-surface-sunken); }
.library-nav .nav-group .nav-chevron { transition: transform .15s; font-size: 16px; line-height: 1; }
.library-nav .nav-group[open] .nav-chevron { transform: rotate(90deg); }
.library-nav .nav-group .nav-panel > button { min-height: 32px; font-size: 13px; opacity: .9; }
.library-nav > button { font-size: 14px; }

/* Top bar: search + account only; AI becomes an icon-sized pill */
#global-ai-btn { padding-inline: 10px; }
#compact-sync { display: none; }
#workspace > header #menu { display: none; }

/* Library: storage line is noise unless you are near the limit */
#library-workspace .storage-usage { display: none; }
#library-workspace #library-trash { opacity: .7; }

/* Library cards: cover, title, progress, one action. The rest appears on hover/focus. */
#library-workspace .resource-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
#library-workspace .resource-card { border-radius: 12px; overflow: hidden; }
#library-workspace .resource-cover-area { height: 110px; }
#library-workspace .cover-doc-title-preview,
#library-workspace .resource-kind-badge,
#library-workspace .resource-card-author,
#library-workspace .resource-licence-text,
#library-workspace .resource-specs-row .meta-tags { display: none; }
#library-workspace .resource-card-title { font-size: 15px; line-height: 1.35; margin: 0 0 4px; }
#library-workspace .resource-specs-row { font-size: 12px; color: var(--color-muted); margin-bottom: 8px; }
#library-workspace .resource-progress-label { font-size: 12px; color: var(--color-muted); }
#library-workspace .card-actions { display: flex; gap: 6px; align-items: center; }
#library-workspace .card-actions .btn-read-pdf { flex: 1; }
#library-workspace .card-actions > :not(.btn-read-pdf) {
  opacity: 0; width: 0; padding: 0; margin: 0; border: 0; overflow: hidden; pointer-events: none; font-size: 0;
}
#library-workspace .resource-card:hover .card-actions > :not(.btn-read-pdf),
#library-workspace .resource-card:focus-within .card-actions > :not(.btn-read-pdf) {
  opacity: 1; width: auto; padding: 0 8px; pointer-events: auto; font-size: 12px; overflow: visible; border: 1px solid var(--color-border);
}
@media (hover: none) {
  #library-workspace .card-actions { flex-wrap: wrap; }
  #library-workspace .card-actions > :not(.btn-read-pdf) { opacity: 1; width: auto; padding: 0 8px; pointer-events: auto; font-size: 12px; border: 1px solid var(--color-border); }
}

/* Notes leftovers */
.meta-toggles .toggle-pill input { position: absolute; opacity: 0; pointer-events: none; }
.meta-toggles .toggle-pill { cursor: pointer; border-radius: 8px; }
.meta-toggles .toggle-pill:has(input:checked) { background: var(--color-primary-light); color: var(--color-primary); }
#sidebar .nav-count { opacity: .6; font-size: 12px; }

/* ROUND 3 — the sidebar is only: Notes, Library, Revise, Practice.
   Today, Syllabus, Planner, Mains, Chronicle, Learning, Insights, Support, Billing
   stay available through Ctrl+K and Account > All tools. */
.library-nav .nav-group,
.library-nav > button[data-module="dashboard"] { display: none !important; }

/* Account menu: keep what a student needs. Sync diagnostics hide until something is actually wrong. */
.account-panel #sync-retry,
.account-panel #sync-refresh,
.account-panel #backup { display: none; }

/* ==========================================================================
   SIDEBAR — clean rail + clean full state
   ========================================================================== */
#workspace > .app-header .primary-nav { padding: 14px 10px; gap: 2px; box-shadow: none; }

/* Brand row */
.sidebar-brand-row { padding: 4px 6px 14px; margin-bottom: 8px; border-bottom: 1px solid var(--color-border-subtle); }
.brand-badge { border-radius: 6px; padding: 4px 8px; }
#sidebar-collapse-btn { border: 0; background: transparent; width: 28px; min-width: 28px; min-height: 28px; border-radius: 8px; }
#sidebar-collapse-btn:hover { background: var(--color-surface-sunken); }

/* Items: roomy, rounded, one clear active state (no double border) */
.primary-nav > button { min-height: 40px; padding: 8px 12px; margin-bottom: 2px; font-size: 14px; border-radius: 10px; }
.primary-nav > button:before { width: 22px; margin-right: 12px; font-size: 16px; }
.primary-nav > button:hover { background: var(--color-surface-sunken); }
.primary-nav > button[aria-current="page"] {
  background: var(--color-primary-light) !important; color: var(--color-primary) !important;
  border: 0 !important; border-left: 0 !important; box-shadow: none !important; font-weight: 600 !important;
}

/* Collapsed rail: stack brand + expand button, centre icons, keep the active pill */
#workspace.sidebar-collapsed .sidebar-brand-row { flex-direction: column; gap: 10px; padding: 4px 0 12px; align-items: center; }
#workspace.sidebar-collapsed #sidebar-collapse-btn { display: grid; width: 32px; background: var(--color-surface-sunken); }
#workspace.sidebar-collapsed .primary-nav > button { width: 44px; min-height: 44px; margin: 0 auto 4px; padding: 0; justify-content: center; border-radius: 12px; }
#workspace.sidebar-collapsed .primary-nav > button:before { margin: 0; font-size: 19px; }

/* Rail needs room for the badge + expand button */
#workspace, #workspace.sidebar-collapsed { --sidebar-width-collapsed: 68px; }
#workspace.sidebar-collapsed > .app-header .primary-nav { padding-inline: 8px; }
#workspace.sidebar-collapsed .sidebar-brand { justify-content: center; }
#workspace.sidebar-collapsed #sidebar-collapse-btn { display: grid !important; margin: 0 auto; }
/* The generic "hide button labels in the rail" rule was also hiding the expand arrow */
#workspace.sidebar-collapsed #sidebar-collapse-btn { font-size: 14px !important; width: 36px !important; min-height: 32px !important; padding: 0 !important; color: var(--color-text-secondary); }
#workspace.sidebar-collapsed #sidebar-collapse-btn::before { content: none; }
