/*! CubifyIt Roads. Copyright (c) 2026 Cubify It Studio. All rights reserved.
No permission is granted to copy, modify or redistribute this code. See LICENSE. */
/* ---------- Settings panel, right of the model: three rows (Roads, Stand, Mark), each a short label and its
   controls, then Import and Download ---------- */

.settings {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--panel-pad) var(--panel-pad) var(--actions-bottom);
  overflow-y: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.settings .row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.settings .mark-row { gap: 6px; } /* its checkbox, four shapes and color chip just fit the panel */
.row-label { flex: none; width: 48px; font-size: 14px; font-weight: 500; color: var(--ink); }

.settings input[type=text], .settings select {
  height: var(--ctl-h);
  min-width: 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--ctl-r);
  background: var(--field);
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: border-color .15s, background .15s;
}
.settings input[type=text]:hover, .settings select:hover { background: var(--field-hover); }
.settings input:focus, .settings select:focus { background: var(--surface); border-color: var(--ink); }
/* The wood menu with its own arrow, so it looks the same in every browser */
.settings select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23141414' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.text-field { position: relative; flex: 1 1 0; min-width: 0; display: flex; }
/* The stand's text box when the stand holds no more: its outline flashes red (js/stand.js) */
.text-field.full #stand-text { border-color: var(--danger); animation: full-nudge .25s; }
@keyframes full-nudge { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.settings #stand-text { flex: 1; width: 0; text-transform: uppercase; letter-spacing: .04em; } /* engraved in capitals */
.text-field.has-text #stand-text { padding-right: 40px; } /* room for the × while it shows */
.settings #wood { flex: none; width: 96px; padding: 0 28px 0 12px; }
/* Wood picker (js/stand.js): a button with the chosen wood's grain behind its name, opening both woods */
.wood-picker { position: relative; flex: none; display: inline-flex; }
.wood-current, .wood-menu button {
  width: 96px;
  height: var(--ctl-h);
  padding: 0 12px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: var(--ctl-r);
  background-size: cover;
  background-position: center;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.wood-current { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.wood-current svg { flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.wood-current.light-wood, .wood-menu button.light-wood { color: var(--ink); text-shadow: 0 1px 1px rgba(255,255,255,.4); }
.wood-current.light-wood svg { filter: none; }
.wood-current:hover, .wood-menu button:hover { border-color: rgba(0,0,0,.35); }
.wood-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--ctl-r) + 2px);
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
}
.wood-menu[hidden] { display: none; }
.wood-menu button { text-align: left; }
.wood-menu button[aria-selected="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Road density: − and + around the tier shown up to; under it "Auto", or "Back to Auto" after stepping by hand */
.stepper { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 2px; height: var(--ctl-h); padding: 3px; background: var(--field); border-radius: var(--ctl-r); }
.stepper > button { flex: none; width: 32px; height: 34px; padding: 0; border-radius: calc(var(--ctl-r) - 3px); background: var(--surface); font-size: 18px; line-height: 1; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04); }
.stepper > button:hover:not(:disabled) { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.16), 0 0 0 1px rgba(0,0,0,.06); }
.stepper > button:disabled { opacity: .3; cursor: default; box-shadow: none; background: transparent; }
.stepper > .stepper-value, .stepper > .stepper-value:disabled, .stepper > .stepper-value:hover {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  background: transparent;
  box-shadow: none;
  opacity: 1;
  font-size: 13px;
  line-height: 1.15;
  cursor: default;
}
#density-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.stepper .note { font-size: 10.5px; font-weight: 500; color: var(--muted); }
.stepper.manual .stepper-value { cursor: pointer; }
.stepper.manual .note { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* The mark on the map: drawn at its printed 8 mm size relative to the frame */
.map-mark { display: grid; place-items: center; touch-action: none; background: none; border: 0; cursor: move; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
/* The same four-arrow cursor as on the 3D model, also while it is being dragged (Leaflet sets its own then) */
.leaflet-dragging .map-mark, .map-mark.leaflet-marker-draggable, .leaflet-dragging .leaflet-grab .map-mark { cursor: move; }
.map-mark svg { display: block; }

/* Color pickers: a square swatch of the current color; tapping it opens a row of the five colors under it */
.palette { position: relative; display: inline-flex; flex: none; }
.settings .row > .palette { margin-left: auto; }
.palette-current, .palette-menu button {
  width: var(--ctl-h);
  height: var(--ctl-h);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--ctl-r);
  /* A white inner rim frames the color, so a dark chip doesn't read as a heavy block and white stays visible */
  box-shadow: inset 0 0 0 3px var(--surface);
  cursor: pointer;
  transition: border-color .15s;
}
.palette-current:hover { border-color: #c9c9c4; }
.palette-menu {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 6px);
  right: 0;
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.12);
}
.palette-menu[hidden] { display: none; }
.palette-menu button { width: 28px; height: 28px; border-radius: 8px; box-shadow: inset 0 0 0 2px var(--surface); }
.palette-menu button[aria-selected="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }

/* At the bottom of the panel: Import beside Download, each opening its menu above it */
.actions { margin-top: auto; flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 8px; }
.action { position: relative; display: grid; }
/* In the full screen view: Back and Download exactly where Import and Next are in the panel (only there) */
.review-actions { display: none; }
.model.full-screen .review-actions {
  display: grid;
  position: absolute;
  z-index: 3;
  right: var(--panel-pad);
  bottom: var(--actions-bottom);
  width: calc(var(--panel-w) - 2 * var(--panel-pad) - 1px); /* the panel's inside: less its padding and left border */
  margin: 0;
}
.actions > .action > button { height: var(--ctl-h); width: 100%; padding: 0; font-size: 15px; border-radius: var(--ctl-r); } /* as tall as the other controls */
.actions button.secondary { letter-spacing: .06em; text-transform: uppercase; }
.action-menu {
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 8px);
  width: 300px;
  display: grid;
  gap: 2px;
  padding: 6px;
  background: var(--surface);
  border-radius: var(--ctl-r);
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
}
.action-menu[hidden] { display: none; }
.download-menu { right: 0; }
.import-menu { left: 0; gap: 8px; padding: 10px; }
.action-menu label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  font-size: 14px;
  border-radius: calc(var(--ctl-r) - 3px);
  cursor: pointer;
}
.action-menu label:hover { background: var(--field); }
.action-menu label.always { cursor: default; }
.action-menu label.always:hover { background: none; }
.action-menu input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--ink); cursor: pointer; }
/* Each file: its extension in a column of its own, then what it is for */
.download-menu label b { width: 42px; flex: none; }
.download-menu label span { color: var(--muted); }
.action-menu input:disabled { opacity: .55; cursor: default; }
.menu-note { display: grid; gap: 2px; font-size: 14px; }
.menu-note { margin: 0; padding: 0 2px; }
.action-menu b { font-weight: 600; }
.action-menu small { font-size: 12px; color: var(--muted); line-height: 1.4; }
.import-menu button { height: 40px; border-radius: calc(var(--ctl-r) - 3px); font-size: 13px; }

