* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1d2521;
}
header {
  background: #2b4d3e;
  color: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { margin: 0; font-size: 1.3rem; }
.admin-link {
  color: #cfe8d8;
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid #cfe8d8;
  padding: 4px 10px;
  border-radius: 6px;
}
.admin-link:hover { background: rgba(255,255,255,0.1); }

.layout {
  display: flex;
  height: calc(100vh - 53px);
}
#sidebar {
  width: 280px;
  padding: 16px;
  overflow-y: auto;
  background: #f4f7f5;
  border-right: 1px solid #dde5e0;
  flex-shrink: 0;
}
#sidebar h2 { font-size: 1rem; margin-top: 0; color: #2b4d3e; }
main { flex: 1; position: relative; }
#map { width: 100%; height: 100%; }

.hike-item {
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: white;
  border: 1px solid #e2e8e4;
  cursor: pointer;
}
.hike-item:hover { border-color: #2b4d3e; }
.hike-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.92rem;
}
.hike-color-dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.hike-meta { font-size: 0.75rem; color: #6b7a70; margin: 2px 0 0 26px; }

.popup-photo img {
  max-width: 220px;
  max-height: 220px;
  display: block;
  border-radius: 6px;
  margin-bottom: 6px;
}
.popup-photo .caption { font-size: 0.85rem; color: #333; }

.hike-item .hike-name-link {
  cursor: pointer;
}
.hike-item .hike-name-link:hover { text-decoration: underline; }

/* --- Panneau de détails --- */
.detail-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 380px;
  max-width: calc(100vw - 24px);
  background: white;
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  overflow-y: auto;
  transform: translateX(420px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  z-index: 1000;
  padding: 18px;
}
.detail-panel.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;

  width: 28px;
  height: 28px;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 0;
  border: none;
  border-radius: 50%;

  background: #f0f2f0;
  color: #333;
  cursor: pointer;

  font-size: 16px;
  line-height: 1;
}

.close-btn:hover { background: #e2e8e4; }

.detail-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2b4d3e;
  margin: 0 30px 2px 0;
}
.detail-date { font-size: 0.85rem; color: #6b7a70; margin-bottom: 4px; }
.detail-desc { font-size: 0.88rem; color: #333; margin: 8px 0 14px; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-bottom: 18px;
}
.stat-box {
  background: #f4f7f5;
  border-radius: 8px;
  padding: 8px 10px;
}
.stat-box .stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #2b4d3e;
}
.stat-box .stat-label {
  font-size: 0.72rem;
  color: #6b7a70;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.profile-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2b4d3e;
  margin: 0 0 8px;
}
.profile-chart-wrap {
  position: relative;
  height: 180px;
  margin-bottom: 10px;
}
.detail-loading, .detail-error {
  font-size: 0.9rem;
  color: #6b7a70;
  padding: 20px 0;
}
.detail-error { color: #b3402f; }

/* --- Admin --- */
.admin-wrap {
  max-width: 720px;
  margin: 20px auto;
  padding: 0 16px 60px;
}
.card {
  background: white;
  border: 1px solid #e2e8e4;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 1.1rem; color: #2b4d3e; }
label.field { display: block; margin-bottom: 12px; font-size: 0.9rem; }
label.field span { display: block; margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=date], textarea, select {
  width: 100%; padding: 8px; border: 1px solid #cbd5cf; border-radius: 6px; font-size: 0.9rem;
}
button {
  background: #2b4d3e; color: white; border: none; padding: 9px 16px;
  border-radius: 6px; cursor: pointer; font-size: 0.9rem;
}
button:hover { background: #234034; }
button.secondary { background: #6b7a70; }
button.danger { background: #b3402f; }
.msg { font-size: 0.85rem; margin-top: 8px; }
.msg.ok { color: #2b4d3e; }
.msg.err { color: #b3402f; }

.unplaced-photo {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border: 1px solid #e2e8e4; border-radius: 8px; margin-bottom: 8px;
}
.unplaced-photo img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; }
.unplaced-photo .info { flex: 1; font-size: 0.85rem; }
#place-map { height: 380px; border-radius: 8px; margin-top: 10px; display: none; }
