/* 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;
  justify-content: space-between;
}
.planner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.35rem;
  font-weight: 700;
}
.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 .apt {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.chip.free .st {
  color: var(--free);
}
.chip.busy .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.busy {
  border-color: #ff8f84;
}
.chip.selected.mine {
  border-color: var(--in-use);
}
.btn-book {
  width: 100%;
}

/* ---------- Machine cards ---------- */
.machines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.mcard {
  position: relative;
  border-radius: 28px;
  padding: 16px;
  aspect-ratio: 1;
  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 small {
  font-size: 0.72rem;
  font-weight: 700;
}

/* Dial */
.dial {
  position: relative;
  width: 116px;
  height: 116px;
}
.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;
  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;
  margin-bottom: 12px;
}
.sheet-head h2 {
  font-size: 1.3rem;
  font-weight: 800;
}
.sheet-section {
  margin-top: 18px;
}
.sheet-section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.field label {
  color: var(--text-dim);
  font-size: 0.9rem;
}
.field select,
.field input {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 8px 10px;
  outline: none;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.list-row .time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.list-row .who {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.82rem;
}
.list-row .del {
  margin-left: auto;
  color: #ff8f84;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
}
.empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding: 8px 0;
}
.notif-status {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 8px;
}

/* 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%;
}

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