/* ==========================================================================
   Left Filters Sidebar (312px) & Right Detail Drawer (376px)
   ========================================================================== */

/* Left Sidebar */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-asphalt);
  border-right: 1px solid var(--border-tide);
  z-index: var(--z-sidebar);
  overflow: hidden;
  transition: width var(--dur-med) var(--ease-out), margin-left var(--dur-med) var(--ease-out);
}

#sidebar.collapsed {
  margin-left: calc(var(--sidebar-w) * -1);
}

.sidebar-top {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border-tide);
  background: rgba(11, 16, 24, 0.35);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box .search-ic {
  position: absolute;
  left: 10px;
  color: var(--ink-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 32px;
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ink-shell);
  transition: border-color var(--dur-fast);
}

.search-box input::placeholder {
  color: var(--ink-muted);
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-flamingo);
}

.search-clear-btn {
  position: absolute;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--ink-haze);
}

.search-clear-btn:hover {
  background: var(--surface-raised);
  color: var(--ink-shell);
}

/* Quick DB search hits inside sidebar */
#sidebar-db-hits {
  margin-top: 8px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
}

.db-hits-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
}

.db-hits-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.db-hit-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  background: var(--surface-raised);
  border: 1px solid var(--border-tide);
  color: var(--ink-shell);
}

.db-hit-chip:hover {
  border-color: var(--accent-lagoon);
  color: var(--accent-lagoon);
}

/* Quick Filter Toggles Row */
.quick-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-haze);
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
  white-space: nowrap;
  transition: all var(--dur-fast);
}

html[lang="en"] .quick-toggles .toggle-chip {
  font-size: 11.5px;
  padding: 0 6px;
  gap: 4px;
}

.toggle-chip:hover {
  color: var(--ink-shell);
  border-color: var(--border-strong);
}

.toggle-chip.active {
  background: var(--accent-flamingo-soft);
  border-color: var(--accent-flamingo-border);
  color: var(--accent-flamingo);
  font-weight: 600;
}

.toggle-chip.active-lagoon {
  background: var(--accent-lagoon-soft);
  border-color: var(--accent-lagoon-border);
  color: var(--accent-lagoon);
  font-weight: 600;
}

/* Sidebar Inner Tabs */
.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--border-tide);
  background: var(--bg-bay);
}

.sidebar-tab {
  position: relative;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-haze);
}

.sidebar-tab:hover {
  color: var(--ink-shell);
}

.sidebar-tab.active {
  color: var(--ink-shell);
  font-weight: 600;
}

.sidebar-tab.active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 0;
  height: 2px;
  background: var(--accent-flamingo);
}

.tab-count {
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--ink-haze);
  font-variant-numeric: tabular-nums;
}

.sidebar-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 12px 16px;
}

/* Categories Accordion Toolbar */
.cat-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.cat-toolbar .btn-sm {
  flex: 1;
}

.solo-hint {
  font-size: 11px;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

/* MapGenie-style Category Group Accordion */
.cat-group {
  border: 1px solid var(--border-tide);
  border-radius: var(--radius-md);
  background: rgba(11, 16, 24, 0.35);
  margin-bottom: 8px;
  overflow: hidden;
}

.cat-group.is-highlight {
  border-color: var(--accent-diff-border);
  background: rgba(245, 166, 91, 0.05);
}

.cat-group-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 10px;
  text-align: left;
  transition: background var(--dur-fast);
}

.cat-group-header:hover {
  background: rgba(255, 255, 255, 0.03);
}

.cat-group-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.cat-group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--ink-shell);
}

.cat-group.is-highlight .cat-group-title {
  color: var(--accent-diff);
}

.cat-group-stat {
  font-size: 11px;
  color: var(--ink-haze);
  font-variant-numeric: tabular-nums;
}

.cat-group-bar {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(238, 242, 247, 0.09);
  overflow: hidden;
}

.cat-group-bar > i {
  display: block;
  height: 100%;
  background: var(--accent-lagoon);
  border-radius: 999px;
  transition: width 260ms var(--ease-out);
}

.cat-group.is-highlight .cat-group-bar > i {
  background: var(--accent-diff);
}

.cat-group-body {
  border-top: 1px solid var(--border-subtle);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--ink-haze);
  transition: background var(--dur-fast), color var(--dur-fast), opacity var(--dur-fast);
  text-align: left;
}

.cat-row:hover {
  background: var(--surface-raised);
  color: var(--ink-shell);
}

.cat-row:not(.active) {
  opacity: 0.46;
}

.cat-row-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.05);
  color: var(--cat-color, var(--ink-shell));
  flex-shrink: 0;
}

.cat-row-icon svg {
  width: 13px;
  height: 13px;
}

.cat-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-shell);
  font-weight: 500;
}

.cat-row-count {
  font-size: 11px;
  color: var(--ink-haze);
  font-variant-numeric: tabular-nums;
}

.cat-row-check {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1.5px solid var(--border-strong);
  display: grid;
  place-items: center;
  color: transparent;
  flex-shrink: 0;
}

.cat-row.active .cat-row-check {
  background: var(--cat-color, var(--accent-flamingo));
  border-color: var(--cat-color, var(--accent-flamingo));
  color: var(--bg-bay);
}

.cat-row-check svg {
  width: 11px;
  height: 11px;
}

/* Places List Panel */
.places-filter-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.places-filter-bar select {
  flex: 1;
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
}

.places-count-tag {
  font-size: 11.5px;
  color: var(--ink-haze);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.place-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-align: left;
  margin-bottom: 4px;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}

.place-row:hover {
  background: var(--surface-raised);
}

.place-row.selected {
  background: var(--accent-flamingo-soft);
  border-color: var(--accent-flamingo-border);
}

.place-row-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.place-row-copy strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-shell);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-row-copy small {
  font-size: 11px;
  color: var(--ink-haze);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.place-row-flags {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.flag-done {
  color: var(--accent-success);
}

.flag-saved {
  color: var(--accent-diff);
}

.empty-box {
  padding: 28px 14px;
  text-align: center;
  color: var(--ink-haze);
  border: 1px dashed var(--border-tide);
  border-radius: var(--radius-md);
}

.empty-box strong {
  display: block;
  margin: 8px 0 4px;
  color: var(--ink-shell);
}

.empty-box p {
  margin: 0 0 12px;
  font-size: 12px;
}

/* Route Panel (Inside Sidebar Tab) */
.route-summary-card {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
  margin-bottom: 10px;
}

.route-summary-nums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.route-summary-nums strong {
  font-size: 15px;
  color: var(--accent-lagoon);
}

.route-toolbar {
  display: flex;
  gap: 6px;
}

.route-toolbar .btn-sm {
  flex: 1;
}

.route-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
  margin-bottom: 5px;
}

.route-idx {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-lagoon-soft);
  color: var(--accent-lagoon);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.route-item-name {
  flex: 1;
  min-width: 0;
  text-align: left;
  font-size: 12.5px;
  color: var(--ink-shell);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-item-name:hover {
  color: var(--accent-lagoon);
}

.route-item-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.route-item-actions button {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  color: var(--ink-haze);
}

.route-item-actions button:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--ink-shell);
}

/* ==========================================================================
   Right Detail Drawer (#detail-sheet)
   ========================================================================== */

#detail-sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--detail-w);
  background: var(--surface-glass-heavy);
  border-left: 1px solid var(--border-tide);
  backdrop-filter: blur(16px);
  z-index: var(--z-detail);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(4, 8, 14, 0.55);
  overflow: hidden;
}

.sheet-drag-handle {
  display: none;
}

.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.detail-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg-abyss);
  overflow: hidden;
  border-bottom: 1px solid var(--border-tide);
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-hero-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 12px 7px;
  background: linear-gradient(transparent, rgba(7, 11, 17, 0.88));
  font-size: 11px;
  color: var(--ink-haze);
}

.detail-head {
  position: relative;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-tide);
}

.detail-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}

.detail-kicker-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
  padding-right: 34px;
}

.detail-cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--cat-color, var(--ink-shell));
}

.detail-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink-shell);
}

.detail-orig {
  margin-top: 3px;
  font-size: 12px;
  color: var(--ink-haze);
}

.detail-body {
  padding: 14px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-meta-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-haze);
}

.detail-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink-shell);
}

.detail-tip-box {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-lagoon-soft);
  border: 1px solid var(--accent-lagoon-border);
  font-size: 12.5px;
  color: var(--ink-shell);
}

/* Mapping Diff Block (Pre-release vs Launch) */
.detail-diff-card {
  border-radius: var(--radius-md);
  background: rgba(245, 166, 91, 0.08);
  border: 1px solid var(--accent-diff-border);
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-diff-card h4 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-diff);
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-col {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-shell);
}

.diff-col b {
  display: block;
  font-size: 11px;
  color: var(--ink-haze);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

/* Action Grid inside Detail Sheet */
.detail-primary-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.detail-secondary-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.btn-found-done {
  background: rgba(52, 211, 153, 0.16);
  border-color: rgba(52, 211, 153, 0.45);
  color: var(--accent-success);
  font-weight: 600;
}

.btn-saved-active {
  background: var(--accent-diff-soft);
  border-color: var(--accent-diff-border);
  color: var(--accent-diff);
}

/* Personal Notes */
.detail-notes-box {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.detail-notes-box label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-haze);
}

.detail-notes-box textarea {
  width: 100%;
  min-height: 68px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
  color: var(--ink-shell);
  font-size: 12.5px;
  resize: vertical;
}

.detail-notes-box textarea:focus {
  outline: none;
  border-color: var(--accent-lagoon);
}

/* Linked Database Entries inside Detail Sheet */
.detail-linked-section h4 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-haze);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.linked-db-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.linked-db-card {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border-tide);
  text-align: left;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.linked-db-card:hover {
  border-color: var(--accent-lagoon);
  background: var(--surface-hover);
}

.linked-db-copy {
  min-width: 0;
}

.linked-db-copy strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink-shell);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linked-db-copy small {
  font-size: 11px;
  color: var(--ink-haze);
}

.detail-footer-meta {
  padding-top: 10px;
  border-top: 1px solid var(--border-tide);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-muted);
}

/* Sticky Primary Action Bar at Bottom of Detail Drawer */
.detail-sticky-bar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 7px;
  padding: 10px 14px;
  background: rgba(11, 16, 24, 0.96);
  border-top: 1px solid var(--border-strong);
  backdrop-filter: blur(12px);
}

.detail-sticky-bar .btn {
  height: 36px;
}

/* External Launch Basemap Verification Box inside Detail Drawer */
.detail-ext-verify {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-bay);
  border: 1px solid var(--border-tide);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-ext-verify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-haze);
}

.detail-ext-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.detail-ext-links a,
.detail-ext-links button {
  font-size: 11.5px;
}
