/* ============================================================
   ESS Fitness Center - styles
   ============================================================ */
:root {
  --brand: #d62828;
  --brand-dark: #a4161a;
  --ink: #1b1b1f;
  --muted: #6b6b76;
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e4e6eb;
  --ok: #1a936f;
  --warn: #e9c46a;
  --bad: #d62828;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(20, 20, 35, 0.07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Segoe UI', 'Noto Sans Thai', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

/* ---------- navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: #14141a;
  color: #fff;
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  letter-spacing: .3px;
}
.nav-brand-mark {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  padding: 3px 8px;
  font-size: .85rem;
}
.nav-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav-links a, .btn-link {
  color: #e9e9ef;
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: .95rem;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-links a:hover, .btn-link:hover { background: rgba(255,255,255,.1); }
.nav-links .nav-active { background: rgba(255,255,255,.14); color: #fff; }
.nav-cta { color: #fff !important; }
.nav-cta-solid { background: var(--brand); }
.nav-cta-solid:hover { background: var(--brand-dark); }

/* ---------- hero ---------- */
.hero {
  background:
    linear-gradient(120deg, rgba(20,20,26,.88), rgba(20,20,26,.55)),
    radial-gradient(circle at 80% 20%, #3a1618, transparent 55%),
    #14141a;
  color: #fff;
  padding: 84px 24px 96px;
  text-align: center;
}
.hero h1 { font-size: 2.6rem; margin: 0 0 10px; }
.hero-sub { max-width: 620px; margin: 0 auto 26px; color: #d5d5de; font-size: 1.05rem; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- sections ---------- */
.section { padding: 56px 24px; }
.section-title { text-align: center; margin: 8px 0 4px; font-size: 1.7rem; }
.section-sub { text-align: center; color: var(--muted); margin: 0 0 28px; }
.container { max-width: 1000px; margin: 0 auto; padding: 40px 20px 64px; }
.container.narrow { max-width: 640px; }

/* ---------- features ---------- */
.features { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.feature {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  max-width: 300px;
  text-align: center;
  box-shadow: var(--shadow);
}
.feature-icon { font-size: 2rem; }
.feature h3 { margin: 8px 0 6px; }
.feature p { color: var(--muted); margin: 0; }

/* ---------- cards / grid ---------- */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-title { margin: 0 0 14px; font-size: 1.15rem; }
.package-card { display: flex; flex-direction: column; gap: 6px; }
.package-card-center { max-width: 420px; margin: 0 auto; text-align: center; }
.package-desc { color: var(--muted); margin: 0; flex: 1; }
.package-price { font-size: 2rem; font-weight: 800; margin: 6px 0; }
.package-price .currency { font-size: 1.2rem; color: var(--brand); }
.package-duration { color: var(--muted); margin: 0 0 10px; }
.packages-grid .btn { margin-top: auto; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: .95rem;
  border-radius: 10px;
  padding: 10px 18px;
  transition: background .15s, transform .05s;
  text-decoration: none;
  text-align: center;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-outline { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger-outline { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.btn-danger-outline:hover { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 13px 26px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.text-center { text-align: center; }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 62vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-title { margin: 0 0 6px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); }
.auth-switch a { color: var(--brand); text-decoration: none; font-weight: 600; }

/* ---------- forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: .95rem;
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid rgba(214,40,40,.35);
  border-color: var(--brand);
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }
.check-field label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.check-field input { width: auto; }
.form-error { color: var(--bad); font-size: .9rem; min-height: 1.1em; margin: 0 0 8px; }

/* ---------- profile ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.profile-list { margin: 0; }
.profile-list dt { color: var(--muted); font-size: .85rem; font-weight: 600; margin-top: 10px; }
.profile-list dd { margin: 2px 0 0; }
.sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.sub-row:last-child { border-bottom: none; }
.sub-right { text-align: right; }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-pending { background: #fff3cd; color: #7a5c00; }
.badge-active { background: #d7f2e7; color: #0c6b4f; }
.badge-rejected { background: #fddcdc; color: #8f1010; }
.badge-expired { background: #e6e6ea; color: #55555f; }

/* ---------- payment ---------- */
.qr-box { text-align: center; margin: 18px 0; }
#qr-canvas { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: #fff; }
.qr-hint { font-weight: 700; color: var(--brand); }
.slip-preview { margin: 12px 0; }
.slip-img {
  max-width: 320px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: block;
  margin: 0 auto;
}

/* ---------- admin ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat { text-align: center; padding: 18px; }
.stat-num { font-size: 1.9rem; font-weight: 800; color: var(--brand); }
.stat-label { color: var(--muted); font-size: .9rem; }

.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tab-btn {
  border: none;
  background: none;
  padding: 10px 16px;
  font-family: inherit;
  font-size: .95rem;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.tab-active { color: var(--brand); font-weight: 700; border-bottom-color: var(--brand); }
.tab-pane { display: none; }
.tab-pane.tab-show { display: block; }

.pane-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; flex-wrap: wrap; }
.pane-head h2 { margin: 0; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.table th { background: #f0f1f4; }
.table tr:last-child td { border-bottom: none; }
.row-actions { white-space: nowrap; }

.admin-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px;
  margin-bottom: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.admin-sub-info { display: flex; flex-direction: column; gap: 2px; }
.admin-sub-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,15,25,.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal.modal-show { display: flex; }
.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 100%;
  max-width: 460px;
  padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-box-slip { max-width: 560px; text-align: center; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.modal-close { border: none; background: none; font-size: 1.1rem; cursor: pointer; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.slip-modal-img { max-width: 100%; border-radius: 8px; }

/* ---------- toast ---------- */
.toast-box {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
}
.toast {
  background: #14141a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .92rem;
  box-shadow: var(--shadow);
  animation: toastIn .18s ease-out;
  border-left: 4px solid #888;
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--bad); }
.toast-hide { opacity: 0; transition: opacity .3s; }
@keyframes toastIn { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- footer / misc ---------- */
.footer { text-align: center; color: var(--muted); padding: 26px 16px; border-top: 1px solid var(--line); font-size: .9rem; }
.muted { color: var(--muted); }
a { color: var(--brand); }

@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .navbar { flex-direction: column; align-items: flex-start; }
  .field-row { flex-direction: column; gap: 0; }
}