/* ==========================================================================
   Life OS — Ideas module
   Idea cards · Board gallery · Lists · Whiteboard editor
   ========================================================================== */

/* ---------------- Shared ---------------- */
.add-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 150px;
  border: 1.5px dashed var(--border-2); background: transparent; box-shadow: none; color: var(--text-3); font-weight: 550; transition: all 0.15s;
}
.add-tile:hover { color: var(--text); border-color: var(--text-3); background: var(--surface); }

/* ---------------- Ideas ---------------- */
.idea-filters { display: flex; align-items: center; gap: 8px; }
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--gap); align-items: start; }
.idea { display: flex; flex-direction: column; gap: 10px; padding: 18px; overflow: hidden; }
.idea::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--ic); opacity: 0.85; }
.idea.is-quiet { background: var(--surface-2); box-shadow: none; }
.idea.is-quiet .idea-title { color: var(--text-2); }
.idea-top { display: flex; align-items: center; gap: 2px; }
.idea-top .chip { cursor: pointer; }
.idea-pin { opacity: 0; transition: opacity 0.15s, color 0.15s; }
.idea:hover .idea-pin, .idea-pin:focus-visible, .idea-pin.on { opacity: 1; }
.idea-pin.on { color: var(--accent-text); }
.idea-title { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; cursor: pointer; word-break: break-word; }
.idea-title:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-2); }
.idea-note { color: var(--text-2); font-size: 13px; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.idea-tags { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 12.5px; color: var(--text-2); }
.idea-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.w-ideas .list-row { padding: 9px 4px; }

/* ---------------- Board gallery ---------------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.board-card { display: flex; flex-direction: column; transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s; }
.board-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-2); }
.board-thumb { display: grid; place-items: center; aspect-ratio: 16 / 10; padding: 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); overflow: hidden; }
.board-thumb svg, .tpl-thumb svg:not(.i) { width: 100%; height: 100%; pointer-events: none; }
.board-meta { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; }
.board-grid .add-tile { min-height: 0; }
.tpl-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tpl {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 10px 10px 12px; text-align: left;
  border-radius: 20px; border: 1px solid var(--border); background: var(--surface-2); transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s var(--ease);
}
.tpl:hover { border-color: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl:active { transform: scale(0.98); }
.tpl-thumb { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; margin-bottom: 8px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text-3); overflow: hidden; }

/* ---------------- Lists ---------------- */
.list-wall { columns: 320px; column-gap: var(--gap); }
.list-wall > * { break-inside: avoid; margin-bottom: var(--gap); width: 100%; }
.list-wall .add-tile { min-height: 110px; }
.list-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.lc-head { display: flex; align-items: center; gap: 10px; }
.lc-head .list-main { cursor: pointer; }
.lc-head .btn-icon { margin-right: -6px; }
.li-list { display: flex; flex-direction: column; }
.li { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; border-radius: 10px; }
.li-grip { position: absolute; left: -16px; top: 8px; color: var(--text-3); opacity: 0; cursor: grab; touch-action: none; transition: opacity 0.15s; }
.li:hover .li-grip { opacity: 1; }
.li.lifting { z-index: 2; background: var(--surface); box-shadow: var(--shadow); }
.li .mini-check { margin-top: 2px; }
.li-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); margin: 8px 6px 0; flex-shrink: 0; }
.li-num { min-width: 18px; text-align: right; font-size: 13px; line-height: 21px; color: var(--text-3); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.li-text { flex: 1; min-width: 0; outline: none; line-height: 1.5; word-break: break-word; white-space: pre-wrap; cursor: text; }
.li-text:focus-visible { box-shadow: none; }
.li-text:empty::before { content: 'New item'; color: var(--text-3); }
.li.is-done .li-text { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-2); }
.li-del { opacity: 0; margin: -2px -6px 0 0; flex-shrink: 0; transition: opacity 0.15s; }
.li:hover .li-del, .li:focus-within .li-del { opacity: 1; }
.lc-more { align-self: flex-start; }
.li-add { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--text-3); }
.li-new { flex: 1; min-width: 0; height: 30px; border: 0; outline: 0; background: none; font-size: 14px; }
.li-new::placeholder { color: var(--text-3); }
.li-new:focus-visible { box-shadow: none; }
.li-add:focus-within { color: var(--text); }

/* ---------------- Whiteboard ----------------
   An open board is "immersive": it fills the page area and hides the mobile bottom bar. */
.app.immersive .page { max-width: none; padding: 0 20px 20px; height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); }
.app.immersive .bottom-nav { display: none; }
.wb { height: 100%; }
.wb-stage { position: relative; height: 100%; border-radius: var(--r-xl); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.wb-svg { position: absolute; inset: 0; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }
.wb-dot { fill: var(--border-2); }
.wb-svg.no-grid .wb-grid { display: none; }
.sh-text { user-select: none; -webkit-user-select: none; }
.wb-live { fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.sh.erasing { opacity: 0.25; }
.sh.is-target { filter: drop-shadow(0 0 5px var(--info)); }
.wb-stage[data-tool='select'] .wb-world .sh { cursor: move; }
.wb-stage[data-tool='hand'], .wb-stage.can-pan { cursor: grab; }
.wb-stage[data-tool='draw'], .wb-stage[data-tool='rect'], .wb-stage[data-tool='ellipse'], .wb-stage[data-tool='diamond'],
.wb-stage[data-tool='note'], .wb-stage[data-tool='line'], .wb-stage[data-tool='arrow'] { cursor: crosshair; }
.wb-stage[data-tool='text'] { cursor: text; }
.wb-stage[data-tool='eraser'] { cursor: cell; }
.wb-stage.panning, .wb-stage.panning .sh { cursor: grabbing !important; }

/* selection */
.wb-sel { fill: none; stroke: var(--info); stroke-width: 1.5; pointer-events: none; }
.wb-sel.thin { stroke-width: 1; opacity: 0.55; }
.wb-h { fill: var(--surface); stroke: var(--info); stroke-width: 1.5; cursor: nwse-resize; }
.wb-h[data-h='ne'], .wb-h[data-h='sw'] { cursor: nesw-resize; }
.wb-h[data-h='p1'], .wb-h[data-h='p2'] { cursor: grab; }
.wb-marquee { fill: color-mix(in srgb, var(--info) 10%, transparent); stroke: var(--info); stroke-width: 1; pointer-events: none; }

/* label editor (sits over the shape while typing) */
.wb-edit { position: absolute; display: flex; align-items: center; justify-content: center; pointer-events: none; font-weight: 500; line-height: 1.3; }
.wb-edit-in { pointer-events: auto; min-width: 8px; outline: none; text-align: center; white-space: pre-wrap; word-break: break-word; caret-color: var(--info); cursor: text; }
.wb-edit-in:focus-visible { box-shadow: none; }
.wb-edit.is-text { display: block; }
.wb-edit.is-text .wb-edit-in { text-align: left; white-space: pre; }

/* floating controls */
.wb-hud { position: absolute; display: flex; align-items: center; gap: 2px; padding: 5px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
.wb-hud [disabled] { opacity: 0.35; pointer-events: none; }
.wb-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--border); flex-shrink: 0; }
.wb-tl { top: 14px; left: 14px; max-width: calc(100% - 260px); }
.wb-name { width: 220px; min-width: 0; height: 32px; padding: 0 8px; border: 0; border-radius: 10px; outline: none; background: none; font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; text-overflow: ellipsis; }
.wb-name:hover, .wb-name:focus { background: var(--surface-2); box-shadow: none; }
.wb-tr { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.wb-tr > * { position: static; pointer-events: auto; }
.wb-style-btn { display: none; width: 46px; height: 46px; justify-content: center; border-radius: 50%; }
.wb-style-btn i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.3); }
.wb-panel { flex-direction: column; align-items: stretch; gap: 8px; width: 218px; padding: 10px; }
.wb-colors { display: grid; grid-template-columns: repeat(9, 1fr); }
.wb-sw { aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; }
.wb-sw::after { content: ''; width: 15px; height: 15px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgba(128, 128, 128, 0.25); transition: transform 0.15s var(--spring); }
.wb-sw:hover::after { transform: scale(1.2); }
.wb-sw.active { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-2); }
.wb-seg { display: flex; }
.wb-seg .seg-btn { flex: 1; justify-content: center; padding: 0 4px; }
.wb-acts { display: flex; align-items: center; gap: 2px; padding-top: 8px; border-top: 1px solid var(--border); }
.wb-del:hover { background: var(--bad-soft); color: var(--bad); }
.wb-bl { left: 14px; bottom: 14px; }
.wb-zoom { min-width: 52px; height: 30px; padding: 0 6px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wb-zoom:hover { background: var(--surface-3); color: var(--text); }
.wb-tools { left: 50%; bottom: 14px; transform: translateX(-50%); max-width: calc(100% - 28px); padding: 6px; border-radius: 22px; overflow-x: auto; scrollbar-width: none; }
.wb-tools::-webkit-scrollbar { display: none; }
.wb-tool { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 14px; color: var(--text-2); transition: background 0.15s, color 0.15s, transform 0.12s; }
.wb-tool:hover { background: var(--surface-3); color: var(--text); }
.wb-tool:active { transform: scale(0.94); }
.wb-tool.active { background: var(--accent); color: var(--accent-ink); }
.wb-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 24px; text-align: center; font-size: 13.5px; color: var(--text-3); pointer-events: none; }
.wb-empty b { font-size: 16px; font-weight: 600; color: var(--text-2); }
.wb-empty[hidden] { display: none; }

/* the zoom bar would run into the toolbar on narrower screens: lift it above */
@media (max-width: 1240px) {
  .wb-bl { bottom: 76px; }
}
@media (hover: none) {
  .idea-pin { opacity: 1; }
  .li-del { opacity: 0.6; }
}
@media (max-width: 760px) {
  .idea-grid { grid-template-columns: 1fr; }
  .board-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .board-meta { padding: 10px 4px 10px 12px; }
  .tpl-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .list-wall { columns: 1; }
  .li { padding: 6px 0; }
  .li-grip { position: static; opacity: 0.45; margin: 5px -2px 0 -4px; }
  .li-new { font-size: 16px; height: 36px; } /* avoid iOS zoom */

  .app.immersive .topbar { display: none; }
  .app.immersive .page { height: 100vh; height: 100dvh; padding: 0; }
  .wb-stage { border: 0; border-radius: 0; box-shadow: none; }
  .wb-tl { top: calc(10px + env(safe-area-inset-top)); left: 10px; max-width: calc(100% - 78px); }
  .wb-name { width: 150px; font-size: 16px; }
  .wb-tr { top: calc(10px + env(safe-area-inset-top)); right: 10px; }
  .wb-style-btn { display: flex; }
  .wb-panel { display: none; }
  .wb.panel-open .wb-panel { display: flex; }
  .wb-bl { left: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .wb-tools { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); transform: none; max-width: none; }
  .wb-tool { width: 44px; height: 44px; }
}
