/* ============================================================
   Orbit Notes — keeps.azuresatellite.com
   Typeface: Exo 2 (SIL Open Font License, see /fonts/OFL.txt)
   ============================================================ */

/* ---------- Exo 2 webfont ---------- */
@font-face { font-family:'Exo 2'; font-weight:100; font-style:normal; src:url('/fonts/Exo2Thin-3xXz.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:200; font-style:normal; src:url('/fonts/Exo2ExtraLight-oqoz.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:300; font-style:normal; src:url('/fonts/Exo2Light-eyVB.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:400; font-style:normal; src:url('/fonts/Exo2-73YD.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:400; font-style:italic; src:url('/fonts/Exo2Italic-0xKX.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:500; font-style:normal; src:url('/fonts/Exo2Medium-aDL9.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:600; font-style:normal; src:url('/fonts/Exo2SemiBold-OKY3.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:700; font-style:normal; src:url('/fonts/Exo2Bold-P2rE.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:700; font-style:italic; src:url('/fonts/Exo2BoldItalic-LYR4.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:800; font-style:normal; src:url('/fonts/Exo2ExtraBold-XDrK.ttf') format('truetype'); font-display:swap; }
@font-face { font-family:'Exo 2'; font-weight:900; font-style:normal; src:url('/fonts/Exo2Black-m3ov.ttf') format('truetype'); font-display:swap; }

/* ---------- theme variables ---------- */
:root {
  --font: 'Exo 2', system-ui, sans-serif;
  --bg: #fff7e6;            /* warm canvas */
  --bg-solid: #fff7e6;
  --surface: #ffffff;
  --surface-2: #f1f3f4;
  --text: #202124;
  --text-2: #5f6368;
  --accent: #0b57d0;
  --accent-contrast: #ffffff;
  --border: #d3d6db;
  --hover: rgba(60,64,67,.08);
  --selected: rgba(255,160,67,.18);
  --shadow: 0 1px 2px rgba(60,64,67,.3), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-lg: 0 6px 10px rgba(0,0,0,.10), 0 1px 18px rgba(0,0,0,.08), 0 3px 5px rgba(0,0,0,.20);
  --scrim: rgba(32,33,36,.5);
  --card-note-bg: #ffffff;
  --card-note-text: #202124;
  --radius: 8px;
  --sidebar-w: 252px;
}
html[data-theme="dark"] {
  --bg: #202124;
  --bg-solid: #202124;
  --surface: #2d2e30;
  --surface-2: #3c4043;
  --text: #e8eaed;
  --text-2: #9aa0a6;
  --accent: #fdd663;
  --accent-contrast: #202124;
  --border: #5f6368;
  --hover: rgba(232,234,237,.08);
  --selected: rgba(253,214,99,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.5), 0 2px 6px 2px rgba(0,0,0,.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.6);
  --scrim: rgba(0,0,0,.6);
  --card-note-bg: #2d2e30;   /* Keep: page #202124, cards #2d2e30 */
  --card-note-text: #e8eaed;
}
html[data-theme="auto"] { } /* resolved in JS via prefers-color-scheme */

/* ---------- note colour palette (light / dark variants) ---------- */
[data-bg=""]            { --c-light: var(--card-note-bg); --c-dark: var(--card-note-bg); }
[data-bg="coral"]       { --c-light:#faafa8; --c-dark:#5f1b16; }
[data-bg="peach"]       { --c-light:#ffcc80; --c-dark:#5f2b16; }
[data-bg="sand"]        { --c-light:#fff8b5; --c-dark:#635311; }
[data-bg="mint"]        { --c-light:#a7f0c8; --c-dark:#074d33; }
[data-bg="sage"]        { --c-light:#a5d6a7; --c-dark:#1e4620; }
[data-bg="fog"]         { --c-light:#bfe3fb; --c-dark:#025679; }
[data-bg="storm"]       { --c-light:#b8c6d3; --c-dark:#2f3a44; }
[data-bg="dusk"]        { --c-light:#d7c2fa; --c-dark:#3e2e5e; }
[data-bg="blossom"]     { --c-light:#f8c8ec; --c-dark:#5c2246; }
[data-bg="clay"]        { --c-light:#e8cba9; --c-dark:#4c2c05; }
[data-bg="chalk"]       { --c-light:#eef1f4; --c-dark:#242b33; }
[data-bg="linen"]       { --c-light:#ffe5cc; --c-dark:#562e14; }
[data-bg="herringbone"] { --c-light:#ccd9e5; --c-dark:#202b36; }
[data-bg="feijoa"]      { --c-light:#c5e1a5; --c-dark:#2c4021; }
[data-bg="inky"]        { --c-light:#c6d9f7; --c-dark:#172544; }
.note, .editor { background: var(--c-light, var(--card-note-bg)); color: var(--card-note-text); }
html[data-theme="dark"] .note, html[data-theme="dark"] .editor { background: var(--c-dark, var(--card-note-bg)); }

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
button { font-family: var(--font); border: none; background: none; color: inherit; cursor: pointer; }
input, textarea { font-family: var(--font); color: var(--text); }
::placeholder { color: var(--text-2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 5px; }
svg.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.hidden { display: none !important; }
.spacer { flex: 1; }

.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%; color: var(--text-2);
}
.iconbtn:hover { background: var(--hover); color: var(--text); }
.iconbtn.active { color: #f29900; }

/* ---------- app layout ---------- */
#app { display: flex; min-height: 100vh; }

/* sidebar */
#sidebar {
  width: var(--sidebar-w); flex: none; padding: 8px 12px 24px; position: sticky; top: 0;
  height: 100vh; overflow-y: auto; z-index: 30;
}
#sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.navitem {
  display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 40px;
  border-radius: 0 24px 24px 0; color: var(--text); font-weight: 500; width: 100%; text-align: left;
}
.navitem:hover { background: var(--hover); }
.navitem.active { background: #ffde6c; color: #202124; font-weight: 700; }
html[data-theme="dark"] .navitem.active { background: #3c4043; color: var(--text); }
.navitem .count { margin-left: auto; color: var(--text-2); font-size: 12px; }
.side-sep { height: 1px; background: var(--border); margin: 12px 8px 12px 24px; opacity: .6; }
.side-title { padding: 8px 16px 4px 24px; color: var(--text-2); font-size: 12px; font-weight: 700; letter-spacing: .4px; }

/* main */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* header */
#topbar {
  position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 8px;
  padding: 12px 24px; background: var(--bg-solid);
}
#menu-btn { margin-right: 4px; }
#search-wrap {
  flex: 1; max-width: 720px; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-radius: 28px; padding: 0 8px 0 20px; height: 48px;
}
#search-wrap:focus-within { box-shadow: var(--shadow); }
#search-input { flex: 1; border: none; outline: none; background: transparent; font-size: 15px; }
#toolbar { display: flex; align-items: center; gap: 2px; margin-left: auto; }
#avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; margin-left: 8px;
}
/* filter chips row */
#filterbar { display: flex; gap: 8px; padding: 0 24px 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px;
  border-radius: 8px; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.15);
  font-weight: 600; color: var(--text-2);
}
.chip:hover { color: var(--text); }
.chip.on { background: #e8f0fe; color: #1a56c9; }
html[data-theme="dark"] .chip.on { background: #023a7a; color: #8ab4f8; }
.chip .x { margin-left: 2px; }

/* selection toolbar */
#selbar {
  position: fixed; top: 12px; left: calc(var(--sidebar-w) + 24px); right: 24px; z-index: 40;
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 4px; padding: 4px 8px;
}
#selbar .selcount { font-weight: 700; padding: 0 8px; }

/* empty state */
#empty { display: none; flex-direction: column; align-items: center; gap: 8px; padding: 12vh 0; color: var(--text-2); }
#empty svg { width: 220px; height: 160px; opacity: .5; }
#empty .big { font-size: 18px; font-weight: 600; }

/* ---------- note grid (masonry) ---------- */
#grid-wrap { padding: 4px 24px 60px; }
.grid-label { display: flex; align-items: center; gap: 8px; color: var(--text-2); margin: 14px 0 10px; }
.grid-label svg { width: 16px; height: 16px; }
.grid { columns: 5 240px; column-gap: 16px; }
#app.compact .grid { columns: 6 200px; }
#app.listview .grid { columns: 1; max-width: 760px; }
#app.compact .note { font-size: 13px; }
#app.compact .note .n-title { font-size: 14px; }

/* note card */
.note {
  position: relative; break-inside: avoid; border-radius: var(--radius); margin-bottom: 16px;
  padding: 16px 16px 44px; /* bottom strip reserved for the hover action bar */
  box-shadow: 0 1px 2px rgba(60,64,67,.30), 0 2px 6px 2px rgba(60,64,67,.15);
  cursor: pointer; border: 1px solid rgba(95,99,104,.24);
  --text: var(--card-note-text);
}
html[data-theme="dark"] .note { border-color: transparent; }
.note.selected { outline: 2px solid var(--text-2); }
.note:hover { box-shadow: var(--shadow-lg); }
.note .n-title { font-size: 15.5px; font-weight: 700; margin: 0 24px 6px 0; white-space: pre-wrap; word-break: break-word; }
.note .n-text { white-space: pre-wrap; word-break: break-word; line-height: 1.4; max-height: 210px; overflow: hidden; position: relative; }
.note .n-text.collapsed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px;
  background: linear-gradient(transparent, var(--notebg, var(--c-light, var(--card-note-bg))));
}
html[data-theme="dark"] .note .n-text.collapsed::after { background: linear-gradient(transparent, var(--c-dark)); }
.note .more-btn { color: var(--text-2); font-weight: 700; padding: 4px 0 0; }
.note .n-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.note .n-item { display: flex; gap: 10px; align-items: flex-start; line-height: 1.35; }
.note .n-item input { margin-top: 2px; accent-color: #0b57d0; pointer-events: none; }
.note .n-item.done span { text-decoration: line-through; color: var(--text-2); }
.note .n-media { margin: 10px -16px -44px; }
.note .n-media.pad { margin: 10px 0 0; }
.note .n-media img { width: 100%; max-height: 340px; object-fit: cover; display: block; border-radius: 0 0 var(--radius) var(--radius); cursor: zoom-in; }
.note .n-media img.stripe { max-height: 160px; }
.note .n-media .pad { padding: 8px 16px; display: flex; flex-direction: column; gap: 8px; }
.note .n-media audio { width: 100%; height: 36px; }
.note .n-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.label-chip {
  background: #e8eaed; color: var(--text-2); border-radius: 6px; padding: 3px 8px; font-size: 12px; font-weight: 600;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
html[data-theme="dark"] .label-chip { background: #3c4043; }
.label-chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.note .n-reminder { display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-weight: 600; margin-top: 10px; }
.note .n-reminder svg { width: 15px; height: 15px; }
.note .n-owner { color: var(--text-2); font-size: 12px; margin-top: 10px; }
.note .n-pin { position: absolute; top: 10px; right: 10px; color: var(--text-2); }
.note .n-pin svg { width: 17px; height: 17px; }
.note .n-actions {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; gap: 2px; padding: 2px 6px;
  background: inherit; border-radius: 0 0 var(--radius) var(--radius);
  opacity: 0; transition: opacity .12s; align-items: center;
}
.note:hover .n-actions, .note .n-actions:focus-within { opacity: 1; }
.note .n-actions .iconbtn { width: 32px; height: 32px; }
.note .n-actions .iconbtn svg { width: 18px; height: 18px; }
.note .n-select {
  position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; border-radius: 5px;
  background: inherit; display: none; align-items: center; justify-content: center; color: var(--text-2);
  border: 1.5px solid var(--text-2); padding: 0;
}
body.selecting .note .n-select { display: inline-flex; }
.note.selected .n-select { background: var(--text); color: var(--c-light, var(--bg)); border-color: var(--text); }
.note .ro-badge { position: absolute; top: 12px; right: 34px; font-size: 11px; color: var(--text-2); font-weight: 700; }

/* ---------- popovers ---------- */
.popover {
  position: fixed; z-index: 60; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg);
  padding: 8px; min-width: 200px; max-height: 70vh; overflow: auto;
}
.popover .pi {
  display: flex; align-items: center; gap: 14px; padding: 0 12px; height: 40px; width: 100%;
  border-radius: 4px; text-align: left; color: var(--text);
}
.popover .pi:hover { background: var(--hover); }
.popover hr { border: none; border-top: 1px solid var(--border); margin: 6px 4px; }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 8px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(95,99,104,.4); position: relative;
}
.swatch.sel { border: 2px solid var(--text); }
.swatch .num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; color: rgba(0,0,0,.5); }
html[data-theme="dark"] .swatch .num { color: rgba(255,255,255,.6); }
.pop-label { padding: 6px 12px 2px; font-size: 12px; color: var(--text-2); font-weight: 700; }
.pop-check svg { margin-left: auto; }
.pop-check.on svg { display: inline; } .pop-check svg { display: none; }

/* ---------- editor ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--scrim);
  display: flex; align-items: flex-start; justify-content: center; overflow: auto; padding: 24px;
}
.editor {
  width: 100%; max-width: 912px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  margin-top: 4vh; position: relative; border: 1px solid rgba(95,99,104,.24);
  --text: var(--card-note-text);
}
html[data-theme="dark"] .editor { border-color: transparent; }
.editor .e-top { display: flex; align-items: center; padding: 6px 8px 0; gap: 2px; min-height: 44px; }
.editor .e-title {
  flex: 1; border: none; outline: none; background: transparent; font-size: 20px; font-weight: 700;
  padding: 8px 16px 4px; color: inherit;
}
.editor .e-body { padding: 4px 16px 8px; min-height: 60px; }
.editor .e-text {
  width: 100%; border: none; outline: none; background: transparent; resize: none; color: inherit;
  font-size: 14.5px; line-height: 1.5; min-height: 60px; overflow: hidden;
}
.editor .e-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.editor .e-item { display: flex; gap: 12px; align-items: flex-start; }
.editor .e-item input[type=checkbox] { margin-top: 3px; width: 18px; height: 18px; accent-color: #0b57d0; cursor: pointer; }
.editor .e-item input[type=text] { flex: 1; border: none; outline: none; background: transparent; color: inherit; font-size: 14.5px; line-height: 1.4; }
.editor .e-item.done input[type=text] { text-decoration: line-through; color: var(--text-2); }
.editor .e-item .del { opacity: 0; }
.editor .e-item:hover .del { opacity: 1; }
.editor .e-images { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 16px; position: relative; }
.editor .e-images img { max-width: 100%; max-height: 260px; border-radius: 6px; }
.editor .e-images audio { width: 100%; }
.editor .e-images .imgdel {
  position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.55); color: #fff; border-radius: 50%;
  width: 26px; height: 26px; display: none; align-items: center; justify-content: center;
}
.editor .e-imgwrap { position: relative; }
.editor .e-imgwrap:hover .imgdel { display: inline-flex; }
.editor .e-labels { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 0; }
.editor .e-reminder { display: inline-flex; align-items: center; gap: 8px; margin: 12px 16px 0; background: var(--surface); border-radius: 6px; padding: 8px 12px; font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.2); color: var(--text); }
.editor .e-bottom { display: flex; align-items: center; padding: 6px 8px 10px; gap: 2px; flex-wrap: wrap; }
.editor .e-bottom .iconbtn svg { width: 21px; height: 21px; }
.editor .e-collab { padding: 4px 16px; color: var(--text-2); font-size: 13px; }
.editor .close-fab {
  position: absolute; top: 6px; right: 8px; z-index: 2;
}
.e-hint { padding: 0 16px 10px; color: var(--text-2); font-size: 12.5px; }
.e-readonly-bar { padding: 8px 16px; color: var(--text-2); font-weight: 700; }

/* ---------- snackbar ---------- */
#snackbar {
  position: fixed; left: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: #3c4043; color: #e8eaed; border-radius: 8px; padding: 14px 16px; display: flex; gap: 20px;
  align-items: center; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; min-width: 260px; max-width: 420px;
}
.toast button { color: #fdd663; font-weight: 700; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }

/* ---------- image viewer ---------- */
#viewer { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; }
#viewer img { max-width: 92vw; max-height: 92vh; }
#viewer .iconbtn { position: absolute; top: 12px; right: 12px; color: #fff; }

/* ---------- draw modal ---------- */
#draw { position: fixed; inset: 0; z-index: 85; background: var(--scrim); display: flex; align-items: center; justify-content: center; }
#draw .panel { background: var(--surface); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-lg); }
#draw .tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#draw .pen { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; }
#draw .pen.sel { border-color: var(--text); }
#draw canvas { border: 1px solid var(--border); border-radius: 6px; background: #fff; touch-action: none; cursor: crosshair; }

/* ---------- login ---------- */
body.auth { display: flex; align-items: center; justify-content: center; background: var(--bg-solid); min-height: 100vh; }
.auth-card { width: 408px; max-width: calc(100vw - 32px); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); padding: 48px 36px 36px; text-align: center; }
.auth-card .logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.auth-card .logo span { font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.auth-card .logo svg { width: 40px; height: 40px; }
.auth-card h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.auth-card p.sub { color: var(--text-2); margin: 0 0 24px; }
.auth-card .field { position: relative; margin-bottom: 16px; }
.auth-card input {
  width: 100%; height: 52px; border-radius: 8px; border: 1px solid var(--border); background: transparent;
  padding: 0 14px; font-size: 15px; outline: none;
}
.auth-card input:focus { border-color: var(--accent); border-width: 2px; padding: 0 13px; }
.auth-card .btn {
  width: 100%; height: 44px; border-radius: 22px; background: var(--accent); color: var(--accent-contrast);
  font-weight: 700; font-size: 15px; margin-top: 8px;
}
.auth-card .btn:hover { filter: brightness(1.06); box-shadow: var(--shadow); }
.auth-card .toggle { margin-top: 20px; color: var(--text-2); }
.auth-card .toggle b { color: var(--accent); cursor: pointer; }
.auth-card .err { color: #d93025; min-height: 18px; font-size: 13px; margin-top: 8px; }
html[data-theme="dark"] .auth-card .err { color: #f28b82; }
.auth-lang { position: fixed; top: 16px; right: 24px; color: var(--text-2); font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  #sidebar {
    position: fixed; left: 0; top: 0; background: var(--bg-solid); transform: translateX(-100%);
    transition: transform .2s; box-shadow: var(--shadow-lg);
  }
  #app.drawer-open #sidebar { transform: none; }
  #scrim2 { position: fixed; inset: 0; background: var(--scrim); z-index: 29; }
  #topbar { padding: 10px 12px; }
  #grid-wrap { padding: 4px 12px 60px; }
  #selbar { left: 12px; right: 12px; }
  .editor { margin-top: 0; }
}
@media (max-width: 640px) {
  #filterbar { padding: 0 12px 8px; }
  #search-wrap { height: 44px; }
}

/* e-posta doğrulama adımı */
.auth-card .code-input { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: 10px; }
.auth-card .info { color: var(--text-2); min-height: 18px; font-size: 13px; margin-top: 8px; }
.auth-card .verify-links { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.auth-card .linkbtn { background: none; border: none; border-radius: 12px; padding: 6px 10px; font: inherit; color: var(--accent); cursor: pointer; }
.auth-card .linkbtn:hover:not(:disabled) { background: var(--hover, rgba(127,127,127,.12)); }
.auth-card .linkbtn:disabled { color: var(--text-2); cursor: default; }
