/* =========================================================
   Jegyzetek & Linkek
   ========================================================= */

/* Jegyzetszínek: világos és sötét témában is a felülethez keverve */
.note--plain  { --note: var(--surface); }
.note--yellow { --note: color-mix(in srgb, #f5c518 22%, var(--surface)); }
.note--green  { --note: color-mix(in srgb, #2f9e6a 22%, var(--surface)); }
.note--blue   { --note: color-mix(in srgb, #3b6cf6 20%, var(--surface)); }
.note--pink   { --note: color-mix(in srgb, #d4508f 20%, var(--surface)); }
.note--purple { --note: color-mix(in srgb, #7c5cdb 22%, var(--surface)); }

/* ---------- Eszközsor ---------- */
.notes-toolbar { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); }
.search {
  flex: 1;
  display: flex; align-items: center; gap: var(--space-2);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; min-width: 0; padding: 9px 0; border: 0; outline: 0; background: transparent; }
.notes-section {
  margin: var(--space-5) 0 var(--space-3);
  font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted);
}

/* ---------- Gyors jegyzet ---------- */
.note-composer {
  display: grid; gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.note-composer:focus-within { border-color: var(--accent); }
.note-composer .textarea { min-height: 44px; border: 0; background: transparent; padding: 4px; resize: none; outline: none; }
.note-composer__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.note-composer--compact {
  grid-template-columns: 1fr auto; align-items: end;
  padding: 6px 6px 6px var(--space-2);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.note-composer--compact .textarea { min-height: 32px; font-size: .9rem; }
code { padding: 0 4px; border-radius: 4px; background: var(--surface-2); font-family: var(--font-mono); font-size: .85em; }

/* ---------- Jegyzetkártyák (masonry hasábok) ---------- */
.note-grid { columns: 280px; column-gap: var(--space-3); }
.note {
  break-inside: avoid;
  display: grid; gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--note);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.note:hover { border-color: var(--accent); }
.note__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.note__head:empty { display: none; }
.note__title { font-size: 1rem; overflow-wrap: anywhere; }
.note__pin { margin-left: auto; font-size: .85rem; }
.note__body { font-size: .92rem; overflow-wrap: anywhere; }
.note__foot { display: flex; justify-content: space-between; color: var(--text-muted); font-size: .75rem; }

.nl { min-height: 1.5em; }
.nl--gap { min-height: .6em; }
.nl--head { font-weight: 700; }
.nl--bullet { position: relative; padding-left: 14px; }
.nl--bullet::before { content: "•"; position: absolute; left: 2px; color: var(--text-muted); }
.nl--check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.nl--check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--success); flex-shrink: 0; }
.nl--check.is-done span { color: var(--text-muted); text-decoration: line-through; }
.nl--more { color: var(--text-muted); }
.nl a { word-break: break-all; }

/* ---------- Jegyzet-szerkesztő ---------- */
.note-editor { display: grid; gap: var(--space-3); }
.note-editor__title { font-weight: 600; font-size: 1.05rem; }
.note-editor__body { min-height: 220px; line-height: 1.55; }
.note-editor__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.note-colors { display: flex; gap: 6px; }
.note-color {
  width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--note);
}
.note-color[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.field--center { align-self: end; padding-bottom: 10px; }

/* ---------- Link-csempék ---------- */
.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-2); }
.link-tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.link-tile:hover { border-color: var(--accent); }
.link-tile__a {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3);
  padding-right: 40px;
  color: inherit; text-decoration: none;
}
.link-tile__a:hover { text-decoration: none; }
.link-tile__icon {
  position: relative;
  display: grid; place-items: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 10px;
  background: var(--accent-soft);
  overflow: hidden;
}
/* Betű-ikon, ha nincs (vagy nem tölt be) favicon */
.link-tile__icon::before { content: attr(data-letter); font-weight: 700; color: var(--accent); }
.link-tile__icon img { position: absolute; inset: 6px; width: 24px; height: 24px; opacity: 0; }
.link-tile__icon.has-img img { opacity: 1; }
.link-tile__icon.has-img::before { content: none; }
.link-tile__text { display: grid; min-width: 0; }
.link-tile__title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-tile__domain { font-size: .75rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-tile__edit { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); opacity: 0; }
.link-tile:hover .link-tile__edit, .link-tile__edit:focus-visible { opacity: 1; }
@media (hover: none) { .link-tile__edit { opacity: .6; } }

/* Főoldali, tömörebb csempék */
.notes-widget { display: grid; gap: var(--space-3); }
.link-grid--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.link-grid--compact .link-tile { border: 0; background: transparent; }
.link-grid--compact .link-tile__a { flex-direction: column; gap: 4px; padding: 6px 2px; text-align: center; }
.link-grid--compact .link-tile__icon { width: 44px; height: 44px; border-radius: 12px; }
.link-grid--compact .link-tile__icon img { inset: 10px; }
.link-grid--compact .link-tile__title { font-size: .75rem; max-width: 100%; }
.link-grid--compact .link-tile__domain { display: none; }
.link-grid--compact .link-tile:hover .link-tile__icon { box-shadow: 0 0 0 2px var(--accent); }
.notes-widget .note { margin: 0; box-shadow: none; }

@media (max-width: 720px) {
  .notes-toolbar { flex-wrap: wrap; }
  .notes-toolbar .btn { width: 100%; justify-content: center; }
  .notes-view .page-header { flex-wrap: wrap; }
  .link-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .link-grid.link-grid--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
