/* Shared styling for identity's kiosk pages (register.html, dashboard.html).
 * Same dark, big-touch-target theme as pantry-vision/frontend/style.css — these are
 * sibling kiosk frontends and should read as one system. */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: #101014;
  color: #e8e8ec;
  font-family: sans-serif;
  overflow: hidden;
}

#tabs {
  display: flex;
  height: 84px;
  background: rgba(16, 16, 20, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  color: #9a9aa6;
  font-size: 26px;
}

.tab span {
  font-size: 13px;
  font-weight: 500;
}

.tab.active {
  color: #e8e8ec;
  background: rgba(110, 168, 254, 0.16);
}

main {
  height: calc(100% - 84px);
  overflow-y: auto;
  padding: 16px;
}

main.no-tabs {
  height: 100%;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.big-btn {
  min-height: 64px;
  min-width: 200px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  color: #101014;
  background: #6ea8fe;
}

.big-btn.secondary {
  background: rgba(255, 255, 255, 0.14);
  color: #e8e8ec;
}

.hint {
  color: #9a9aa6;
  font-size: 14px;
}

.error {
  color: #ff8080;
  font-size: 14px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.card-name {
  flex: 1;
  font-size: 16px;
  font-weight: 500;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The initial is drawn on the person's own colour, so a household with an Anna and an
 * Amir can be read at a glance on a surface with no room for names — the same pairing
 * a floorplan marker and a watch face use. Dark text because every colour in
 * PERSON_COLORS is mid-to-bright; a white glyph would vanish on the amber. */
.avatar {
  color: #101014;
  font-weight: 700;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.swatch {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #101014;
  font-weight: 700;
  font-size: 16px;
}

.swatch.selected {
  border-color: #e8e8ec;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6) inset;
}

.photo-actions {
  display: flex;
  gap: 8px;
  margin: 6px 0;
}

.card-meta {
  font-size: 14px;
  color: #9a9aa6;
}

.status-home {
  color: #7cf0a0;
}

.status-away {
  color: #9a9aa6;
}

.urgent-week {
  background: rgba(255, 200, 80, 0.10);
}
.urgent-week .card-meta {
  color: #ffc850;
}

.urgent-soon {
  background: rgba(255, 140, 80, 0.14);
}
.urgent-soon .card-meta {
  color: #ff8c50;
}

section.block {
  margin-bottom: 24px;
}

section.block h2 {
  font-size: 15px;
  font-weight: 600;
  color: #9a9aa6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.weather-hero {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 6px;
}

.weather-temp {
  font-size: 48px;
  font-weight: 700;
}

.weather-condition {
  font-size: 18px;
  color: #9a9aa6;
}

.clothing-suggestion {
  font-size: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(110, 168, 254, 0.14);
  display: inline-block;
}

/* --- Admin panel (admin.html) ---------------------------------------------------
 * Everything under `body.admin` only. The rules above are tuned for a wall-mounted
 * kiosk read from across a room — 64px buttons, 84px tabs, no scrolling; the admin
 * page is read at arm's length on a phone or laptop by someone who came to do
 * administration, so it opts into a denser scale rather than fighting those defaults.
 * Sharing the file (rather than a second stylesheet) keeps the colour palette,
 * card/avatar shapes and status colours identical across all three pages, which is
 * the part that should NOT diverge. */

body.admin {
  overflow: auto;
}

body.admin #tabs {
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 5;
}

body.admin .tab {
  font-size: 20px;
}

body.admin main {
  height: auto;
  max-width: 860px;
  margin: 0 auto;
  overflow: visible;
}

body.admin .card {
  min-height: 0;
  padding: 10px 14px;
  width: 100%;
  text-align: left;
}

.card.as-button {
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.card.as-button:hover {
  background: rgba(255, 255, 255, 0.10);
}

.card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

/* Long entity_ids and free-text notes must not stretch a card past the viewport —
 * they wrap instead, since truncating them would hide the exact thing (which lock?
 * which entity?) the row exists to show. */
.card-body .card-meta,
.card-body .card-name {
  overflow-wrap: anywhere;
}

.card.compact {
  gap: 10px;
  font-size: 14px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.dot-home {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7cf0a0;
  vertical-align: middle;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
  color: #c8c8d0;
}

.field.grow,
input.grow {
  flex: 1;
  min-width: 180px;
}

.field input,
.field select,
.row input,
.row select {
  min-height: 40px;
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #1a1a20;
  color: #e8e8ec;
}

.field-group {
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-group legend {
  font-size: 13px;
  font-weight: 600;
  color: #9a9aa6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 6px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}

.check input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 14px;
}

.chip input {
  width: 18px;
  height: 18px;
}

/* A deliberately smaller button than .big-btn: this page has destructive actions on
 * it, and they should not be the easiest thing on screen to hit by accident. */
.btn {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.10);
  color: #e8e8ec;
  cursor: pointer;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.btn.primary {
  background: #6ea8fe;
  border-color: #6ea8fe;
  color: #101014;
}

.btn.danger {
  color: #ff8080;
  border-color: rgba(255, 128, 128, 0.4);
  background: rgba(255, 128, 128, 0.10);
}

.btn.danger:hover {
  background: rgba(255, 128, 128, 0.20);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: #9a9aa6;
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card.expired {
  opacity: 0.55;
}

.card.allowed {
  border-left: 3px solid #7cf0a0;
}

.card.denied {
  border-left: 3px solid #ff8080;
}

.verdict {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9a9aa6;
  flex-shrink: 0;
}

.card.allowed .verdict {
  color: #7cf0a0;
}

.card.denied .verdict {
  color: #ff8080;
}

/* --- Floorplan editor --- */

.fp-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.fp-canvas-wrap {
  flex: 1 1 480px;
  min-width: 0;
}

.fp-side {
  flex: 0 1 280px;
  min-width: 240px;
}

.fp-side h3 {
  font-size: 15px;
  margin: 0 0 10px;
  color: #9a9aa6;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#fp-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 1000 / 700;
  background: #14141a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  /* Without this a click-drag on the plan selects the surrounding page text, which
   * makes drawing a room feel broken. */
  user-select: none;
  touch-action: none;
}

#fp-bg {
  opacity: 0.55;
}

.fp-room {
  fill-opacity: 0.22;
  stroke: rgba(255, 255, 255, 0.5);
  stroke-width: 2;
  cursor: pointer;
  transition: fill-opacity 120ms ease;
}

.fp-room:hover {
  fill-opacity: 0.38;
}

.fp-room.selected {
  stroke: #6ea8fe;
  stroke-width: 3;
  fill-opacity: 0.42;
}

/* Occupied rooms are the whole point of the live view, so they read at a glance from
 * across a room rather than needing to be hunted for. */
.fp-room.occupied {
  fill-opacity: 0.55;
  stroke: #7cf0a0;
  stroke-width: 3;
}

.fp-label {
  fill: #e8e8ec;
  font-size: 18px;
  font-family: sans-serif;
  pointer-events: none;
}

.fp-occupants {
  fill: #7cf0a0;
  font-size: 15px;
  font-family: sans-serif;
  pointer-events: none;
}

.fp-warn {
  fill: #ffc850;
  font-size: 12px;
  font-family: sans-serif;
  pointer-events: none;
}

.fp-handle {
  fill: #6ea8fe;
  stroke: #101014;
  stroke-width: 2;
  cursor: grab;
}

.fp-handle:active {
  cursor: grabbing;
}

.fp-draft-line {
  fill: rgba(110, 168, 254, 0.14);
  stroke: #6ea8fe;
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.fp-draft-point {
  fill: #6ea8fe;
}

.fp-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- Person editor dialog --- */
#editor {
  width: min(680px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: #17171d;
  color: #e8e8ec;
  overflow: hidden;
}

#editor::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

#editor form {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}

.editor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-head h3 {
  flex: 1;
  margin: 0;
  font-size: 17px;
}

.editor-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow-y: auto;
}

.editor-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  align-items: center;
}
