:root {
  --green:       #2e7d32;
  --green-light: #4caf50;
  --green-dark:  #1b5e20;
  --yellow:      #f9a825;
  --white:       #ffffff;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-400:    #9ca3af;
  --gray-600:    #4b5563;
  --gray-800:    #1f2937;
  --red:         #dc2626;
  --shadow:      0 1px 3px rgba(0,0,0,.12);
  --shadow-md:   0 4px 12px rgba(0,0,0,.15);
  --radius:      12px;
  --nav-h:       56px;
  --bottom-h:    64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Auth ─────────────────────────────────────────────── */
#auth-screen {
  min-height: 100vh;
  background: linear-gradient(160deg, var(--green-dark) 0%, var(--green) 100%);
  display: flex; flex-direction: column; align-items: center;
  padding: 0 1rem 2rem;
}
.auth-tabs {
  display: flex; gap: .5rem;
  padding: 1.5rem 0 0;
  width: 100%; max-width: 400px;
}
.auth-tab {
  flex: 1; padding: .6rem;
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  border: none; border-radius: 8px;
  font-size: .95rem; cursor: pointer;
  transition: all .2s;
}
.auth-tab.active { background: white; color: var(--green-dark); font-weight: 600; }
.auth-card {
  background: white; border-radius: var(--radius);
  padding: 1.5rem; width: 100%; max-width: 400px;
  margin-top: 1rem; box-shadow: var(--shadow-md);
}
.auth-logo { text-align: center; margin-bottom: 1.5rem; }
.auth-logo-icon { font-size: 2.5rem; margin-bottom: .5rem; }
.auth-logo h1 { color: var(--green-dark); font-size: 1.4rem; margin-bottom: .2rem; }
.auth-logo p  { color: var(--gray-400); font-size: .85rem; }
.auth-footer  { text-align: center; font-size: .8rem; color: var(--gray-400); margin-top: 1rem; }

/* ── Top Nav ──────────────────────────────────────────── */
#top-nav {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav-h); background: var(--green-dark);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1rem; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.nav-brand { color: white; font-size: 1.1rem; font-weight: 700; }
.nav-brand span { color: var(--yellow); }
.nav-right { display: flex; align-items: center; gap: .75rem; }
.nav-user-badge {
  background: rgba(255,255,255,.2); color: white;
  padding: .2rem .6rem; border-radius: 99px; font-size: .75rem;
}
.nav-menu-btn {
  background: none; border: none; color: white;
  font-size: 1.4rem; cursor: pointer; padding: .3rem;
  line-height: 1;
}

/* ── Mobile slide menu ────────────────────────────────── */
#mobile-menu-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 200;
}
#mobile-menu-overlay.open { display: block; }
#mobile-menu {
  position: fixed; top: 0; right: -280px; width: 280px; height: 100vh;
  background: white; z-index: 201;
  transition: right .25s ease;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,.2);
}
#mobile-menu.open { right: 0; }
.mobile-menu-header {
  background: var(--green-dark); color: white;
  padding: 1rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600;
}
.mobile-menu-header button { background: none; border: none; color: white; font-size: 1.2rem; cursor: pointer; }
.mobile-nav-links { flex: 1; overflow-y: auto; padding: .5rem 0; }
.mobile-nav-links a {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.25rem;
  color: var(--gray-800); text-decoration: none;
  font-size: .95rem; border-left: 3px solid transparent;
  transition: all .15s;
}
.mobile-nav-links a:hover,
.mobile-nav-links a.active {
  background: var(--gray-50);
  border-left-color: var(--green);
  color: var(--green-dark);
}

/* ── Bottom Tab Bar ───────────────────────────────────── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: white;
  border-top: 1px solid var(--gray-200);
  display: flex; z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.bottom-tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: .65rem;
  padding: .3rem .2rem;
  transition: color .15s;
}
.bottom-tab span:first-child { font-size: 1.3rem; }
.bottom-tab.active { color: var(--green-dark); }
.bottom-tab:active { background: var(--gray-50); }

/* ── Page content ─────────────────────────────────────── */
#page-content {
  margin-top: var(--nav-h);
  margin-bottom: var(--bottom-h);
  padding: 1rem;
  min-height: calc(100vh - var(--nav-h) - var(--bottom-h));
}
.page { display: none; }
.page.active { display: block; }
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.page-header h2 { font-size: 1.2rem; font-weight: 700; color: var(--green-dark); }

/* ── Cards ────────────────────────────────────────────── */
.card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
  margin-bottom: .75rem;
}
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; color: var(--green-dark); }

/* ── Stats grid ───────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }
.stat-card {
  background: white; border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--shadow);
  border-left: 4px solid var(--green); text-align: center;
}
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--green-dark); }
.stat-label { font-size: .75rem; color: var(--gray-600); margin-top: .2rem; }

/* ── Action grid ──────────────────────────────────────── */
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.action-btn {
  display: flex; flex-direction: column; align-items: center; gap: .4rem;
  padding: 1rem .5rem; background: var(--gray-50);
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  cursor: pointer; font-size: .85rem; color: var(--gray-800);
  transition: all .15s;
}
.action-btn:active { background: var(--gray-100); transform: scale(.97); }
.action-btn span:first-child { font-size: 1.5rem; }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border: none; border-radius: 8px;
  cursor: pointer; font-size: .9rem; font-weight: 500;
  transition: opacity .15s, transform .1s;
  min-height: 42px;
}
.btn:active { transform: scale(.97); }
.btn-primary   { background: var(--green); color: white; }
.btn-secondary { background: var(--gray-200); color: var(--gray-800); }
.btn-danger    { background: var(--red); color: white; }
.btn-warning   { background: var(--yellow); color: var(--gray-800); }
.btn-sm { padding: .35rem .75rem; font-size: .82rem; min-height: 34px; }
.btn-full { width: 100%; }

/* ── Forms ────────────────────────────────────────────── */
.form-group { margin-bottom: .85rem; }
.form-group label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .3rem; color: var(--gray-600); }
.form-control {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 1rem; background: white;
  -webkit-appearance: none;
  transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(46,125,50,.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.date-picker { width: auto; font-size: .85rem; padding: .4rem .6rem; }
.checkbox-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.checkbox-grid label { display: flex; align-items: center; gap: .3rem; font-size: .85rem; }

/* ── Court grid ───────────────────────────────────────── */
.court-grid { display: flex; flex-direction: column; gap: .75rem; }
.court-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.court-card-header {
  background: var(--green-dark); color: white;
  padding: .75rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
}
.court-card-header h3 { font-size: 1rem; }
.court-card-header span { font-size: .8rem; opacity: .8; }
.slots-grid { padding: .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.time-slot {
  padding: .5rem; border-radius: 6px;
  text-align: center; font-size: .8rem; font-weight: 500;
  cursor: pointer; transition: all .15s;
  border: 1.5px solid transparent;
}
.time-slot.available { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.time-slot.available:active { background: #dcfce7; transform: scale(.97); }
.time-slot.booked    { background: #fef2f2; color: #991b1b; border-color: #fecaca; cursor: default; }
.time-slot.selected  { background: var(--green); color: white; border-color: var(--green-dark); }

/* ── Reservations list ────────────────────────────────── */
.res-list { display: flex; flex-direction: column; gap: .6rem; }
.res-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
  border-left: 4px solid var(--green);
}
.res-card.cancelled { border-left-color: var(--gray-400); opacity: .7; }
.res-card.no-show   { border-left-color: var(--red); }
.res-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: .4rem; }
.res-card-title  { font-weight: 600; font-size: .95rem; }
.res-card-meta   { font-size: .82rem; color: var(--gray-600); }
.res-card-actions { display: flex; gap: .5rem; margin-top: .75rem; }

/* ── POS ──────────────────────────────────────────────── */
.pos-menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding-bottom: 80px; }
.pos-item {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: .85rem;
  cursor: pointer; text-align: center;
  transition: all .15s; border: 1.5px solid transparent;
}
.pos-item:active { transform: scale(.96); border-color: var(--green); }
.pos-item-emoji { font-size: 1.5rem; margin-bottom: .3rem; }
.pos-item-name  { font-size: .82rem; font-weight: 500; margin-bottom: .2rem; }
.pos-item-price { font-size: .95rem; font-weight: 700; color: var(--green-dark); }
.cart-bar {
  position: fixed; bottom: calc(var(--bottom-h) + .5rem);
  left: 1rem; right: 1rem;
  background: var(--green-dark); color: white;
  border-radius: 10px; padding: .85rem 1.2rem;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow-md); cursor: pointer;
  font-size: .9rem; font-weight: 500;
}
.cart-item { display: flex; justify-content: space-between; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--gray-100); font-size: .88rem; }
.cart-total-row { display: flex; justify-content: space-between; padding: .5rem 0; font-size: .9rem; }
.cart-total-row.grand { font-weight: 700; font-size: 1rem; color: var(--green-dark); }

/* ── Members list ─────────────────────────────────────── */
.members-list { display: flex; flex-direction: column; gap: .6rem; }
.member-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
  display: flex; justify-content: space-between; align-items: center;
}
.member-card-info { flex: 1; }
.member-card-name { font-weight: 600; font-size: .95rem; }
.member-card-meta { font-size: .8rem; color: var(--gray-600); margin-top: .15rem; }
.member-card-actions { display: flex; gap: .4rem; }

/* ── Pricing list ─────────────────────────────────────── */
.pricing-list { display: flex; flex-direction: column; gap: .6rem; }
.pricing-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
}
.pricing-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.pricing-card-name   { font-weight: 600; }
.pricing-card-rate   { font-size: 1.1rem; font-weight: 700; color: var(--green-dark); }
.pricing-card-meta   { font-size: .8rem; color: var(--gray-600); }

/* ── Menu admin list ──────────────────────────────────── */
.menu-admin-list { display: flex; flex-direction: column; gap: .6rem; }
.menu-admin-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem;
  display: flex; justify-content: space-between; align-items: center;
}
.menu-admin-info { flex: 1; }
.menu-admin-name { font-weight: 600; font-size: .9rem; }
.menu-admin-meta { font-size: .78rem; color: var(--gray-600); margin-top: .1rem; }

/* ── Badges ───────────────────────────────────────────── */
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 99px; font-size: .72rem; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: var(--gray-100); color: var(--gray-600); }
.badge-blue   { background: #dbeafe; color: #1e40af; }

/* ── Modal ────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 300;
  align-items: flex-end; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white;
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.25rem; width: 100%;
  max-height: 90vh; overflow-y: auto;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal-title  { font-size: 1.05rem; font-weight: 700; }
.modal-close  { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--gray-400); padding: .2rem; }
.modal-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.modal-actions .btn { flex: 1; }
.price-summary {
  display: flex; gap: 1rem;
  background: var(--gray-50); border-radius: 8px;
  padding: .75rem; margin-bottom: 1rem;
}
.price-summary > div { flex: 1; text-align: center; }
.price-summary strong { display: block; font-size: 1.1rem; color: var(--green-dark); }

/* ── Tabs ─────────────────────────────────────────────── */
.tabs { display: flex; gap: .25rem; overflow-x: auto; padding-bottom: .5rem; margin-bottom: .75rem; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: .4rem .85rem; background: var(--gray-100);
  border: none; border-radius: 99px; cursor: pointer;
  font-size: .82rem; white-space: nowrap; color: var(--gray-600);
}
.tab.active { background: var(--green-dark); color: white; }

/* ── Toast ────────────────────────────────────────────── */
#toast-container { position: fixed; top: calc(var(--nav-h) + .5rem); left: 1rem; right: 1rem; z-index: 999; display: flex; flex-direction: column; gap: .4rem; }
.toast {
  background: var(--gray-800); color: white;
  padding: .75rem 1rem; border-radius: 8px;
  font-size: .88rem; box-shadow: var(--shadow-md);
  animation: slideDown .2s ease;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── Misc ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--gray-400); font-size: .9rem; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: .75rem 0; }
.text-sm   { font-size: .85rem; }
.text-gray { color: var(--gray-600); }
.text-green { color: var(--green-dark); }
.text-red   { color: var(--red); }
.fw-600 { font-weight: 600; }
.mt-1 { margin-top: .5rem; }

/* ── Tablet/Desktop adjustments ───────────────────────── */
@media (min-width: 640px) {
  .pos-menu-grid   { grid-template-columns: repeat(3, 1fr); }
  .stats-grid      { grid-template-columns: repeat(3, 1fr); }
  .slots-grid      { grid-template-columns: repeat(4, 1fr); }
  .court-grid      { display: grid; grid-template-columns: 1fr 1fr; }
  .modal { border-radius: var(--radius); max-width: 520px; margin: auto; }
  .modal-overlay { align-items: center; }
}
@media (min-width: 1024px) {
  #page-content  { max-width: 960px; margin: var(--nav-h) auto 0; padding: 1.5rem; }
  .pos-menu-grid { grid-template-columns: repeat(4, 1fr); }
  .court-grid    { grid-template-columns: repeat(3, 1fr); }
}
