*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: sans-serif;
  background: #fdf6ee;
  color: #333;
}

body {
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */

#sidebar {
  width: 300px;
  min-width: 300px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fdf6ee;
  border-right: 1px solid #e8ddd0;
  overflow: hidden;
  z-index: 10;
  transition: transform 0.28s ease;
}

#sidebar-header {
  padding: 0.85rem 1.2rem 0.7rem;
  border-bottom: 1px solid #e8ddd0;
}

#header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}


#sidebar-header h2 {
  font-size: 1.15rem;
}

/* ── Locations list ───────────────────────────────────────────────────────── */

#locations-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
}

#list-header {
  padding: 0.8rem 1.2rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  background: #fdf6ee;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#list-count { font-weight: 400; }

#list-toggle {
  display: none;
}

/* ── Search bar ───────────────────────────────────────────────────────────── */

#list-search-wrap {
  padding: 0.4rem 1.2rem 0.5rem;
}

#list-search {
  width: 100%;
  padding: 0.4rem 0.7rem;
  border: 1px solid #e0d4c8;
  border-radius: 6px;
  background: #fff;
  font-size: 0.82rem;
  color: #333;
  outline: none;
}
#list-search:focus { border-color: #c8a882; }
#list-search::placeholder { color: #ccc; }


.list-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1.2rem;
  border-bottom: 1px solid #f0e8df;
  transition: background 0.1s;
}
.list-item:hover { background: #faf2ea; }
.list-item.priority-item { background: #fffbea; }
.list-item.priority-item:hover { background: #fff6d6; }
.list-priority { font-size: 0.75rem; margin-right: 0.2rem; }

.list-dot {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

.list-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.list-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub { font-size: 0.74rem; color: #999; }

.del-btn {
  background: none;
  color: #ccc;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.del-btn:hover { background: #fde8e8; color: #c44; }

/* ── Map ──────────────────────────────────────────────────────────────────── */

#map { flex: 1; height: 100vh; }

/* ── Map pins ─────────────────────────────────────────────────────────────── */

.map-pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  font-size: 0.88rem;
}

/* ── Popups ───────────────────────────────────────────────────────────────── */

.popup { font-size: 0.84rem; line-height: 1.5; }
.popup-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.popup-meta { color: #555; }
.popup-city { color: #888; font-size: 0.8rem; }
.popup-notes { color: #555; margin-top: 0.3rem; font-style: italic; }
.popup-addr {
  color: #aaa;
  font-size: 0.75rem;
  margin-top: 0.3rem;
  border-top: 1px solid #eee;
  padding-top: 0.3rem;
}

/* ── Scrollbar ────────────────────────────────────────────────────────────── */

#locations-list::-webkit-scrollbar { width: 4px; }
#locations-list::-webkit-scrollbar-track { background: transparent; }
#locations-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ── Sidebar open button (mobile only) ────────────────────────────────────── */

#sidebar-open-btn {
  display: none;
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(85vw, 320px);
    min-width: unset;
    height: 100vh;
    z-index: 200;
    border-right: 1px solid #e8ddd0;
    overflow-x: hidden;
    overflow-y: auto;
  }

  /* hidden by default on mobile — user opens via button */
  #sidebar {
    transform: translateX(-100%);
  }

  #sidebar.sidebar-visible {
    transform: translateX(0);
  }

  #list-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: #bbb;
    line-height: 1;
    padding: 0.1rem 0.3rem;
  }
  #list-toggle:hover { color: #888; }

  #map { width: 100vw; height: 100vh; }

  #sidebar-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 100;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 8px;
    background: #fdf6ee;
    border: 1px solid #e8ddd0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
  }
}
