/* Reset / base ----------------------------------------------------------- */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body {
  background: #101820;
}

/* App layout ------------------------------------------------------------- */

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Map fills the whole viewport, panel/jungle frame overlay on top -------- */

#map {
  position: absolute;
  inset: 0;
}

/* Side panel ------------------------------------------------------------- */

.side-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 40%;
  max-width: 100%;
  background: #77846c;
  /* background: #eba0d2; */
  opacity: 76.9%;
  border-left: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
  z-index: 3000; /* above jungle frame and map */
}

.side-panel--hidden {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.side-panel__header {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

.side-panel__title {
  margin: 0;
  font-size: 1.2rem;
}

.side-panel__content {
  display: flex;
  flex-direction: column;
  padding: 8px 16px 16px;
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

.side-panel__section-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #777;
}

/* Timeline list ---------------------------------------------------------- */

.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 40%;
  overflow-y: auto;
  border-radius: 6px;
  border: 1px solid #eee;
}

.post-list-item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  background: #fff;
}

.post-list-item:last-child {
  border-bottom: none;
}

.post-list-item__title {
  font-size: 0.95rem;
  margin: 0 0 2px;
}

.post-list-item__date {
  font-size: 0.8rem;
  color: #060505;
  margin: 0;
}

.post-list-item--active {
  background: #f0f6ff;
}

/* Selected post view ----------------------------------------------------- */

.side-panel__post {
  flex: 1;
  overflow-y: auto;
  padding-top: 4px;
}

.post-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.post-date {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: #120f0f;
}

.post-text {
  white-space: pre-wrap;
  line-height: 1.4;
}

/* New-monkey form -------------------------------------------------------- */

.new-monkey-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.new-monkey-form label {
  display: block;
}

.new-monkey-form input,
.new-monkey-form textarea {
  width: 100%;
  padding: 4px 6px;
  margin-top: 2px;
  font: inherit;
}

.new-monkey-form__buttons {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.new-monkey-form button {
  padding: 6px 10px;
  font: inherit;
  cursor: pointer;
}

/* Jungle frame ----------------------------------------------------------- */

#jungle-frame {
  position: absolute;
  inset: 0;
  pointer-events: none; /* don't block map interactions */
  z-index: 2000; /* above map, below side panel */
}

#jungle-frame img {
  object-fit: cover;
}

.jungle-frame__top,
.jungle-frame__bottom {
  position: absolute;
  left: 0;
  width: 100%;
  display: block;
}

.jungle-frame__top {
  top: 0;
}

.jungle-frame__bottom {
  bottom: 0;
}

.jungle-frame__left,
.jungle-frame__right {
  position: absolute;
  top: 0;
  height: 100%;
  display: block;
}

.jungle-frame__left {
  left: 0;
}

.jungle-frame__right {
  right: 0;
}

/* Admin bar -------------------------------------------------------------- */

.admin-bar {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3500;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #f8f8f8;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.admin-bar button {
  padding: 4px 8px;
  font: inherit;
  border-radius: 999px;
  border: none;
  background: #ffc857;
  cursor: pointer;
}

.admin-bar button:hover {
  background: #ffb02a;
}

.admin-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-controls--hidden {
  display: none;
}

/* Toggle switch ---------------------------------------------------------- */

.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch__slider {
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  position: relative;
  transition: background 0.2s ease-out;
}

.toggle-switch__slider::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s ease-out;
}

.toggle-switch input:checked + .toggle-switch__slider {
  background: #ffc857;
}

.toggle-switch input:checked + .toggle-switch__slider::before {
  transform: translateX(16px);
}

.toggle-switch__label {
  font-size: 0.85rem;
}
