/* Lavô — web port of the SwiftUI "Liquid Glass" app. Dark, glassmorphic, blue/green accents. */

:root {
  --in-use: #2173fa;
  --in-use-deep: #0d38a8;
  --free: #33cc8c;
  --free-deep: #0a6b57;
  --bg: #05060a;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --text-dim: rgba(244, 246, 251, 0.6);
  --radius: 28px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

/* The `hidden` attribute must win over the display rules below (.login uses grid, .app uses flex,
   which otherwise override the UA `[hidden]{display:none}` and leave hidden elements visible). */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Backdrop gradient — green when idle, blue when something is running. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(10, 107, 87, 0.55), var(--bg) 70%);
  transition: background 0.8s ease-in-out;
}
.backdrop.active {
  background: linear-gradient(to bottom, rgba(13, 56, 168, 0.6), var(--bg) 70%);
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  color: var(--text);
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn-prominent {
  background: var(--in-use);
  box-shadow: 0 6px 20px rgba(33, 115, 250, 0.4);
}
.btn-prominent.tint-green {
  background: var(--free);
  box-shadow: 0 6px 20px rgba(51, 204, 140, 0.35);
}
.btn-prominent.tint-red {
  background: #e2483d;
  box-shadow: 0 6px 20px rgba(226, 72, 61, 0.35);
}
.btn-prominent.tint-gray {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}
.btn-glass {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.btn-icon {
  padding: 10px;
  border-radius: 14px;
}
.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px;
}
.btn-ghost:hover {
  color: var(--text);
}

/* ---------- Login ---------- */
.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  border-radius: 30px;
  padding: 34px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.login-logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.login-sub {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.login input {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
}
.login input:focus {
  border-color: var(--in-use);
}
.login-err {
  color: #ffb4a6;
  font-size: 0.85rem;
}

/* ---------- App shell ---------- */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bottom) + 28px);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.app-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  padding: 6px 4px 0;
}
.card {
  border-radius: var(--radius);
}
.app-err {
  color: #ffb37a;
  font-size: 0.82rem;
  padding: 0 4px;
}

/* ---------- Planner ---------- */
.planner {
  border-radius: 34px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.planner-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.planner-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

/* Segmented control (machine toggle). */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--glass-border);
}
.seg-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 7px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}
.seg-btn[aria-selected='true'] {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text);
}
.seg-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
}
.seg-wide .seg-btn {
  padding: 10px;
  font-size: 0.9rem;
}
.usage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.95rem;
}
.usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.usage-row .mins {
  margin-left: auto;
  color: var(--in-use);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.usage-idle {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}
.usage-idle .dot {
  color: var(--free);
}

/* Horizontal snapping hour strip. */
.strip {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 50%;
  padding: 4px calc(50% - 48px);
  scrollbar-width: none;
  height: 118px;
  align-items: center;
}
.strip::-webkit-scrollbar {
  display: none;
}
.chip {
  scroll-snap-align: center;
  flex: 0 0 96px;
  height: 96px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid transparent;
  transition: transform 0.2s ease, opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  transform: scale(0.82);
  opacity: 0.45;
}
.chip.selected {
  transform: scale(1);
  opacity: 1;
}
.chip .hour {
  font-size: 1.25rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.chip .st {
  font-size: 0.72rem;
  font-weight: 700;
}
.chip.free .st {
  color: var(--free);
}
.chip.taken .st {
  color: #ff8f84;
}
.chip.mine {
  background: rgba(33, 115, 250, 0.18);
}
.chip.mine .st {
  color: var(--in-use);
}
.chip.past {
  opacity: 0.35;
}
.chip.past .hour {
  color: var(--text-dim);
}
.chip.past .st {
  color: var(--text-dim);
}
.chip.selected.free {
  border-color: var(--free);
  background: rgba(51, 204, 140, 0.2);
}
.chip.selected.taken {
  border-color: #ff8f84;
}
.chip.selected.mine {
  border-color: var(--in-use);
}
.btn-book {
  width: 100%;
}

/* ---------- Machine cards ---------- */
/* minmax(0, 1fr): a grid track's default minimum is its content width, which let the cards push
   past the screen edge. Height follows content instead of a fixed aspect ratio for the same reason. */
.machines {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.mcard {
  position: relative;
  min-width: 0;
  min-height: 196px;
  border-radius: 28px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}
.mcard-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mcard-head .ico {
  color: var(--free);
}
.mcard.inuse .mcard-head .ico {
  color: var(--in-use);
}
.mcard-head .titles {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.mcard-head .noun {
  font-weight: 700;
  font-size: 0.95rem;
}
.mcard-head .name {
  font-size: 0.7rem;
  color: var(--text-dim);
}
.badge-mine {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(33, 115, 250, 0.4);
}
.mcard-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.mcard-body .lock {
  font-size: 1.4rem;
  color: var(--text-dim);
}
.mcard-body .btn {
  width: 100%;
  padding: 10px;
  border-radius: 14px;
  font-size: 0.82rem;
  line-height: 1.05;
  text-align: center;
}
.mcard-body .btn .ico {
  flex-shrink: 0;
}
.mcard-body .btn small {
  font-size: 0.72rem;
  font-weight: 700;
}

/* Dial */
.dial {
  position: relative;
  width: min(116px, 100%);
  aspect-ratio: 1;
}
.dial svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
  overflow: visible;
}
.dial .track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 12;
}
.dial .arc {
  fill: none;
  stroke: url(#dialGrad);
  stroke-width: 12;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(33, 115, 250, 0.6));
  transition: stroke-dashoffset 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dial .center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.dial .center .num {
  font-size: 2.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.dial .center .unit {
  font-size: 0.72rem;
  color: var(--text-dim);
}
.dial .center .lbl {
  font-size: 0.66rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.busy-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: rgba(5, 6, 10, 0.4);
}
.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Schedule sheet ---------- */
.sheet-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 20;
  animation: fade 0.2s ease;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 21;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 28px 28px 0 0;
  padding: 10px 18px calc(var(--safe-bottom) + 22px);
  max-height: 88dvh;
  overflow-y: auto;
  /* Near-opaque on purpose: the page's glowing buttons would bleed through a translucent sheet. */
  background: rgba(14, 18, 24, 0.94);
  animation: slideup 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideup {
  from {
    transform: translateY(100%);
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.sheet-grip {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.3);
  margin: 6px auto 12px;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h2 {
  font-size: 1.3rem;
  font-weight: 800;
}
.sheet-section {
  margin-top: 24px;
}
.sheet-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.sheet-err {
  color: #ffb37a;
  background: rgba(255, 143, 132, 0.1);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.85rem;
}
.btn-block {
  width: 100%;
}
.btn-sm {
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.85rem;
}

/* My reservations */
.rcards {
  display: grid;
  gap: 10px;
}
.rcard {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
}
.rcard-ico {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--free);
  background: rgba(51, 204, 140, 0.16);
}
.rcard.dryer .rcard-ico {
  color: var(--in-use);
  background: rgba(33, 115, 250, 0.18);
}
.rcard-ico svg {
  width: 22px;
  height: 22px;
}
.rcard-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rcard-kind {
  font-size: 0.78rem;
  color: var(--text-dim);
}
.rcard-time {
  font-size: 1.1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rcard-del {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #ff8f84;
  background: rgba(226, 72, 61, 0.14);
}
.rcard-del svg {
  width: 18px;
  height: 18px;
}
.empty-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* New booking: day pills + hour grid */
.days {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 12px 0;
}
.days::-webkit-scrollbar {
  display: none;
}
.day {
  flex: 0 0 58px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
}
.day-top {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: capitalize;
}
.day-num {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.day[aria-pressed='true'] {
  background: rgba(33, 115, 250, 0.22);
  border-color: var(--in-use);
}
.hgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.hchip {
  font: inherit;
  color: var(--text);
  cursor: pointer;
  min-height: 52px;
  padding: 8px 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.hchip span {
  font-size: 0.92rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.hchip small {
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--text-dim);
}
.hchip[aria-pressed='true'] {
  background: rgba(33, 115, 250, 0.25);
  border-color: var(--in-use);
}
.hchip:disabled {
  cursor: default;
  opacity: 0.38;
}
.hchip.mine:disabled {
  opacity: 0.75;
  background: rgba(33, 115, 250, 0.14);
}
.hchip.mine small {
  color: var(--in-use);
}
.hchip.taken small {
  color: #ff8f84;
}

/* Today's occupancy: one row per hour, a cell per machine */
.timeline {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  padding: 6px 10px 10px;
}
.thead,
.trow {
  display: grid;
  grid-template-columns: 52px repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}
.thead {
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 6px 0;
}
.thead span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.trow {
  padding: 3px 0;
}
.thour {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.tcell {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 0;
  border-radius: 10px;
}
.tcell.free {
  color: var(--free);
  background: rgba(51, 204, 140, 0.1);
}
.tcell.taken {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.06);
}
.tcell.mine {
  color: var(--text);
  background: rgba(33, 115, 250, 0.32);
}

/* Notifications */
.notif {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
}
.notif-ico {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
}
.notif-ico svg {
  width: 20px;
  height: 20px;
}
.notif-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-text strong {
  font-size: 0.92rem;
}
.notif-text span {
  font-size: 0.76rem;
  color: var(--text-dim);
  line-height: 1.35;
}

/* Inline SVG icons inherit currentColor via fill/stroke. */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.18em;
}
.ico svg {
  width: 100%;
  height: 100%;
}

/* ---------- Small phones (320px) ---------- */
@media (max-width: 359px) {
  .planner {
    padding: 16px;
  }
  .planner-top {
    gap: 6px;
  }
  .planner-title {
    font-size: 1.2rem;
  }
  .seg-btn {
    padding: 7px 9px;
  }
}

/* ---------- Desktop ---------- */
@media (min-width: 620px) {
  .app {
    padding-top: calc(var(--safe-top) + 34px);
  }
}
