:root {
  --bg: #FFFFFF;
  --surface: #F5F5F7;
  --text: #040415;
  --muted: #7F7F7F;
  --accent: #FA4A0C;
  --accent-pressed: #E0430A;
  --border: #EFEEEE;
  --inactive: #EFEEEE;
  --inactive-text: #969696;
  --error: #FF4444;
  --success: #22C55E;
  --white: #FFFFFF;
  --cta-text: #F5F5F9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Unbounded', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 402px;
  margin: 0 auto;
  padding: 0 33px 40px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 37px 0 0;
}

.header-tg {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.header-tg:hover {
  opacity: 1;
}

.header-logo-img {
  display: block;
  max-width: 148px;
  height: auto;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.flame-logo {
  flex-shrink: 0;
}

.header-brand {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--text);
}

.title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 24px;
  line-height: 1.25;
  color: var(--accent);
  margin: 16px 0 28px;
}

.booking-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  color: var(--muted);
}

.arena-row {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.tab-btn {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.tab-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.arena-tab {
  width: 108px;
  height: 38px;
  background: var(--accent);
  color: var(--white);
}

.arena-tab:not(.active) {
  background: var(--inactive);
  color: var(--inactive-text);
}

.arena-add {
  height: 38px;
  padding: 0 16px;
  background: var(--inactive);
  color: var(--inactive-text);
  opacity: 0.6;
  cursor: not-allowed;
  font-size: 13px;
  border-radius: 16px;
}

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

.court-tab {
  width: 62px;
  height: 58px;
  background: var(--inactive);
  color: var(--inactive-text);
  font-size: 20px;
  font-weight: 300;
  border-radius: 16px;
}

.court-tab.active {
  background: var(--accent);
  color: var(--white);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-field {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 26px;
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 16px 48px 16px 16px;
  width: 100%;
  outline: none;
  transition: border-color 0.2s;
  height: 58px;
}

.input-field:focus {
  border-color: var(--accent);
}

.input-field::placeholder {
  color: var(--inactive-text);
}

.input-field::-webkit-inner-spin-button,
.input-field::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  color: var(--muted);
  pointer-events: none;
}

.qr-upload-wrapper {
  position: relative;
  width: 100%;
  height: 58px;
  border: 1.5px dashed var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.qr-upload-wrapper:hover,
.qr-upload-wrapper.has-file {
  border-color: var(--accent);
}

.qr-upload-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.qr-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

.datetime-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.datetime-field {
  flex: 1;
  padding: 16px 8px 16px 16px;
  font-size: 14px;
  min-width: 0;
}

.datetime-sep {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  flex-shrink: 0;
}

.bank-icons {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 12px 0 4px;
  flex-wrap: wrap;
}

.bank-icon-btn {
  width: 52px;
  height: 52px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.2s, transform 0.15s, opacity 0.2s;
  outline: none;
  opacity: 0.4;
}

.bank-icon-btn.selected {
  opacity: 1;
}

.bank-icon-btn:hover {
  opacity: 0.7;
}

.bank-icon-btn.selected {
  background: rgba(250, 74, 12, 0.08);
  border-color: transparent;
  transform: scale(1.05);
  opacity: 1;
}

.bank-icon-btn img {
  display: block;
  width: 40px;
  height: 40px;
}

.bank-icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="datetime-local"].input-field {
  color-scheme: light;
  cursor: pointer;
}

input[type="datetime-local"].input-field::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(0.5);
}

.form-error {
  background: rgba(255, 68, 68, 0.1);
  border: 1px solid var(--error);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 13px;
  line-height: 1.4;
  color: var(--error);
}

.cta-button {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 17px;
  line-height: 20px;
  color: var(--cta-text);
  background: var(--accent);
  border: none;
  border-radius: 30px;
  height: 70px;
  width: 100%;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.cta-button:hover {
  background: var(--accent-pressed);
}

.cta-button:active {
  transform: scale(0.98);
}

.cta-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.cta-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Share screen */

.share-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 0 80px;
  text-align: center;
}

.tennis-ball {
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
}

.tennis-ball-img {
  max-width: 280px;
  width: 100%;
  height: auto;
  display: block;
}

.share-hint {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  color: var(--muted);
  margin-bottom: 24px;
  max-width: 280px;
}

.share-link-row {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 323px;
  gap: 0;
}

.share-link-btn {
  flex: 1;
  height: 58px;
  background: var(--accent);
  border-radius: 30px 0 0 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 26px;
  color: var(--white);
  text-decoration: none;
  padding: 0 16px;
  transition: background 0.2s;
  overflow: hidden;
  white-space: nowrap;
}

.share-link-btn:hover {
  background: var(--accent-pressed);
}

.share-copy-btn {
  width: 58px;
  height: 58px;
  background: var(--accent);
  border: none;
  border-radius: 0 30px 30px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  transition: background 0.2s;
  flex-shrink: 0;
}

.share-copy-btn:hover {
  background: var(--accent-pressed);
}

.share-copied {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--success);
  margin-top: 12px;
}

.share-another-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  padding: 0 32px;
  margin-top: 40px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--accent);
  background: transparent;
  border: 2px solid var(--accent);
  border-radius: 30px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.share-another-btn:hover {
  background: var(--accent);
  color: var(--white);
}

/* Booking display page (server-rendered) */

.booking-page-link {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
  margin: 24px 0 8px;
}

.booking-datetime {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 32px;
  line-height: 40px;
  color: var(--text);
  margin: 0 0 24px;
  white-space: pre-line;
}

.info-cards {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}

.info-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  color: var(--muted);
}

.info-tag {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  padding: 7px 16px;
  border-radius: 16px;
  text-align: center;
  min-width: 108px;
}

.info-value-court .info-tag {
  font-size: 20px;
  min-width: 62px;
}

.qr-container {
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 28px;
  min-height: 300px;
}

.qr-image {
  max-width: 280px;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.payment-section {
  margin-bottom: 8px;
}

.payment-label {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  color: var(--muted);
  margin-bottom: 8px;
}

.payment-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.bank-icon-outside {
  flex-shrink: 0;
}

.payment-card {
  flex: 1;
  background: var(--accent);
  border-radius: 24px;
  padding: 14px 20px;
}

.payment-phone-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.payment-phone {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 26px;
  color: var(--white);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--white);
  transition: background 0.2s;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.copy-btn.copied {
  background: rgba(34, 197, 94, 0.2);
}

.per-person {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  line-height: 24px;
  text-align: center;
  color: var(--muted);
}

.not-found {
  text-align: center;
  padding: 100px 20px;
}

.not-found h1 {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 48px;
  color: var(--muted);
  margin-bottom: 12px;
}

.not-found p {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 24px;
}

.not-found a {
  display: inline-block;
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--accent);
  text-decoration: none;
  border: 1.5px solid var(--accent);
  border-radius: 30px;
  padding: 14px 32px;
  transition: background 0.2s, color 0.2s;
}

.not-found a:hover {
  background: var(--accent);
  color: var(--white);
}

/* Analytics */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 24px;
  color: var(--accent);
}

.stat-label {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}

.analytics-section {
  margin-bottom: 28px;
}

.section-title {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 16px;
}

.court-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.court-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.court-bar-label {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 13px;
  color: var(--muted);
  width: 50px;
  flex-shrink: 0;
}

.court-bar-track {
  flex: 1;
  height: 28px;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}

.court-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 8px;
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--white);
  min-width: 28px;
}

.court-bar-count {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--text);
  width: 24px;
  text-align: right;
  flex-shrink: 0;
}

.total-all-row {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0 24px;
}

.total-all-label {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--muted);
}

.total-all-value {
  font-family: 'Unbounded', sans-serif;
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
}

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

.recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 12px;
  gap: 8px;
}

.recent-datetime {
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 13px;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-court {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 12px;
  color: var(--accent);
  background: rgba(250, 74, 12, 0.1);
  padding: 4px 10px;
  border-radius: 8px;
  flex-shrink: 0;
}

.recent-amount {
  font-family: 'Unbounded', sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
}

.back-link {
  display: inline-block;
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  padding: 12px 0;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

.analytics-link {
  display: block;
  text-align: center;
  font-family: 'Unbounded', sans-serif;
  font-weight: 300;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 16px 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.analytics-link:hover {
  opacity: 1;
  color: var(--accent);
}
