/* FDL Booking Engine — Design System */

:root {
  --black: #111;
  --dark: #333;
  --gray: #666;
  --light-gray: #999;
  --border: #e0e0e0;
  --bg: #f5f5f5;
  --white: #fff;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --green: #16a34a;
  --red: #dc2626;
  --yellow: #ca8a04;
  --polo: #1b5e20;
  --polo-light: #e8f5e9;
  --polo-mid: #a5d6a7;
  --polo-hover: #2e7d32;
  --persimmon: #bf360c;
  --persimmon-light: #fbe9e7;
  --persimmon-mid: #ffab91;
  --persimmon-hover: #d84315;
  --oxmoor: #0d47a1;
  --oxmoor-light: #e3f2fd;
  --oxmoor-mid: #90caf9;
  --oxmoor-hover: #1565c0;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--black);
  line-height: 1.5;
  min-height: 100vh;
}

/* Embed mode */
body.embed-mode .app-header,
body.embed-mode .bottom-nav,
body.embed-mode .back-link { display: none !important; }
body.embed-mode .main-content { padding-bottom: 0 !important; }

/* Header */
.app-header {
  background: var(--black);
  color: var(--white);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.header-user {
  font-size: 13px;
  color: var(--light-gray);
  cursor: pointer;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-decoration: none;
  color: var(--light-gray);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 16px;
  transition: color 0.15s;
}

.bottom-nav a.active { color: var(--black); }
.bottom-nav a svg { width: 22px; height: 22px; }

/* Main content */
.main-content {
  padding: 16px;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
  max-width: 600px;
  margin: 0 auto;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--black);
  color: var(--white);
  width: 100%;
}
.btn-primary:hover { background: var(--dark); }
.btn-primary:disabled { background: var(--light-gray); cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--black);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--bg); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  font-size: 13px;
  padding: 6px 14px;
}
.btn-danger:hover { background: #fef2f2; }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

.btn-book {
  background: var(--green);
  color: var(--white);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.btn-book:hover { background: #15803d; }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  margin-bottom: 4px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  background: var(--white);
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--black);
}

.form-input::placeholder { color: var(--light-gray); }

/* Alert messages */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: var(--blue); border: 1px solid #bfdbfe; }

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.tab.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

/* Date nav — horizontal inline pills */
.date-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}

.date-nav-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  color: var(--gray);
  flex-shrink: 0;
  transition: all 0.15s;
}
.date-nav-btn:hover { background: var(--bg); }

.date-days {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.date-days::-webkit-scrollbar { display: none; }

.date-day {
  padding: 7px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
  background: var(--white);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}
.date-day:hover { background: var(--bg); }

.date-day.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
  font-weight: 600;
}

.date-day.today { border-color: var(--dark); }

/* Player dots */
.player-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--white);
}

.dot.filled { background: var(--black); border-color: var(--black); }

/* Player count selector */
.player-count {
  display: flex;
  gap: 8px;
}

.player-count-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
}

.player-count-btn.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--white);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 20px;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray);
  padding: 4px;
}

.modal-info {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 20px;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-full { background: #fee2e2; color: var(--red); }
.badge-available { background: #dcfce7; color: var(--green); }
.badge-blocked { background: #f3f4f6; color: var(--gray); }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--light-gray);
  font-size: 14px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 8px;
}

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

/* Text utilities */
.text-sm { font-size: 13px; }
.text-gray { color: var(--gray); }
.text-light { color: var(--light-gray); }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }

/* Links */
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--light-gray);
}

.empty-state p {
  margin-top: 8px;
  font-size: 14px;
}

/* Favorites & Groups */
.favorite-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.favorite-item:last-child { border-bottom: none; }

.favorite-remove {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--light-gray);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}
.favorite-remove:hover { color: var(--red); }

.person-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.person-badge-member { background: #dcfce7; color: var(--green); }
.person-badge-guest { background: #f3f4f6; color: var(--gray); }

.group-item {
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.group-item:last-child { border-bottom: none; }

.group-item-header {
  display: flex;
  align-items: center;
  cursor: pointer;
}

/* Pick labels (Favorites, Recent) */
.picks-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--light-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

/* Favorite quick-pick pills (booking modal) */
.favorites-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-favorite-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-favorite-pick:hover { background: var(--bg); border-color: var(--dark); }
.btn-favorite-pick.used {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Suggestion quick-pick pills (booking modal) */
.suggestions-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-suggestion-pick {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  border: 1px dashed var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  color: var(--gray);
}
.btn-suggestion-pick:hover { background: var(--white); border-color: var(--dark); color: var(--dark); }
.btn-suggestion-pick.used {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

/* Responsive */
@media (min-width: 640px) {
  .main-content { padding: 24px; }
}
