:root {
  --bg0: #07101c;
  --bg1: #0c1a2e;
  --bg2: #12304a;
  --surface: rgba(8, 18, 32, 0.72);
  --surface-2: rgba(10, 22, 38, 0.78);
  --text: #f0f5fa;
  --muted: #9db4c8;
  --accent: #c8f542;
  --accent-2: #3dd6c6;
  --danger: #ff6b6b;
  --warn: #ffb020;
  --booked: #3dd6c6;
  --reserved: #8899aa;
  --open: #c8f542;
  --radius: 14px;
  --font: "DM Sans", sans-serif;
  --display: "Outfit", sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(165deg, rgba(7, 16, 28, 0.34), rgba(12, 26, 46, 0.26) 42%, rgba(6, 14, 24, 0.4)),
    radial-gradient(1100px 520px at 8% -8%, rgba(40, 90, 140, 0.14) 0%, transparent 55%),
    radial-gradient(800px 480px at 100% 0%, rgba(20, 60, 100, 0.12) 0%, transparent 50%),
    url("/assets/img/padel-blue.jpg") center / cover no-repeat;
  background-attachment: fixed;
  background-color: #0a2744;
}

#app {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 0 16px calc(72px + var(--safe-bottom));
  padding-top: 0;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(14px + var(--safe-top)) 0 10px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: linear-gradient(to bottom, rgba(7,16,28,.88), rgba(7,16,28,.4), transparent);
}

@media (display-mode: standalone) {
  body {
    /* App-like: evita overscroll “rubber band” sul chrome del browser */
    overscroll-behavior: none;
  }
}

.brand {
  display: flex;
  align-items: center;
  cursor: pointer;
  line-height: 0;
  border-radius: 10px;
}
.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12);
}

.top-actions { display: flex; gap: 8px; align-items: center; }

.badge {
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 176, 32, 0.2);
  color: var(--warn);
  border: 1px solid rgba(255, 176, 32, 0.35);
}
.badge.ok {
  background: rgba(200, 245, 66, 0.15);
  color: var(--accent);
  border-color: rgba(200, 245, 66, 0.35);
}

.hidden { display: none !important; }

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #0a1620;
}
.btn:active { transform: scale(0.98); }
.btn.ghost {
  background: var(--surface-2);
  color: var(--text);
}
.btn.block { width: 100%; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 7px 12px; font-size: 0.85rem; }

.panel {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 16px;
  margin: 12px 0;
  backdrop-filter: blur(10px);
  animation: rise 0.35s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h1, h2, h3 {
  font-family: var(--display);
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
p.lead { color: var(--muted); margin: 0 0 16px; line-height: 1.45; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin: 12px 0 6px; }
input, textarea, select {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
}
textarea { min-height: 90px; resize: vertical; }

.list { display: grid; gap: 10px; }
.court-item {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
  transition: border-color 0.2s, transform 0.2s;
}
.court-item:hover { border-color: rgba(200,245,66,0.35); }
.court-item .name { font-weight: 700; font-size: 1.05rem; }
.court-item .meta { color: var(--muted); font-size: 0.85rem; }
.fav { color: var(--accent); font-size: 0.75rem; font-weight: 700; }

.day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  scrollbar-width: none;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}
.day-tab.active {
  background: rgba(200,245,66,0.15);
  border-color: rgba(200,245,66,0.4);
  color: var(--text);
}

.slots { display: grid; gap: 8px; }
.slot {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.22);
  border-left: 4px solid transparent;
  cursor: pointer;
}
.slot.free { border-left-color: rgba(255,255,255,0.25); }
.slot.open { border-left-color: var(--open); background: rgba(200,245,66,0.08); }
.slot.full { border-left-color: #f0c14a; background: rgba(240,193,74,0.1); }
.slot.reserved { border-left-color: var(--reserved); opacity: 0.85; }
.slot.booked { border-left-color: var(--booked); }
.slot.busy { border-left-color: var(--reserved); }
.slot .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.slot .status { font-size: 0.85rem; color: var(--muted); }

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(520px, 100%);
  display: flex;
  align-items: stretch;
  gap: 4px;
  padding: 10px 8px calc(10px + var(--safe-bottom));
  background: rgba(8, 16, 28, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,0.08);
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 10px 6px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  min-width: 0;
}
.nav-btn-home {
  flex: 0 0 auto;
  width: auto;
  padding: 10px 8px;
}
.nav-btn .nav-ico {
  display: block;
  flex-shrink: 0;
}
.nav-btn.active {
  background: var(--surface-2);
  color: var(--accent);
}

.msg {
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  margin: 6px 0;
  font-size: 0.92rem;
}
.msg.system { color: var(--muted); font-style: italic; background: transparent; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.error { color: var(--danger); margin: 8px 0; font-size: 0.9rem; }
.ok { color: var(--accent); margin: 8px 0; font-size: 0.9rem; }
.chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(200,245,66,0.15);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
}
