/**
 * Gym Schedule — shared foundation (tokens, reset, texture, header, auth, buttons)
 */
:root {
  --black: #17171c;
  --dark: #24242b;
  --card: #2c2c34;
  --card2: #33333c;
  --gold: #c9a84c;
  --gold-light: #e8c56a;
  --gold-dim: #b4923f;
  --gold-glow: rgba(201, 168, 76, 0.35);
  --white: #f2efe4;
  --muted: #a8a8b4;
  --muted-light: #c4c4cf;
  --danger: #e74c3c;
  --danger-dim: #c0392b;
  --success: #2ecc71;
  --success-dim: #27ae60;
  --blue: #3498db;
  --orange: #f39c12;
  --border: rgba(201, 168, 76, 0.15);
}

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

html { max-width: 100%; }

body {
  background: var(--black);
  color: var(--white);
  font-family: 'Barlow', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

img, svg, canvas, video { max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201, 168, 76, 0.04) 0%, transparent 60%),
    linear-gradient(rgba(201, 168, 76, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 168, 76, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 50px 50px, 50px 50px;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 120% 60% at 50% 100%, rgba(0, 0, 0, 0.22) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── Connection error ─────────────────────────────────────── */
.conn-error {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  background: rgba(231, 76, 60, 0.15);
  border-bottom: 1px solid rgba(231, 76, 60, 0.3);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--danger);
}

.conn-error.visible { display: flex; }

/* ── Header (member / public) ─────────────────────────────── */
.gym-header,
header.gym-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 40px;
  background: linear-gradient(180deg, rgba(201, 168, 76, 0.07) 0%, rgba(201, 168, 76, 0.02) 60%, rgba(10, 10, 10, 0.98) 100%);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.18);
}

.gym-header::after,
header.gym-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(201, 168, 76, 0.4) 30%, rgba(201, 168, 76, 0.4) 70%, transparent 100%);
}

/* ── Auth (dashboard login) ───────────────────────────────── */
#authPage {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black);
}

.auth-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.auth-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-light), var(--gold), var(--gold-dim));
}

.auth-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2.2rem;
  letter-spacing: 0.12em;
  background: linear-gradient(135deg, #f0d478, var(--gold), var(--gold-dim), var(--gold-light));
  background-size: 200% 100%;
  animation: shimmer 6s ease-in-out infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 6px;
}

.auth-sub {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  color: var(--gold-dim);
  text-transform: uppercase;
  margin-bottom: 32px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s;
}

.auth-tab.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  font-weight: 700;
}

.auth-tab:hover:not(.active) { color: var(--gold); }

.auth-field { margin-bottom: 14px; text-align: left; }

.auth-field label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.auth-field input {
  width: 100%;
  background: var(--dark);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-family: 'Barlow', sans-serif;
  font-size: 0.9rem;
  padding: 11px 14px;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.1);
}

.auth-field-pw { position: relative; }
.auth-field-pw input { padding-right: 44px; }

.pw-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
  line-height: 1;
}

.pw-toggle:hover { color: var(--gold); }

.btn-auth {
  width: 100%;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 12px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  font-weight: 700;
  transition: all 0.3s;
}

.btn-auth:hover {
  box-shadow: 0 4px 16px rgba(201, 168, 76, 0.25);
  transform: translateY(-1px);
}

.btn-auth:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-form { display: none; }
.auth-form.active { display: block; animation: authFadeIn 0.3s ease; }

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-bottom: 14px;
  font-family: 'Barlow Condensed', sans-serif;
  letter-spacing: 0.1em;
  min-height: 18px;
}

.auth-footer a {
  color: var(--gold-dim);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-decoration: none;
}

.auth-footer a:hover { color: var(--gold); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 9px 18px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #000;
  font-weight: 700;
}

.btn-outline {
  background: transparent;
  border: 1px solid rgba(201, 168, 76, 0.3);
  color: var(--gold-dim);
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  z-index: 1000;
  background: var(--card);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 8px;
  padding: 12px 24px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--white);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s ease, opacity 0.35s ease;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.error { border-color: rgba(231, 76, 60, 0.4); color: var(--danger); }
