:root {
  --grass: #7EB541;
  --grass-dark: #6a9835;
  --orange: #F15A29;
  --bark-blue: #2B8FCC;
  --sky-soft: #cef3f9;
  --bg: var(--sky-soft);
  --card: #ffffff;
  --border: #dfe7e3;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --success-bg: #e8f5d8;
  --success-text: #3f6518;
  --error-bg: #fde8e8;
  --error-text: #8c1a1a;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

header {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo {
  display: block;
  width: 100%;
  max-width: 500px;
  height: auto;
  margin: 0 auto;
}

.subtitle {
  margin: 18px auto 0;
  padding: 10px 18px;
  background: var(--card);
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  width: fit-content;
  max-width: 100%;
}

.subtitle-step {
  letter-spacing: 0.01em;
}

.subtitle-sep {
  color: var(--grass);
  font-weight: 800;
  font-size: 1.05rem;
}

.price {
  margin: 10px 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--bark-blue);
  text-align: center;
  letter-spacing: 0.01em;
}

.refund-note {
  margin: 4px 0 10px;
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}

/* ---- Day grid ------------------------------------------------------------ */

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

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.month-nav h2 {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.month-nav button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1.4rem;
  font-family: inherit;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.month-nav button:hover:not(:disabled) {
  border-color: var(--grass);
  background: #f1f8e6;
}

.month-nav button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.day-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 8px;
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 32px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loading p { margin: 0; }

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(126, 181, 65, 0.18);
  border-top-color: var(--grass);
  border-radius: 50%;
  animation: ybark-spin 0.8s linear infinite;
}

.spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: ybark-spin 0.8s linear infinite;
  vertical-align: -3px;
  margin-right: 10px;
}

@keyframes ybark-spin {
  to { transform: rotate(360deg); }
}

.day-empty {
  visibility: hidden;
}

.day-outside {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 6px 4px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  color: var(--muted);
  opacity: 0.75;
  font-size: 1rem;
  font-weight: 700;
}

.day-opens {
  font-size: 0.62rem;
  font-weight: 500;
  line-height: 1.15;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.day {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 6px 4px;
  aspect-ratio: 1;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform 0.08s, border-color 0.15s, background 0.15s;
}

.day:hover:not(:disabled) {
  border-color: var(--grass);
  transform: translateY(-1px);
}

.day:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.day-selected {
  border-color: var(--grass);
  background: #f1f8e6;
  box-shadow: 0 2px 0 var(--grass-dark);
}

.day-today .day-date::before {
  content: 'Today';
  display: block;
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--bark-blue);
  margin-bottom: 0;
  line-height: 1;
}

.day-date {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.day-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 999px;
  margin-top: 2px;
  white-space: nowrap;
}

@media (max-width: 520px) {
  .day-headers, .days { gap: 4px; }
  .day, .day-outside { padding: 4px 2px; }
  .day-date { font-size: 0.85rem; }
  .day-outside { font-size: 0.85rem; }
  .day-badge { display: none; }
  .day-opens { font-size: 0.55rem; }
  .opens-full { display: none; }
  .day-headers { font-size: 0.6rem; }
  .day-free    { border-color: var(--grass); }
  .day-partial { border-color: #e5a93a; }
  .day-busy    { border-color: #c94141; opacity: 0.6; }
  .day-closed  { border-color: #aaa; opacity: 0.5; }
}

.day-free .day-badge    { background: #e8f5d8; color: #3f6518; }
.day-partial .day-badge { background: #fff3d8; color: #7a5b14; }
.day-busy .day-badge    { background: #fde8e8; color: #8c1a1a; }
.day-closed .day-badge  { background: #e8eaec; color: #4a4f55; }

.badge-count { display: none; }
.day-swap:hover .badge-label { display: none; }
.day-swap:hover .badge-count { display: inline; }

/* ---- Hour panel ---------------------------------------------------------- */

.hours-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.hours-panel h2 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.hours-hint {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
}

.hours {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hours-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.hours-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.hour {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 12px 6px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.06s, border-color 0.15s, background 0.15s, color 0.15s;
}


.hour:hover:not(:disabled):not(.hour-unavailable) {
  border-color: var(--grass);
}

.hour-selected {
  background: var(--grass);
  color: #ffffff;
  border-color: var(--grass-dark);
  box-shadow: 0 2px 0 var(--grass-dark);
}

.hour-booked {
  background: #fde8e8;
  border-color: #f4c2c2;
  color: #8c1a1a;
  cursor: not-allowed;
  text-decoration: line-through;
}

.hour-past {
  opacity: 0.4;
  cursor: not-allowed;
}

.hour-unavailable {
  opacity: 0.35;
  cursor: not-allowed;
}

.hour:disabled {
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .hour { font-size: 0.8rem; padding: 10px 4px; }
  .hours-row { gap: 6px; }
}

@media (max-width: 420px) {
  .hour { font-size: 0.7rem; padding: 8px 2px; }
  .hours-row { gap: 4px; }
}

/* ---- Booking form -------------------------------------------------------- */

.booking-form {
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 20px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.875rem;
  color: var(--text);
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #cfd6cf;
  border-radius: 10px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--text);
  margin-bottom: 14px;
}

input:focus {
  outline: 2px solid var(--grass);
  outline-offset: -1px;
  border-color: var(--grass);
}

.selection-summary {
  margin: 16px 0 8px;
  padding: 12px 14px;
  background: #f1f8e6;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #3f6518;
}

.selection-summary strong {
  color: var(--grass-dark);
  font-weight: 700;
}

button[type="submit"] {
  width: 100%;
  margin-top: 12px;
  padding: 15px;
  background: var(--grass);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s;
  box-shadow: 0 2px 0 var(--grass-dark);
}

button[type="submit"]:hover:not(:disabled) { background: var(--grass-dark); }
button[type="submit"]:active:not(:disabled) { transform: translateY(1px); box-shadow: 0 1px 0 var(--grass-dark); }
button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }

#message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
}

#message.success { background: var(--success-bg); color: var(--success-text); }
#message.error { background: var(--error-bg); color: var(--error-text); }

/* ---- PIN display box ---------------------------------------------------- */

#pin-box {
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--grass) 0%, var(--grass-dark) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(126, 181, 65, 0.25);
}

.pin-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  opacity: 0.9;
  margin-bottom: 12px;
  font-weight: 600;
}

.pin-digits {
  font-size: 3.75rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 1;
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.pin-slot {
  font-size: 0.95rem;
  opacity: 0.95;
  font-weight: 500;
}

/* ---- Footer -------------------------------------------------------------- */

footer {
  margin-top: 64px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.footer-logo {
  display: block;
  margin: 0 auto 14px;
  width: 140px;
  height: auto;
}

footer p { margin: 0 0 4px; }
footer p:last-child { margin-bottom: 0; }
footer a {
  color: var(--bark-blue);
  text-decoration: none;
  font-weight: 500;
}
footer a:hover { text-decoration: underline; }
