/* mapPlanner UI. Clean, large, high-contrast controls for non-technical users.
   All visible text lives in the Blade/JS layer (Dutch); this is layout only. */

:root {
  --mp-primary: #1d6f42;
  --mp-primary-dark: #14512f;
  --mp-border: #d7dbe0;
  --mp-panel-bg: #ffffff;
  --mp-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* The map pages don't load Bootstrap, so we need our own box-sizing reset:
   without it, padding/borders add to widths and the right panel overflows
   horizontally by a few pixels (the "tiny useless horizontal scrollbar"). */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

/* Full-bleed map pages: the fixed shell already fills the viewport, so the
   page itself must not scroll (kills the useless thin page scrollbar that
   was just the default body margin). */
body.mp-fixed {
  overflow: hidden;
}

/* Full-viewport map shell ------------------------------------------------- */
.mp-shell {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.mp-topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--mp-primary);
  color: #fff;
  box-shadow: var(--mp-shadow);
  z-index: 20;
}

.mp-topbar a.mp-brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}

.mp-topbar .mp-spacer {
  flex: 1;
}

.mp-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  border-radius: 8px;
  padding: 0.55rem 0.95rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.2;
}

.mp-btn-primary {
  background: #fff;
  color: var(--mp-primary-dark);
}

.mp-btn-primary:hover {
  background: #eef5ef;
}

.mp-btn-ghost {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.mp-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.3);
}

.mp-btn-danger {
  background: #b3261e;
  color: #fff;
}

.mp-btn-danger:hover {
  background: #8f1d17;
}

.mp-btn-lg {
  padding: 0.85rem 1.4rem;
  font-size: 1.1rem;
}

.mp-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Body: map + side panel -------------------------------------------------- */
.mp-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.mp-map {
  flex: 1;
  position: relative;
}

.mp-panel {
  width: 360px;
  max-width: 90vw;
  background: var(--mp-panel-bg);
  border-left: 1px solid var(--mp-border);
  overflow-y: auto; /* vertical bar appears only when it can scroll */
  overflow-x: auto; /* horizontal bar ONLY if content is genuinely too wide */
  /* Reserve the vertical scrollbar's space so it no longer steals width and
     forces that tiny horizontal scrollbar. Content now just fits the panel. */
  scrollbar-gutter: stable;
  overflow-wrap: anywhere; /* long words wrap instead of widening the panel */
  padding: 1rem;
  /* Firefox: normal-width bar with strong contrast (not "thin"). */
  scrollbar-width: auto;
  scrollbar-color: var(--mp-primary) #c2ccd4;
}

/* Clear, high-contrast scrollbar (Chrome/Edge/Safari) */
.mp-panel::-webkit-scrollbar {
  width: 18px;
  height: 18px;
}

.mp-panel::-webkit-scrollbar-track {
  background: #c2ccd4;
  border-left: 1px solid #a7b3bd;
}

.mp-panel::-webkit-scrollbar-thumb {
  background: var(--mp-primary);
  border-radius: 9px;
  /* thin same-colour-as-track border just insets the thumb a touch so the
     green block stays nice and chunky/visible */
  border: 2px solid #c2ccd4;
  min-height: 48px;
}

.mp-panel::-webkit-scrollbar-thumb:hover {
  background: var(--mp-primary-dark);
}

.mp-panel h2 {
  font-size: 1.05rem;
  margin: 1.2rem 0 0.5rem;
  color: var(--mp-primary-dark);
}

.mp-panel h2:first-child {
  margin-top: 0;
}

/* Layer list rows --------------------------------------------------------- */
.mp-layer {
  border: 1px solid var(--mp-border);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.6rem;
}

.mp-layer-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.mp-layer-head input[type='checkbox'] {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.mp-layer-title {
  font-weight: 600;
  flex: 1;
  word-break: break-word;
}

.mp-layer-sub {
  font-size: 0.85rem;
  color: #5a6470;
}

.mp-opacity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  font-size: 0.85rem;
  color: #5a6470;
}

.mp-opacity input[type='range'] {
  flex: 1;
}

.mp-layer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

/* Layer re-order arrows --------------------------------------------------- */
.mp-reorder {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
}

.mp-reorder-btn {
  border: 1px solid var(--mp-border);
  background: #fff;
  color: var(--mp-primary-dark);
  border-radius: 5px;
  width: 1.9rem;
  height: 1.15rem;
  line-height: 1;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0;
}

.mp-reorder-btn:hover:not([disabled]) {
  background: #e8f3ec;
  border-color: var(--mp-primary);
}

.mp-reorder-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
}

.mp-link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--mp-primary);
  text-decoration: none;
}

.mp-link.mp-link-danger {
  color: #b3261e;
}

.mp-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  display: inline-block;
  vertical-align: middle;
}

/* Editor toolbar ---------------------------------------------------------- */
.mp-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--mp-shadow);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 15;
  max-width: 220px;
}

.mp-tool {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border: 2px solid var(--mp-border);
  background: #fff;
  border-radius: 9px;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.mp-tool:hover {
  border-color: var(--mp-primary);
}

.mp-tool.active {
  border-color: var(--mp-primary);
  background: #e8f3ec;
  color: var(--mp-primary-dark);
}

.mp-tool .mp-ico {
  font-size: 1.2rem;
  width: 1.5rem;
  text-align: center;
}

/* Forms ------------------------------------------------------------------- */
.mp-field {
  margin-bottom: 0.9rem;
}

.mp-field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.mp-field input[type='text'],
.mp-field textarea {
  width: 100%;
  border: 1px solid var(--mp-border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font-size: 1rem;
}

.mp-field textarea {
  min-height: 70px;
  resize: vertical;
}

.mp-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.mp-color-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--mp-border);
  cursor: pointer;
}

.mp-color-dot.selected {
  box-shadow: 0 0 0 3px var(--mp-primary);
}

.mp-color-other {
  flex-basis: 100%;
  margin-top: 0.5rem;
  justify-content: center;
  background: #fff;
  color: var(--mp-primary-dark);
  border: 2px dashed var(--mp-border);
  font-size: 0.95rem;
}

.mp-color-other:hover {
  border-color: var(--mp-primary);
  background: #e8f3ec;
}

.mp-hint {
  font-size: 0.9rem;
  color: #5a6470;
  background: #f1f5f2;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.9rem;
}

.mp-alert {
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.mp-alert-error {
  background: #fde8e6;
  color: #8f1d17;
}

.mp-alert-ok {
  background: #e6f4ea;
  color: var(--mp-primary-dark);
}

.mp-feature-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid var(--mp-border);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  margin-bottom: 0.4rem;
  cursor: pointer;
}

.mp-feature-row.active {
  border-color: var(--mp-primary);
  background: #eef5ef;
}

.mp-feature-row .mp-swatch {
  flex: 0 0 auto;
}

.mp-feature-row .mp-fr-name {
  flex: 1;
  font-weight: 600;
  word-break: break-word;
}

/* Transient tip (shown only the first couple of times) -------------------- */
.mp-tip {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 81, 47, 0.95);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  box-shadow: var(--mp-shadow);
  z-index: 18;
  transition: opacity 0.5s;
  pointer-events: none;
}

/* Sticky "select a shape first" guidance ---------------------------------- */
.mp-needfeature {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90%, 520px);
  background: #fff3cd;
  color: #6b4e00;
  border: 1px solid #e0c36b;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  box-shadow: var(--mp-shadow);
  z-index: 19;
  text-align: center;
  pointer-events: none; /* let clicks reach the map to select a shape */
}

/* Map popup --------------------------------------------------------------- */
.mp-popup {
  position: absolute;
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--mp-shadow);
  padding: 0.7rem 0.9rem;
  min-width: 200px;
  max-width: 280px;
  transform: translate(-50%, calc(-100% - 14px));
  font-size: 0.95rem;
}

.mp-popup h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.mp-popup-cover {
  margin-top: 0.4rem;
  font-weight: 700;
  color: var(--mp-primary-dark);
}

.mp-popup .mp-popup-close {
  position: absolute;
  top: 4px;
  right: 8px;
  cursor: pointer;
  color: #5a6470;
  font-weight: 700;
}

/* Autosave status (topbar) ------------------------------------------------ */
.mp-save-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  white-space: nowrap;
}

.mp-save-status .mp-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #cfe8d8;
}

.mp-save-status.is-saving .mp-dot {
  background: #ffd479;
}

.mp-save-status.is-error {
  background: #b3261e;
}

.mp-save-status.is-error .mp-dot {
  background: #fff;
}

.mp-topbar-title {
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  max-width: 38vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Simple modal overlay (no JS framework) ---------------------------------- */
.mp-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  /* keep the modal clear of the screen edges (esp. on narrow windows) */
  padding: 1.5rem;
}

.mp-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--mp-shadow);
  width: 480px;
  max-width: 100%;
  /* extra left/right breathing room so inputs don't hug the modal edge */
  padding: 1.5rem 1.9rem;
}

.mp-modal h2 {
  margin: 0 0 1rem;
  color: var(--mp-primary-dark);
}

.mp-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

/* Centered content pages (landing / auth / admin) ------------------------- */
.mp-page {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.mp-card {
  background: #fff;
  border: 1px solid var(--mp-border);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--mp-shadow);
}

.mp-table {
  width: 100%;
  border-collapse: collapse;
}

.mp-table th,
.mp-table td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--mp-border);
  font-size: 0.95rem;
  vertical-align: top;
}

.mp-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.mp-badge-grey { background: #e9edf0; color: #44505c; }
.mp-badge-green { background: #e6f4ea; color: #14512f; }
.mp-badge-red { background: #fde8e6; color: #8f1d17; }
.mp-badge-blue { background: #e6eefb; color: #1c3f7c; }

@media (max-width: 720px) {
  .mp-body {
    flex-direction: column;
  }
  .mp-panel {
    width: 100%;
    max-width: 100%;
    border-left: 0;
    border-top: 1px solid var(--mp-border);
    max-height: 45vh;
  }
}
