/* ─────────────────────────────────────────────────────────────────────────
   kokoroad — map-controls.css   ·   ATLAS direction

   Loaded after the structural base and panel files. Same class names as the
   existing app — no new naming system.

   Atlas = warm paper canvas, calm cartographic feel, teal-green accent
   (replaces the existing #2266cc brand blue), earthy field-guide category
   palette, Geist Sans + Geist Mono. Also owns the place panel glyph, hero
   image, and sticky save-bar refinements that used to live in a separate
   place-panel extras layer.
   ───────────────────────────────────────────────────────────────────────── */

/* ── 2. Base ───────────────────────────────────────────────────────────── */

body {
  font-family: var(--edt-font-sans);
  font-feature-settings: var(--edt-font-features);
  letter-spacing: var(--edt-tracking-snug);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  color: var(--edt-fg);
}

/* ── 3. Side panel ─────────────────────────────────────────────────────── */

#sidePanel {
  background: var(--edt-bg);
  color: var(--edt-fg);
  border-right: 1px solid var(--edt-line);
  box-shadow: var(--edt-shadow-panel);
  font-family: var(--edt-font-sans);
  --side-panel-width: var(--edt-panel-w-expanded);
  --side-panel-bulk-width: min(1420px, calc(100vw - 24px));
}
#sidePanel.bulk-editing {
  width: var(--side-panel-bulk-width);
}
#sidePanel header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--edt-line);
}
#sidePanel .panel-title {
  font-size: 0.98em;
  letter-spacing: -0.01em;
}
#sidePanel .panel-title .panel-wordmark {
  display: flex;
  align-items: center;
  gap: 8px;
}
#sidePanel .panel-title .panel-wordmark-mark {
  width: 23px;
  height: 23px;
  flex: none;
}
#sidePanel .panel-title .panel-wordmark-text {
  font-weight: 800;
  letter-spacing: -0.01em;
}
#sidePanel .panel-close,
#sidePanel .panel-back,
#sidePanel .panel-settings,
#sidePanel .panel-add-guide {
  color: var(--edt-fg-muted);
  border-radius: var(--edt-r-sm);
  transition: color var(--edt-dur-1), background var(--edt-dur-1);
}
#sidePanel .panel-close:hover,
#sidePanel .panel-back:hover,
#sidePanel .panel-settings:hover,
#sidePanel .panel-add-guide:hover {
  color: var(--edt-fg);
  background: var(--edt-bg-hover);
}

/* Guide-account pill — slightly wider than the icon-only buttons; sits between
   the title and the settings gear. */
#sidePanel .panel-add-guide {
  background: none;
  border: 1px solid var(--edt-line-strong);
  cursor: pointer;
  font: inherit;
  font-size: 0.78em;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  margin-right: 4px;
}
/* Trip mode hides the account pill for signed-in editors (they chose trip
   mode, edit mode is one click away via the switcher). Anonymous visitors
   keep it visible as the "Log in" entry point, and signed-in readers keep it
   visible too — trip mode is permanent for them, so the pill is their only
   way to reach the account menu / log out (data-guide set at SPA boot). */
html[data-context="trip"][data-guide="member"] #sidePanel .panel-add-guide { display: none; }
html[data-context="trip"] .kokoroad-map-control-topright {
  right: min(396px, calc(100vw - 18px));
}

#sidePanel .guide-picker-summary {
  border-color: var(--edt-line);
  color: var(--edt-fg);
}
#sidePanel .guide-picker-summary span { color: var(--edt-fg-muted); }

/* Settings gear sits left of the close button, icon-only. */
#sidePanel .panel-settings {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.05em;
  line-height: 1;
  padding: 2px 6px;
}

/* ── Settings modal ────────────────────────────────────────────────────── */
.settings-modal {
  position: fixed;
  inset: 0;
  z-index: var(--edt-z-modal);
  display: none;
  align-items: center;
  justify-content: center;
}
.settings-modal.open { display: flex; }
.settings-modal .settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.settings-modal .settings-modal-card {
  position: relative;
  width: min(340px, calc(100vw - 32px));
  background: var(--edt-bg);
  color: var(--edt-fg);
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-md);
  box-shadow: var(--edt-shadow-panel);
  font-family: var(--edt-font-sans);
}
.settings-modal .settings-modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--edt-line);
}
.settings-modal .settings-modal-title {
  font-weight: 600;
  font-size: 0.98em;
  letter-spacing: -0.01em;
}
.settings-modal .settings-modal-close {
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 1.4em;
  line-height: 1;
  color: var(--edt-fg-muted);
  border-radius: var(--edt-r-sm);
  padding: 0 6px;
  transition: color var(--edt-dur-1), background var(--edt-dur-1);
}
.settings-modal .settings-modal-close:hover {
  color: var(--edt-fg);
  background: var(--edt-bg-hover);
}
.settings-modal .settings-modal-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-modal .settings-row { justify-content: space-between; }
.settings-modal .settings-row .seg-label {
  color: var(--edt-fg);
  font-size: 0.85em;
}
/* The "Map labels" language picker is a native <select> dropped into the
   segmented pill container; blend it so it reads as part of the row rather
   than a doubled-up control. */
.settings-modal .settings-select {
  border: none;
  background: transparent;
  color: var(--edt-fg);
  font: inherit;
  font-size: 0.9em;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.settings-modal .settings-language-hint { text-align: right; }
.settings-modal .settings-section {
  border-top: 1px solid var(--edt-line);
  padding-top: 14px;
}
.settings-modal .settings-section h3 {
  margin: 0 0 8px;
  color: var(--edt-fg);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0;
}
.settings-modal .settings-action {
  background: none;
  border: 1px solid var(--edt-line-strong);
  border-radius: var(--edt-r-sm);
  color: var(--edt-fg);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 6px 6px 0;
  padding: 6px 12px;
  text-decoration: none;
  transition: color var(--edt-dur-1), background var(--edt-dur-1), border-color var(--edt-dur-1);
}
.settings-modal .settings-action:hover {
  background: var(--edt-bg-hover);
  border-color: var(--edt-accent);
}
.settings-modal .settings-hint {
  margin: 6px 0 0;
  font-size: 0.74em;
  color: var(--edt-fg-muted);
  line-height: 1.4;
}
.settings-modal .settings-nichinote {
  border-top: 1px solid var(--edt-line);
  margin-top: 12px;
  padding-top: 12px;
}
.settings-modal .settings-nichinote-hint { margin-top: 0; }
.settings-modal .settings-nichinote-status {
  color: var(--edt-fg-muted);
  font-size: 0.78em;
  line-height: 1.4;
  margin: 8px 0;
  min-height: 1.4em;
}
.settings-modal .settings-nichinote-status.is-success { color: var(--edt-success); }
.settings-modal .settings-nichinote-status.is-failure { color: var(--edt-danger); }
.settings-modal .settings-nichinote-capture:disabled {
  cursor: wait;
  opacity: 0.7;
}

#sidePanel .panel-handle {
  background: var(--edt-bg);
  border-color: var(--edt-line);
  color: var(--edt-fg-muted);
  border-radius: 0 var(--edt-r-md) var(--edt-r-md) 0;
}
#sidePanel .panel-handle:hover {
  background: var(--edt-bg-hover);
  color: var(--edt-fg);
}
#sidePanel.open .panel-resize-handle:hover::before,
#sidePanel.open .panel-resize-handle:focus-visible::before,
#sidePanel.resizing .panel-resize-handle::before {
  background: var(--edt-accent);
}
html[data-context="trip"] #sidePanel .panel-resize-handle { display: none; }

#tripDrawer {
  position: fixed;
  z-index: var(--edt-z-drawer);
  top: 18px;
  right: 18px;
  width: min(var(--edt-panel-w-expanded), calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  background: var(--edt-bg);
  color: var(--edt-fg);
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-md);
  box-shadow: var(--edt-shadow-panel);
  opacity: 0;
  pointer-events: none;
  transform: translateX(18px);
  transition: transform var(--edt-dur-2);
}
#tripDrawer.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

/* Favorites is a separate personal drawer but shares the trip drawer's map-
   edge geometry and visual language. */
#favoritesDrawer {
  position: fixed;
  z-index: var(--edt-z-drawer);
  top: 16px;
  right: 16px;
  bottom: 16px;
  width: min(390px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 32px));
  transition: transform var(--edt-dur-2) var(--edt-ease-out);
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-lg);
  background: var(--edt-bg);
  box-shadow: var(--edt-shadow-panel);
  overflow: hidden;
}
#favoritesDrawer.open { transform: translateX(0); }
#favoritesDrawer header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--edt-line);
}
#favoritesDrawer h2 { margin: 0; font-size: 1.05rem; }
.favorites-drawer-count { color: var(--edt-fg-muted); font-size: 0.82rem; }
.favorites-drawer-body { flex: 1; overflow-y: auto; padding: 12px; }
.favorites-drawer-close,
.favorites-open-trip-header,
.trip-open-favorites {
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-sm);
  background: transparent;
  color: var(--edt-fg);
  cursor: pointer;
  padding: 6px 9px;
}
.favorites-open-trip-header { margin-left: auto; }
.favorites-drawer-close { font-size: 1.05rem; }
.favorite-place-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 9px;
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-sm);
  background: var(--edt-bg-elev-1);
}
.favorite-place-main { min-width: 0; }
.favorite-place-open,
.favorite-event-open {
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--edt-fg);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.favorite-place-meta { color: var(--edt-fg-muted); font-size: 0.8rem; }
.favorite-place-remove,
.favorite-event-remove { border: 0; background: transparent; color: var(--edt-fg-muted); cursor: pointer; font-size: 1.05rem; }
.favorite-trip-action,
.favorites-open-trip,
.favorites-clear,
.favorite-place-action,
.favorite-event-action {
  border: 1px solid var(--edt-accent);
  border-radius: var(--edt-r-sm);
  background: transparent;
  color: var(--edt-accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 9px;
}
.favorite-place-action.is-favorite,
.favorite-event-action.is-favorite { background: var(--edt-accent); color: white; }
.favorites-section-title {
  margin: 0 0 8px;
  color: var(--edt-fg-muted);
  font-size: 0.82rem;
  font-weight: 650;
}
.favorites-section + .favorites-section { margin-top: 16px; }
.favorite-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 9px;
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-sm);
  background: var(--edt-bg-elev-1);
}
.favorites-drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.favorites-empty { margin: 28px 0 16px; color: var(--edt-fg-muted); text-align: center; }
.place-personal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.place-row > .favorite-place-action:not(.favorite-heart-btn) { align-self: center; margin-left: 8px; }

/* Browse-row favorite heart: overrides the bordered pill-button look shared
   with the favorites drawer/trip actions above — a plain glyph overlaid
   right-center, per the browse-row (not entity-view) affordance. */
.place-row .favorite-heart-btn,
.event-row .favorite-heart-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--edt-r-sm);
  background: none;
  color: var(--edt-fg-faint);
  font-size: 1.05em;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color var(--edt-dur-1);
  z-index: 2;
}
.place-row .favorite-heart-btn:hover,
.event-row .favorite-heart-btn:hover {
  color: var(--edt-fg-muted);
}
.place-row .favorite-heart-btn.is-favorite,
.event-row .favorite-heart-btn.is-favorite {
  background: none;
  color: var(--edt-accent);
}
.place-row .favorite-heart-btn.is-favorite:hover,
.event-row .favorite-heart-btn.is-favorite:hover {
  color: var(--edt-accent-hover);
}

@media (max-width: 699px) {
  #favoritesDrawer { inset: 8px; width: auto; }
  .favorite-place-row { grid-template-columns: minmax(0, 1fr) 28px; }
  .favorite-trip-action { grid-column: 1 / -1; grid-row: 2; }
}
#tripDrawer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--edt-line);
}
#tripDrawer h2 {
  margin: 0;
  font-size: 1em;
  font-weight: 700;
}
.trip-drawer-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.trip-drawer-heading h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trip-rename-btn {
  border: 0;
  background: transparent;
  color: var(--edt-fg-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85em;
  line-height: 1;
  padding: 3px 5px;
  border-radius: var(--edt-r-sm);
}
.trip-rename-btn:hover {
  color: var(--edt-fg);
  background: var(--edt-bg-hover);
}
.trip-name-input {
  font: inherit;
  font-size: 1em;
  font-weight: 700;
  color: var(--edt-fg);
  background: var(--edt-bg);
  border: 1px solid var(--edt-line-strong);
  border-radius: var(--edt-r-sm);
  padding: 2px 6px;
  min-width: 0;
  width: 100%;
}
.trip-drawer-count {
  display: block;
  margin-top: 2px;
  color: var(--edt-fg-muted);
  font-size: 0.82em;
}
.trip-drawer-close {
  border: 0;
  background: transparent;
  color: var(--edt-fg-muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.25em;
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--edt-r-sm);
}
.trip-drawer-close:hover {
  color: var(--edt-fg);
  background: var(--edt-bg-hover);
}
.trip-drawer-body {
  overflow-y: auto;
  padding: 10px;
}
.trip-empty {
  color: var(--edt-fg-muted);
  font-size: 0.9em;
  line-height: 1.4;
  padding: 10px 4px;
}
.trip-planning-controls {
  margin-bottom: 10px;
}
.trip-day-count-field {
  display: grid;
  grid-template-columns: auto minmax(80px, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--edt-fg-muted);
  font-size: 0.82em;
  font-weight: 700;
}
.trip-day-count-input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-sm);
  background: var(--edt-bg-elev-1);
  color: var(--edt-fg);
  font: inherit;
  padding: 7px 9px;
}
.trip-day-count-input::placeholder {
  color: var(--edt-fg-muted);
  opacity: 1;
}
.trip-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trip-day {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trip-day-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
}
.trip-day-heading {
  min-width: 0;
}
.trip-day-header h3 {
  margin: 0;
  color: var(--edt-fg);
  font-size: 0.82em;
  font-weight: 750;
}
.trip-day-time {
  color: var(--edt-fg-muted);
  font-size: 0.78em;
  font-weight: 650;
  white-space: nowrap;
}
.trip-day-exports {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 4px;
}
.trip-export-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--edt-line-strong);
  border-radius: var(--edt-r-sm);
  background: var(--edt-bg-elev-1);
  color: var(--edt-fg-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.85em;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.trip-export-btn:hover {
  filter: brightness(1.05);
}
.trip-export-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  filter: none;
}
.trip-export-btn-google {
  background: #ffffff;
  border-color: #d2d4d7;
  color: #4285F4;
}
.trip-export-btn-kakao {
  background: #FEE500;
  border-color: #E5CE00;
  color: #1A1A1A;
}
.trip-export-btn-naver {
  background: #03C75A;
  border-color: #02A94D;
  color: #ffffff;
}
.trip-export-btn-apple {
  background: #ffffff;
  border-color: #111827;
  color: #111827;
}
.trip-day-places {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.trip-place-row,
.trip-lodging-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--edt-line);
  border-radius: var(--edt-r-sm);
  background: var(--edt-bg-elev-1);
}
.trip-lodging-row {
  border-color: color-mix(in oklab, var(--edt-accent) 34%, var(--edt-line));
  background: color-mix(in oklab, var(--edt-accent) 9%, var(--edt-bg-elev-1));
}
.trip-lodging-row .trip-place-index {
  color: var(--edt-accent);
  font-size: 0.74em;
  text-transform: uppercase;
}
.trip-place-index {
  color: var(--edt-fg-muted);
  font-size: 0.82em;
  font-weight: 700;
  text-align: center;
}
.trip-place-main { min-width: 0; }
.trip-place-open {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--edt-fg);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.trip-place-open:hover { color: var(--edt-accent); }
.trip-place-meta {
  margin-top: 2px;
  color: var(--edt-fg-muted);
  font-size: 0.8em;
}
.trip-place-remove {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--edt-r-sm);
  background: transparent;
  color: var(--edt-fg-muted);
  cursor: pointer;
  font: inherit;
  font-size: 1.05em;
  line-height: 1;
}
.trip-place-remove:hover {
  color: var(--edt-danger);
  background: var(--edt-bg-hover);
}
.trip-drawer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.trip-clear-btn,
.trip-optimize-btn,
.trip-print-btn,
.trip-share-btn,
.trip-place-action {
  border: 1px solid var(--edt-accent);
  border-radius: var(--edt-r-sm);
  background: var(--edt-accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-size: 0.85em;
  font-weight: 700;
  padding: 7px 10px;
  white-space: nowrap;
}
.trip-place-action.in-trip {
  background: transparent;
  color: var(--edt-accent);
}
.trip-clear-btn {
  width: 100%;
  background: transparent;
  color: var(--edt-fg-muted);
  border-color: var(--edt-line-strong);
  grid-column: 1 / -1;
}
.trip-optimize-btn {
  width: 100%;
}
.trip-print-btn {
  width: 100%;
  background: transparent;
  color: var(--edt-accent);
}
.trip-share-btn {
  width: 100%;
  background: transparent;
  color: var(--edt-accent);
  grid-column: 1 / -1;
}
.trip-clear-btn:hover,
.trip-optimize-btn:hover,
.trip-print-btn:hover,
.trip-share-btn:hover,
.trip-place-action:hover {
  filter: brightness(0.96);
}
.trip-share-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.trip-share-url {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.78em;
  color: var(--edt-fg-muted);
  background: var(--edt-bg);
  border: 1px solid var(--edt-line-strong);
  border-radius: var(--edt-r-sm);
  padding: 6px 8px;
}
.trip-share-copy {
  border: 1px solid var(--edt-line-strong);
  border-radius: var(--edt-r-sm);
  background: transparent;
  color: var(--edt-fg);
  cursor: pointer;
  font: inherit;
  font-size: 0.82em;
  font-weight: 600;
  padding: 6px 10px;
  white-space: nowrap;
}
.trip-share-copy:hover {
  background: var(--edt-bg-hover);
}
