/* ═══════════════════════════════════════════════════════════════
   Pool Register — Shared Design System
   Mobile-first, RTL-ready, minimalist
═══════════════════════════════════════════════════════════════ */

:root {
  --bg:         #f4f6f8;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1a202c;
  --text-muted: #64748b;

  --blue:       #2563eb;
  --blue-dark:  #1d4ed8;
  --green:      #16a34a;
  --green-bg:   #dcfce7;
  --yellow:     #d97706;
  --yellow-bg:  #fef3c7;
  --red:        #dc2626;
  --red-bg:     #fee2e2;
  --orange:     #ea580c;
  --orange-bg:  #ffedd5;
  --gray:       #6b7280;
  --gray-bg:    #f1f5f9;

  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,.10);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  direction: rtl;
}

/* ── Layout ──────────────────────────────────────────────────── */
.app-header {
  background: #0f172a;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.app-header h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.app-header .sub { font-size: .8rem; opacity: .65; margin-top: 1px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

.container { max-width: 680px; margin: 0 auto; padding: 20px 16px 40px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }

/* ── Card ────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font);
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  direction: rtl;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-group input[type="tel"] { direction: ltr; text-align: right; }
.hint { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .1s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--blue);  color: #fff; }
.btn-primary:hover:not(:disabled)  { background: var(--blue-dark); }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled)  { background: #15803d; }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-danger:hover:not(:disabled)   { background: #b91c1c; }
.btn-ghost    { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border); }
.btn-ghost:hover:not(:disabled)    { background: var(--gray-bg); }
.btn-sm       { padding: 6px 12px; font-size: .8rem; }
.btn-full     { width: 100%; }
.btn-icon     { padding: 8px; border-radius: var(--radius-sm); }

/* ── Status Badges ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-registered  { background: var(--yellow-bg); color: var(--yellow); }
.badge-checked_in  { background: var(--green-bg);  color: var(--green); }
.badge-waiting     { background: var(--orange-bg); color: var(--orange); }
.badge-no_show     { background: var(--red-bg);    color: var(--red); }
.badge-cancelled   { background: var(--gray-bg);   color: var(--gray); }

/* ── Stat Grid ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: center;
}
.stat-value { font-size: 1.8rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.red   .stat-value { color: var(--red); }
.stat-card.blue  .stat-value { color: var(--blue); }
.stat-card.orange .stat-value { color: var(--orange); }

/* ── Capacity Bar ────────────────────────────────────────────── */
.capacity-bar { margin: 12px 0; }
.capacity-bar-track {
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.capacity-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--green);
  transition: width .4s ease, background .4s;
}
.capacity-bar-fill.warn { background: var(--yellow); }
.capacity-bar-fill.full { background: var(--red); }
.capacity-bar-label { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }

/* ── Guest List / Table ──────────────────────────────────────── */
.guest-list { display: flex; flex-direction: column; gap: 8px; }
.guest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: box-shadow .15s;
}
.guest-row:hover { box-shadow: var(--shadow-md); }
.guest-row.checked_in { border-right: 3px solid var(--green); }
.guest-row.waiting    { border-right: 3px solid var(--orange); }
.guest-row.no_show    { opacity: .55; }
.guest-row.cancelled  { opacity: .45; }
.guest-info { flex: 1; min-width: 0; }
.guest-name { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guest-meta { font-size: .78rem; color: var(--text-muted); margin-top: 1px; }
.guest-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Search Bar ──────────────────────────────────────────────── */
.search-wrap { position: relative; }
.search-wrap input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  direction: rtl;
}
.search-wrap input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ── Alerts / Toasts ─────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 500;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-success { background: var(--green-bg);  color: var(--green); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-bg);    color: var(--red);   border: 1px solid #fecaca; }
.alert-warning { background: var(--yellow-bg); color: var(--yellow);border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff;          color: var(--blue);  border: 1px solid #bfdbfe; }
.alert.hidden  { display: none; }

/* Toast */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 500;
  z-index: 9999;
  transition: transform .3s ease;
  max-width: 90vw;
  text-align: center;
  white-space: nowrap;
}
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.success { background: #15803d; }
#toast.error   { background: #dc2626; }

/* ── Tabs ────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  font-family: var(--font);
  transition: color .15s;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-md);
}
.modal-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* ── Date Picker ─────────────────────────────────────────────── */
.date-nav {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin-bottom: 16px;
}
.date-nav input[type="date"] {
  flex: 1; border: none; outline: none;
  font-size: .9rem; font-family: var(--font);
  direction: ltr;
}
.date-nav .btn-icon { background: var(--gray-bg); border: none; cursor: pointer; }

/* ── Misc ────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: .9rem; }
.empty-state svg { margin-bottom: 12px; opacity: .4; }
.loading { text-align: center; padding: 24px; color: var(--text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-sm  { font-size: .85rem; }
.text-muted { color: var(--text-muted); }
.font-bold  { font-weight: 700; }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .app-header h1 { font-size: 1rem; }
}
