/* ============================================================
   visual-styles.css
   Two new visual styles for Grafo:

   1. [data-visual="paper"]   Clean document-editor aesthetic.
      aesthetic. Clean cream/white paper, warm neutral borders,
      soft focus states, zero blur, zero trickery. The look that
      tens of millions of knowledge-workers associate with calm,
      productive writing.

   2. [data-visual="fluent"]  — Microsoft Fluent Design / Win11
      Acrylic. Layered elevation, sharp-yet-rounded geometry,
      high contrast interactive states, soft translucency on
      surfaces that sit above the background.

   Both styles:
   - Work in light AND dark themes (data-theme="dark").
   - Never conflict with liquid-glass rules (scoped only to their
     own [data-visual] selector).
   - Never touch canvas / whiteboard / graph / AI-graph elements
     (those have their own CSS resets).
   - Use only CSS custom properties already defined in notion.css
     so there is zero fallback risk.
   ============================================================ */


/* ============================================================
   PAPER STYLE
   ============================================================ */

/* ── Sidebar ──────────────────────────────────────────────── */
html[data-visual="paper"] #sidebar,
html[data-visual="paper"] .sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html[data-visual="paper"] .sb-item {
  border-radius: 6px;
  color: var(--text-2);
  font-weight: 450;
  transition: background 0.12s ease, color 0.12s ease;
}
html[data-visual="paper"] .sb-item:hover {
  background: var(--hover);
  color: var(--text);
}
html[data-visual="paper"] .sb-item.active,
html[data-visual="paper"] .sb-item[aria-pressed="true"] {
  background: var(--hover-strong);
  color: var(--text);
  font-weight: 500;
}

/* ── Topbar ───────────────────────────────────────────────── */
html[data-visual="paper"] .topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ── Modals & cards ───────────────────────────────────────── */
html[data-visual="paper"] .modal-card,
html[data-visual="paper"] .settings-card,
html[data-visual="paper"] .search-card,
html[data-visual="paper"] .share-card,
html[data-visual="paper"] .templates-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.04),
    0 8px 24px rgba(0,0,0,0.08);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="dark"][data-visual="paper"] .modal-card,
html[data-theme="dark"][data-visual="paper"] .settings-card,
html[data-theme="dark"][data-visual="paper"] .search-card,
html[data-theme="dark"][data-visual="paper"] .share-card,
html[data-theme="dark"][data-visual="paper"] .templates-card {
  box-shadow:
    0 2px 4px rgba(0,0,0,0.3),
    0 8px 24px rgba(0,0,0,0.5);
}

/* ── Page editor ──────────────────────────────────────────── */
html[data-visual="paper"] #page-title {
  font-weight: 700;
  letter-spacing: -0.02em;
}

html[data-visual="paper"] .editor-blocks .block:hover > .block-row {
  background: var(--hover);
  border-radius: 4px;
}

html[data-visual="paper"] .editor-blocks .block.block-callout > .block-row,
html[data-visual="paper"] .editor-blocks .block.block-callout .block-row {
  background: var(--callout-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

html[data-visual="paper"] .editor-blocks .block.block-quote .block-row {
  border-left: 3px solid var(--text);
  padding-left: 12px;
}

html[data-visual="paper"] .editor-blocks .block.block-code .block-row {
  background: var(--code-bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ── Buttons ──────────────────────────────────────────────── */
html[data-visual="paper"] .btn-primary {
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  box-shadow: none;
  transition: background 0.15s ease, opacity 0.15s ease;
}
html[data-visual="paper"] .btn-primary:hover {
  opacity: 0.85;
}

/* ── Slash menu & context menu ────────────────────────────── */
html[data-visual="paper"] #slash-menu {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ── Cards (time tracker, whiteboard list, calendar) ──────── */
html[data-visual="paper"] .tt-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
  backdrop-filter: none;
}
html[data-visual="paper"] .tt-card:hover {
  background: var(--bg-2);
  box-shadow: var(--shadow-sm);
}
html[data-visual="paper"] .wb-list-root .wb-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: none;
  backdrop-filter: none;
}
html[data-visual="paper"] .wb-list-root .wb-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── Database ─────────────────────────────────────────────── */
html[data-visual="paper"] .db-tab {
  border-radius: 4px 4px 0 0;
  border: 1px solid transparent;
  border-bottom: none;
}
html[data-visual="paper"] .db-tab.active {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}
html[data-visual="paper"] .db-row:hover {
  background: var(--hover);
}

/* ── Page icon ────────────────────────────────────────────── */
html[data-visual="paper"] .page-icon-wrap .page-icon {
  background: transparent;
  box-shadow: none;
  border-radius: 6px;
}
html[data-visual="paper"] .page-icon-wrap:hover .page-icon {
  background: var(--hover);
}

/* ── Workspace switcher / menu ────────────────────────────── */
html[data-visual="paper"] #workspace-menu {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ── Settings panel ───────────────────────────────────────── */
html[data-visual="paper"] .settings-nav {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
}
html[data-visual="paper"] .settings-nav .snav-item.active {
  background: var(--hover-strong);
  border-radius: 6px;
  color: var(--text);
}

/* ── Notion light-mode paper feel ─────────────────────────── */
html[data-visual="paper"][data-theme="light"] {
  --bg:   #ffffff;
  --bg-2: #f7f6f3;
  --bg-3: #f1f0ec;
  --hover: #ededeb;
  --border: #e9e8e6;
  --callout-bg: #f4f4f2;
}

html[data-visual="paper"][data-theme="dark"] {
  --bg:   #191919;
  --bg-2: #1f1f1f;
  --bg-3: #272727;
}

/* Disable all glass / immersive effects for PAPER STYLE */
html[data-visual="paper"] body::before,
html[data-visual="paper"] body::after {
  display: none !important;
  content: none !important;
}
html[data-visual="paper"] #sidebar::before,
html[data-visual="paper"] #sidebar::after {
  display: none !important;
  content: none !important;
}


/* ============================================================
   FLUENT STYLE  (Microsoft Fluent Design / Windows 11 Acrylic)
   ============================================================ */

/* ── Design tokens ────────────────────────────────────────── */
html[data-visual="fluent"] {
  --fluent-radius:   8px;
  --fluent-radius-lg: 12px;
  --fluent-shadow: 0 2px 6px rgba(0,0,0,0.10), 0 10px 30px rgba(0,0,0,0.12);
  --fluent-shadow-dark: 0 2px 6px rgba(0,0,0,0.40), 0 10px 30px rgba(0,0,0,0.50);
  --fluent-acrylic-blur: blur(30px) saturate(1.6);
  --fluent-surface: rgba(255,255,255,0.82);
  --fluent-surface-hover: rgba(255,255,255,0.94);
  --fluent-border-light: rgba(0,0,0,0.08);
  --fluent-stroke: 1px;
}
html[data-visual="fluent"][data-theme="dark"] {
  --fluent-shadow: var(--fluent-shadow-dark);
  --fluent-surface: rgba(32,32,32,0.80);
  --fluent-surface-hover: rgba(45,45,45,0.92);
  --fluent-border-light: rgba(255,255,255,0.07);
}

/* ── Sidebar ──────────────────────────────────────────────── */
html[data-visual="fluent"] #sidebar,
html[data-visual="fluent"] .sidebar {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border-right: 1px solid var(--fluent-border-light);
  box-shadow: 4px 0 16px rgba(0,0,0,0.06);
}

html[data-visual="fluent"] .sb-item {
  border-radius: var(--fluent-radius);
  font-weight: 400;
  letter-spacing: 0;
  transition: background 0.1s ease, box-shadow 0.1s ease;
}
html[data-visual="fluent"] .sb-item:hover {
  background: var(--hover);
}
html[data-visual="fluent"] .sb-item.active,
html[data-visual="fluent"] .sb-item[aria-pressed="true"] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
  /* Fluent uses a 3px accent bar on the left for active items */
  position: relative;
}
html[data-visual="fluent"] .sb-item.active::before,
html[data-visual="fluent"] .sb-item[aria-pressed="true"]::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
}

/* ── Topbar ───────────────────────────────────────────────── */
html[data-visual="fluent"] .topbar {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border-bottom: 1px solid var(--fluent-border-light);
  box-shadow: 0 1px 0 var(--fluent-border-light);
}

/* ── Modals & cards ───────────────────────────────────────── */
html[data-visual="fluent"] .modal-card,
html[data-visual="fluent"] .settings-card,
html[data-visual="fluent"] .search-card,
html[data-visual="fluent"] .share-card,
html[data-visual="fluent"] .templates-card {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius-lg);
  box-shadow: var(--fluent-shadow);
}

/* ── Page editor ──────────────────────────────────────────── */
html[data-visual="fluent"] #page-title {
  font-weight: 600;
  letter-spacing: -0.015em;
}

html[data-visual="fluent"] .editor-blocks .block:hover > .block-row {
  background: var(--hover);
  border-radius: var(--fluent-radius);
}

html[data-visual="fluent"] .editor-blocks .block.block-callout > .block-row,
html[data-visual="fluent"] .editor-blocks .block.block-callout .block-row {
  background: var(--primary-soft);
  border-radius: var(--fluent-radius);
  border-left: 3px solid var(--primary);
}

html[data-visual="fluent"] .editor-blocks .block.block-quote .block-row {
  border-left: 3px solid var(--primary);
  background: var(--hover);
  border-radius: 0 var(--fluent-radius) var(--fluent-radius) 0;
  padding-left: 14px;
}

html[data-visual="fluent"] .editor-blocks .block.block-code .block-row {
  background: var(--bg-3);
  border-radius: var(--fluent-radius);
  border: 1px solid var(--border);
}

/* ── Buttons ──────────────────────────────────────────────── */
html[data-visual="fluent"] .btn-primary {
  background: var(--primary);
  color: #fff;
  border-radius: var(--fluent-radius);
  border: 1px solid transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset;
  transition: background 0.12s ease, filter 0.12s ease;
}
html[data-visual="fluent"] .btn-primary:hover {
  filter: brightness(1.08);
}

/* ── Slash menu & context menu ────────────────────────────── */
html[data-visual="fluent"] #slash-menu {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius-lg);
  box-shadow: var(--fluent-shadow);
}

/* ── Cards ─────────────────────────────────────────────────── */
html[data-visual="fluent"] .tt-card {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius-lg);
  box-shadow: var(--fluent-shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
html[data-visual="fluent"] .tt-card:hover {
  box-shadow: var(--fluent-shadow), 0 0 0 1px var(--primary-soft);
  transform: translateY(-2px);
}
html[data-visual="fluent"] .wb-list-root .wb-card {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius-lg);
  box-shadow: var(--fluent-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
html[data-visual="fluent"] .wb-list-root .wb-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--fluent-shadow), 0 0 0 1px var(--primary-soft);
}

/* ── Database ─────────────────────────────────────────────── */
html[data-visual="fluent"] .db-tab {
  border-radius: var(--fluent-radius) var(--fluent-radius) 0 0;
  border: 1px solid transparent;
}
html[data-visual="fluent"] .db-tab.active {
  background: var(--primary-soft);
  border-color: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
html[data-visual="fluent"] .db-row:hover {
  background: var(--hover);
}
html[data-visual="fluent"] .db-tag {
  border-radius: 4px;
}

/* ── Page icon ────────────────────────────────────────────── */
html[data-visual="fluent"] .page-icon-wrap .page-icon {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius);
  box-shadow: var(--fluent-shadow);
}
html[data-visual="fluent"] .page-icon-wrap:hover .page-icon {
  background: var(--fluent-surface-hover);
}

/* ── Workspace menu ───────────────────────────────────────── */
html[data-visual="fluent"] #workspace-menu {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius-lg);
  box-shadow: var(--fluent-shadow);
}

/* ── Settings panel ───────────────────────────────────────── */
html[data-visual="fluent"] .settings-nav {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border-right: 1px solid var(--fluent-border-light);
}
html[data-visual="fluent"] .settings-nav .snav-item.active {
  background: var(--primary-soft);
  border-radius: var(--fluent-radius);
  color: var(--primary);
  font-weight: 600;
  position: relative;
}
html[data-visual="fluent"] .settings-nav .snav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  bottom: 25%;
  width: 3px;
  border-radius: 2px;
  background: var(--primary);
}

/* ── Calendar ──────────────────────────────────────────────── */
html[data-visual="fluent"] .cal-event {
  background: var(--primary-soft);
  border-radius: var(--fluent-radius);
  border: none;
}
html[data-visual="fluent"] .cal-event:hover {
  background: var(--primary);
  color: #fff;
}

/* ── Graph/AI panel rows ───────────────────────────────────── */
html[data-visual="fluent"] .gv-panel .gv-section,
html[data-visual="fluent"] .gv-panel .gv-row {
  background: var(--fluent-surface);
  backdrop-filter: var(--fluent-acrylic-blur);
  -webkit-backdrop-filter: var(--fluent-acrylic-blur);
  border: 1px solid var(--fluent-border-light);
  border-radius: var(--fluent-radius);
}
html[data-visual="fluent"] .gv-mode {
  border-radius: var(--fluent-radius);
  border: 1px solid var(--fluent-border-light);
}
html[data-visual="fluent"] .gv-mode:hover {
  background: var(--hover);
  border-color: var(--border);
}

/* ── Ambient background glow (Fluent light-up) ─────────────── */
html[data-visual="fluent"] body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 10%, var(--primary-soft) 0%, transparent 65%),
    radial-gradient(ellipse 60% 50% at 85% 90%, var(--primary-soft) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}
html[data-visual="fluent"][data-theme="dark"] body::before {
  opacity: 0.3;
}

/* ── Reduced-motion: strip all blur & transform ─────────────── */
@media (prefers-reduced-motion: reduce) {
  html[data-visual="paper"] *,
  html[data-visual="fluent"] * {
    transition-duration: 0.01ms !important;
    animation-duration:  0.01ms !important;
  }
  html[data-visual="fluent"] #sidebar,
  html[data-visual="fluent"] .topbar,
  html[data-visual="fluent"] .modal-card,
  html[data-visual="fluent"] .settings-card,
  html[data-visual="fluent"] .search-card,
  html[data-visual="fluent"] .share-card,
  html[data-visual="fluent"] .templates-card,
  html[data-visual="fluent"] #slash-menu,
  html[data-visual="fluent"] #workspace-menu,
  html[data-visual="fluent"] .tt-card,
  html[data-visual="fluent"] .wb-list-root .wb-card,
  html[data-visual="fluent"] .settings-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ============================================================
   SETTINGS PANEL — light mode contrast fix
   The nav sidebar was #f7f7f5 (warm grey). Make it white so
   the panel has proper contrast in all light-based themes.
   Scoped to [data-theme="light"] to not affect dark mode.
   ============================================================ */
[data-theme="light"] .settings-nav {
  background: var(--bg);
  border-right: 1px solid var(--border);
}
[data-theme="light"] .settings-nav button.active {
  background: var(--hover);
  box-shadow: inset 3px 0 0 var(--text);
}
/* Ensure text in settings body is always readable in light mode.
   Some liquid-glass layers push --text toward var(--bg) on tinted
   surfaces — this pins it back to the token value. */
[data-theme="light"] .settings-body,
[data-theme="light"] .settings-body * {
  color: inherit;
}
[data-theme="light"] .settings-body {
  color: var(--text);
}
[data-theme="light"] .settings-section-label,
[data-theme="light"] .settings-row .sr-info-title {
  color: var(--text);
}
[data-theme="light"] .settings-row .sr-info-desc,
[data-theme="light"] .settings-section-sub {
  color: var(--text-2);
}

/* ════════════════════════════════════════════════
   Page Tab Bar  (#page-tab-bar)
   Chrome-style tab bar between topbar and editor.
   Appears only when 2+ pages are open.
   ════════════════════════════════════════════════ */
#page-tab-bar {
  /* JS controls visibility: style.display='' shows flex, style.display='none' hides */
  flex-shrink: 0;
  height: 36px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  z-index: 10;
  position: relative;
}

/* Scrollable list of tabs */
.ptb-list {
  display: flex;
  align-items: stretch;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.ptb-list::-webkit-scrollbar { display: none; }

/* Individual tab */
.ptb-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px 0 10px;
  min-width: 100px;
  max-width: 200px;
  height: 100%;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s, color 0.1s;
  position: relative;
  flex-shrink: 0;
}
.ptb-tab:hover {
  background: var(--hover);
  color: var(--text);
}
.ptb-tab.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 500;
}
/* active tab bottom indicator */
.ptb-tab.active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.ptb-icon {
  font-size: 13px;
  flex-shrink: 0;
  line-height: 1;
}
.ptb-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Close × button inside each tab */
.ptb-close {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 4px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.1s, background 0.1s, color 0.1s;
  padding: 0;
}
.ptb-tab:hover .ptb-close,
.ptb-tab.active .ptb-close { opacity: 1; }
.ptb-close:hover { background: var(--hover-strong); color: var(--text); }

/* "Close all" button on the right end */
.ptb-close-all {
  flex-shrink: 0;
  width: 36px; height: 100%;
  background: transparent;
  border: none;
  border-left: 1px solid var(--border);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  transition: background 0.1s, color 0.1s;
}
.ptb-close-all:hover { background: var(--hover); color: var(--text); }

/* Liquid-glass tint for the tab bar when in glass mode */
/* Light glass */
html[data-visual="liquid-glass"][data-theme="light"] #page-tab-bar {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
/* Dark — all visual styles */
[data-theme="dark"] #page-tab-bar {
  background: rgba(0,0,0,0.82) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .ptb-tab {
  border-right-color: rgba(255,255,255,0.07);
}
[data-theme="dark"] .ptb-tab.active {
  background: rgba(255,255,255,0.08);
}
[data-theme="dark"] .ptb-tab:hover {
  background: rgba(255,255,255,0.05);
}

.ptb-tab.ptb-drag-over {
  background: var(--hover-strong, rgba(120,120,120,0.18)) !important;
  border-left: 2px solid var(--primary);
}

@media (prefers-reduced-motion: reduce) {
  .ptb-tab, .ptb-close, .ptb-close-all { transition: none; }
}
