/**
 * Styling untuk note-finder.html.
 *
 * Sengaja DIBUAT BEDA dari pitch-finder.css: pitch-finder adalah alat
 * internal (dev-only, kotak gelap datar/flat), sedangkan note-finder
 * ini akan dilihat & dipakai langsung oleh pengunjung publik tur.
 * Jadi tampilannya memakai bahasa desain situs utama (glass panel,
 * blur, aksen magenta, font brand) supaya terasa seperti bagian dari
 * situs — bukan alat developer — lihat variabel warna & font di
 * css/style.css.
 */

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--ink);
  overflow: hidden;
  font-family: var(--font-ui);
  color: var(--paper);
}

#note-app {
  position: relative;
  width: 100vw;
  height: 100dvh;
}

#panorama {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}
#panorama.mode-point { cursor: crosshair; }
#panorama.mode-rotate { cursor: grab; }
#panorama.mode-rotate:active { cursor: grabbing; }

/* ---------- Back button (top-left, floating — matches .control-btn on index.html) ---------- */

.note-back-btn {
  position: absolute;
  top: 22px;
  left: 24px;
  z-index: 20;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--panel-border);
  background: var(--panel);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  color: var(--paper);
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.note-back-btn svg { width: 18px; height: 18px; }
.note-back-btn:hover { border-color: var(--accent-soft); background: var(--panel-strong); }
.note-back-btn:active { transform: scale(0.94); }

/* Floating 💬 icon following the point just clicked, before it's saved */
#pending-marker {
  position: absolute;
  z-index: 5;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 6px var(--accent-dim);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#pending-marker svg { width: 15px; height: 15px; }

/* ---------- Sidebar: floating glass card, not a flat full-height box ---------- */

#sidebar {
  position: absolute;
  top: 22px;
  right: 24px;
  bottom: 22px;
  z-index: 15;
  width: 360px;
  max-width: calc(100vw - 48px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow-y: auto;
  border-radius: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.45), 0 0 0 1px var(--accent-dim);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
}

.finder-intro { display: flex; flex-direction: column; gap: 6px; }
.finder-eyebrow {
  margin: 0;
  font-family: var(--font-brand);
  font-weight: 500;
  font-size: 20px;
  color: var(--paper);
}
.finder-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--paper-dim);
}
.finder-hint b { color: var(--paper); font-weight: 600; }

.finder-field { display: flex; flex-direction: column; gap: 7px; }
.finder-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

/* ---------- Mode toggle: pill segmented control ---------- */

.mode-toggle {
  display: flex;
  gap: 4px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--panel-border);
}
.mode-btn {
  flex: 1 1 0;
  padding: 8px 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--paper-dim);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.mode-btn:hover { color: var(--paper); }
.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

.finder-select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.22);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 13px;
  padding: 9px 10px;
}

/* ---------- Note panel (new / editing) ---------- */

.note-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-soft);
}

.note-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.note-panel-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}
.note-panel-coord {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-dim);
}

.note-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.28);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  padding: 10px;
}
.note-textarea:focus, .finder-select:focus {
  outline: none;
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.note-image-label {
  font-size: 11.5px;
  color: var(--paper-dim);
}

#note-image {
  width: 100%;
  font-size: 12px;
  color: var(--paper-dim);
}

#note-image-preview {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
}
#note-image-preview img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
}
#note-image-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: var(--paper);
  cursor: pointer;
  font-size: 12px;
}

.note-error {
  margin: 0;
  font-size: 12px;
  color: #f0b3a3;
}

.note-form-actions {
  display: flex;
  gap: 8px;
}
.note-cancel-btn,
.note-commit-btn {
  flex: 1 1 0;
  border: none;
  border-radius: 999px;
  padding: 10px 0;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease;
}
.note-cancel-btn {
  background: rgba(242, 237, 230, 0.1);
  color: var(--paper);
}
.note-cancel-btn:hover { background: rgba(242, 237, 230, 0.16); }
.note-commit-btn {
  background: var(--accent);
  color: #fff;
}
.note-commit-btn:hover { opacity: 0.9; }
.note-commit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Notes added this session ---------- */

.point-list-header p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

#note-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.note-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px;
  border-radius: 10px;
  background: rgba(242, 237, 230, 0.05);
  border: 1px solid rgba(242, 237, 230, 0.08);
  font-size: 12px;
}
.note-row img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
  flex: 0 0 auto;
}
.note-row-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--paper-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.point-empty {
  margin: 0;
  font-size: 12px;
  color: var(--paper-dim);
}

.pnlm-load-box, .pnlm-about-msg { display: none !important; }

/* ---------- Sidebar handle (drag/tap bar) — mobile only, hidden on desktop ---------- */

#sidebar-handle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: var(--paper-dim);
  padding: 2px 0 4px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-handle-bar {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--panel-border);
}
.sidebar-handle-chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.22s ease;
}
#sidebar.expanded .sidebar-handle-chevron { transform: rotate(180deg); }

/* ---------- Mobile: sidebar becomes a collapsible bottom sheet ----------
 * Peek (default): only the handle + mode toggle + 360° image picker show,
 * capped low so the panorama keeps most of the screen. Tapping the handle,
 * or opening the note form, expands the sheet (scrollable) so the
 * form/notes list is fully usable — toggled via the "expanded" class from
 * js/note-finder.js, not just CSS. Everything here is scoped to this media
 * query only — desktop layout is untouched. */
@media (max-width: 720px) {
  .note-back-btn {
    top: 14px;
    left: 14px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .note-back-btn svg { width: 15px; height: 15px; }

  #sidebar {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    padding: 8px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    gap: 6px;
    max-height: none;
    box-shadow: 0 -12px 40px rgba(0,0,0,0.45);
  }

  /* Hard cap on the peek height — guarantees the panorama keeps well over
     half the screen even if content ever runs long. */
  #sidebar:not(.expanded) { max-height: 26vh; overflow: hidden; }

  #sidebar-handle { display: flex; position: relative; padding: 0 0 2px; }
  .sidebar-handle-bar { top: 4px; width: 30px; height: 3px; }
  .sidebar-handle-label { font-size: 9px; }
  .sidebar-handle-chevron { width: 12px; height: 12px; }

  /* Guide text is dropped entirely on mobile — the mode buttons and
     placeholder text are self-explanatory, so it's not worth the space. */
  .finder-hint { display: none; }
  .finder-eyebrow { font-size: 15px; }
  .finder-intro { gap: 2px; }

  .finder-field { gap: 4px; }
  .finder-label { font-size: 9px; }

  .mode-toggle { padding: 2px; }
  .mode-btn { padding: 6px 0; font-size: 11px; }

  .finder-select { padding: 6px 8px; font-size: 12px; }

  .note-panel { padding: 10px; gap: 7px; border-radius: 12px; }
  .note-panel-badge { font-size: 9px; padding: 3px 7px; }
  .note-panel-coord { font-size: 10px; }
  .note-textarea { font-size: 12.5px; padding: 8px; }
  .note-image-label { font-size: 10.5px; }
  #note-image { font-size: 11px; }
  .note-cancel-btn, .note-commit-btn { padding: 8px 0; font-size: 11.5px; }

  .point-list-header p { font-size: 9px; }
  .note-row { padding: 7px; font-size: 11px; }
  .note-row img { width: 28px; height: 28px; }
  .point-empty { font-size: 11px; }

  /* Peek state: hide everything except the handle, mode toggle and the
     360° image picker, so the sheet only takes the space it needs. */
  #sidebar:not(.expanded) .finder-intro,
  #sidebar:not(.expanded) .point-list-header,
  #sidebar:not(.expanded) #note-list,
  #sidebar:not(.expanded) .point-empty { display: none; }

  /* Expanded state: full sheet, scrollable, room for the note form/list. */
  #sidebar.expanded {
    max-height: 82dvh;
    overflow-y: auto;
  }
}
