/* =====================================================
   Labyrinth BJJ — Member Portal
   Mobile-first, dark theme
   ===================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:          #0A0A0A;
  --surface-1:   #111111;
  --surface-2:   #1A1A1A;
  --border:      #222222;
  --border-soft: #2A2A2A;
  --gold:        #C8A24C;
  --gold-dim:    rgba(200, 162, 76, 0.15);
  --gold-hover:  #D4B06A;
  --text:        #F0F0F0;
  --text-muted:  #888888;
  --text-faint:  #555555;
  --danger:      #E05555;
  --success:     #4CAF80;
  --radius-sm:   8px;
  --radius-md:   12px;
  --radius-lg:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --transition:  0.18s ease;
  --max-w:       480px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'General Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  min-height: 100vh;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: 'Clash Display', 'General Sans', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

p { color: var(--text); }

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--gold-hover); }

/* --- Layout Shell --- */
.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px 48px;
  min-height: 100vh;
}

.page-centered {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px 48px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- Logo / Brand Mark --- */
.logo-block {
  text-align: center;
  padding: 48px 0 32px;
}

.logo-svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  display: block;
}

.logo-name {
  font-family: 'Clash Display', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-transform: uppercase;
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* --- Cards --- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.card-row:last-child { border-bottom: none; }

.card-row-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 12px;
}

.card-row-value {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  text-align: right;
}

/* --- Belt Dot --- */
.belt-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
  flex-shrink: 0;
}

.belt-white    { background: #F0F0F0; }
.belt-blue     { background: #3B6FD8; }
.belt-purple   { background: #8B4FBF; }
.belt-brown    { background: #8B5E3C; }
.belt-black    { background: #333; border: 1px solid #666; }

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

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 7px;
  text-transform: uppercase;
}

.form-input {
  width: 100%;
  height: 52px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'General Sans', sans-serif;
  font-size: 1rem;
  padding: 0 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

.form-input::placeholder {
  color: var(--text-faint);
}

.form-input[readonly],
.form-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 52px;
  padding: 0 24px;
  border-radius: var(--radius-sm);
  font-family: 'General Sans', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--transition), opacity var(--transition), transform var(--transition);
  -webkit-appearance: none;
  appearance: none;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--gold);
  color: #0A0A0A;
  width: 100%;
}
.btn-primary:hover { background: var(--gold-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  width: 100%;
}
.btn-secondary:hover { background: #222; }

.btn-ghost {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border);
  height: 40px;
  padding: 0 16px;
  font-size: 0.875rem;
}
.btn-ghost:hover { border-color: var(--gold); background: var(--gold-dim); }

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 0.8125rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* --- Loading spinner in button --- */
.btn-loading {
  position: relative;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
}

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

/* --- Link button (text only) --- */
.btn-link {
  background: none;
  border: none;
  color: var(--gold);
  font-family: 'General Sans', sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color var(--transition);
}
.btn-link:hover { color: var(--gold-hover); }

/* --- Page header (dashboard) --- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.page-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header-logo {
  width: 32px;
  height: 32px;
}

.page-title {
  font-family: 'Clash Display', sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text);
}

.page-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* --- Section heading --- */
.section-heading {
  font-family: 'Clash Display', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* --- Status badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background: rgba(76, 175, 128, 0.15);
  color: var(--success);
}

.badge-warning {
  background: rgba(224, 130, 40, 0.15);
  color: #E08228;
}

.badge-gold {
  background: var(--gold-dim);
  color: var(--gold);
}

/* --- Status row (waiver, card) --- */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.status-text {
  font-size: 0.9375rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* --- Inline edit --- */
.inline-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}

.inline-edit-input {
  flex: 1;
  max-width: 180px;
  height: 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'General Sans', sans-serif;
  font-size: 0.875rem;
  padding: 0 10px;
  transition: border-color var(--transition);
}
.inline-edit-input:focus {
  outline: none;
  border-color: var(--gold);
}

/* --- Info block (gym info) --- */
.info-block {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.info-item:last-child { border-bottom: none; }

.info-icon {
  color: var(--gold);
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.info-label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.info-value {
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* =====================================================
   WAIVER PAGE
   ===================================================== */

.waiver-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.waiver-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color var(--transition);
}
.waiver-back-btn:hover { color: var(--text); }

.waiver-text-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 20px;
  -webkit-overflow-scrolling: touch;
}

.waiver-text-box::-webkit-scrollbar {
  width: 4px;
}
.waiver-text-box::-webkit-scrollbar-track {
  background: var(--surface-1);
}
.waiver-text-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.waiver-text-box h4 {
  font-size: 0.875rem;
  margin-bottom: 8px;
  color: var(--text);
}

.waiver-text-box p {
  margin-bottom: 10px;
  color: var(--text-muted);
}

.sig-section {
  margin-bottom: 20px;
}

.sig-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.sig-canvas-wrap {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
}

#sigCanvas {
  display: block;
  width: 100%;
  height: 150px;
  touch-action: none;
  cursor: crosshair;
}

.sig-clear-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(10,10,10,0.75);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: 'General Sans', sans-serif;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: color var(--transition);
}
.sig-clear-btn:hover { color: var(--text); }

.sig-hint {
  font-size: 0.75rem;
  color: var(--text-faint);
  text-align: center;
  margin-top: 6px;
}

/* =====================================================
   TOAST NOTIFICATIONS
   ===================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 440px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.25s ease forwards;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.toast-success {
  border-color: var(--success);
  background: rgba(76, 175, 128, 0.12);
  color: var(--success);
}

.toast.toast-error {
  border-color: var(--danger);
  background: rgba(224, 85, 85, 0.12);
  color: var(--danger);
}

.toast.toast-info {
  border-color: var(--gold);
  background: var(--gold-dim);
  color: var(--gold);
}

.toast.toast-out {
  animation: toastOut 0.2s ease forwards;
}

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

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

/* =====================================================
   SKELETON LOADING
   ===================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--surface-1) 25%, var(--surface-2) 50%, var(--surface-1) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

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

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

/* =====================================================
   SETUP / SUCCESS STATES
   ===================================================== */

.success-icon {
  width: 64px;
  height: 64px;
  background: rgba(76, 175, 128, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 1.75rem;
}

.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.mb-4        { margin-bottom: 16px; }
.mb-6        { margin-bottom: 24px; }
.mb-8        { margin-bottom: 32px; }

/* =====================================================
   SCROLLBAR (desktop)
   ===================================================== */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* =====================================================
   FOOTER
   ===================================================== */

.site-footer {
  text-align: center;
  padding: 24px 0 16px;
  margin-top: 8px;
}

.site-footer a {
  font-size: 0.75rem;
  color: var(--text-faint);
}
.site-footer a:hover { color: var(--text-muted); }

/* =====================================================
   RESPONSIVE — larger phones & small tablets
   ===================================================== */

@media (min-width: 480px) {
  .page, .page-centered {
    padding-left: 24px;
    padding-right: 24px;
  }
}
