/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', -apple-system, sans-serif; -webkit-font-smoothing: antialiased; background: #0B0B2B; }
input, button { font-family: inherit; outline: none; }
a { text-decoration: none; color: inherit; }

/* ===== SCREENS ===== */
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; }

/* ===== LOGIN ===== */
#login-screen {
  background: #0B0B2B;
  justify-content: center;
  align-items: center;
  padding: 20px;
  flex-direction: column;
}
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.logo-img {
  height: 72px;
  width: auto;
  object-fit: contain;
}
.logo-img.small { height: 48px; }
.login-subtitle {
  color: #888;
  font-size: 16px;
  margin-top: -8px;
}
.login-input {
  width: 100%;
  background: #1A1A2E;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  padding: 16px 24px;
  color: #fff;
  font-size: 18px;
  text-align: center;
  letter-spacing: 1px;
  transition: border-color 0.2s;
}
.login-input:focus { border-color: #FF6B00; }
.login-input::placeholder { color: #555; }
.login-btn {
  width: 100%;
  background: #FF6B00;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.login-btn:active { opacity: 0.85; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-error {
  color: #F44336;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}
.login-footer {
  margin-top: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legal-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.legal-links a {
  color: #888;
  font-size: 12px;
  transition: color 0.2s;
}
.legal-links a:hover { color: #aaa; }

/* ===== DASHBOARD ===== */
#dashboard-screen {
  background: #0B0B2B;
  flex-direction: column;
  align-items: center;
}
.dashboard-wrap {
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */
.dash-header {
  text-align: center;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dash-phone {
  color: #888;
  font-size: 14px;
  margin-top: 4px;
}

/* Buttons */
.dash-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
}
.dash-btn {
  background: #141432;
  border: 1.5px solid rgba(255,255,255,0.18);
  border-radius: 50px;
  padding: 16px 24px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}
.dash-btn:active { background: #1c1c4a; }
.dash-btn-row {
  display: flex;
  gap: 12px;
  width: 100%;
}
.dash-btn-row .dash-btn { flex: 1; min-width: 0; }
.dash-btn.green { border-color: #4CAF50; }
.dash-btn.orange { border-color: #FF6B00; }

/* Subscription bar */
.sub-bar {
  width: 100%;
  background: #141432;
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sub-bar:active { background: #1c1c4a; }
.sub-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sub-dot.active { background: #4CAF50; box-shadow: 0 0 8px rgba(76,175,80,0.4); }
.sub-dot.inactive { background: #F44336; }
.sub-info { display: flex; flex-direction: column; gap: 2px; }
.sub-status { font-size: 14px; font-weight: 600; }
.sub-status.active { color: #fff; }
.sub-status.inactive { color: #F44336; }
.sub-days { color: #888; font-size: 12px; }

/* Footer */
.dash-footer {
  text-align: center;
  margin-top: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.dash-full-site {
  color: #aaa;
  font-size: 13px;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 8px 20px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  transition: border-color 0.2s, color 0.2s;
}
.dash-full-site:active { border-color: rgba(255,255,255,0.3); color: #fff; }
.dash-logout {
  color: #999;
  font-size: 12px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dash-copyright {
  color: #777;
  font-size: 11px;
}

/* ===== OVERLAY & POPUPS ===== */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 12px;
  animation: fadeIn 0.15s ease;
}
.popup-overlay.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.popup-modal {
  width: 100%;
  max-width: 420px;
  max-height: 92vh;
  background: #0F0F30;
  border-radius: 16px;
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  animation: slideUp 0.2s ease;
  -webkit-overflow-scrolling: touch;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.popup-modal::-webkit-scrollbar { width: 4px; }
.popup-modal::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

.popup-close {
  position: absolute;
  top: 8px;
  right: 12px;
  color: #888;
  font-size: 28px;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
  padding: 10px;
  -webkit-tap-highlight-color: transparent;
}
.popup-close:hover { color: #fff; }

.popup-title {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  padding-right: 30px;
}
.popup-back {
  color: #888;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 4px;
  padding: 10px 4px;
  display: inline-block;
}
.popup-back:hover { color: #bbb; }

/* ===== CLUB CARDS ===== */
.area-label {
  color: #FF6B00;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
}
.club-list { display: flex; flex-direction: column; gap: 6px; }
.club-card {
  background: #1A1A2E;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 12px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.club-card:active { border-color: #FF6B00; background: #252550; }
.club-card.static { cursor: default; }
.club-card.static:active { background: #1A1A2E; border-color: rgba(255,255,255,0.12); }
.club-name { color: #fff; font-size: 15px; font-weight: 600; }
.club-hours { color: #888; font-size: 13px; margin-top: 2px; }

/* ===== DOOR RESULT ===== */
.door-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
}
.door-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #4CAF50;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 28px;
  color: #fff;
  font-weight: 700;
}
.door-msg { color: #fff; font-size: 20px; font-weight: 700; text-align: center; }
.door-submsg { color: #888; font-size: 14px; text-align: center; }

/* ===== BUTTONS ===== */
.btn-orange {
  background: #FF6B00;
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 14px 28px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-orange:active { opacity: 0.85; }
.btn-orange:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-orange.full { width: 100%; }
.btn-outline {
  background: transparent;
  border: 2px solid #FF6B00;
  color: #FF6B00;
  border-radius: 50px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-outline:active { background: rgba(255,107,0,0.1); }

/* ===== TRAINER ===== */
.trainer-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.trainer-photo {
  width: 100%;
  max-width: 260px;
  border-radius: 16px;
  object-fit: contain;
  background: #1A1A2E;
}
.trainer-name { color: #fff; font-size: 20px; font-weight: 700; text-align: center; }
.trainer-spec { color: #FF6B00; font-size: 14px; text-align: center; }
.trainer-club { color: #666; font-size: 13px; text-align: center; }
.trainer-desc { color: #999; font-size: 13px; text-align: center; line-height: 1.5; max-width: 300px; }
.trainer-tg { color: #FF6B00; font-size: 14px; text-align: center; cursor: pointer; }

/* ===== FORM ELEMENTS ===== */
.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-label { color: #888; font-size: 13px; }
.form-input {
  background: #1A1A2E;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 12px 14px;
  color: #fff;
  font-size: 15px;
  width: 100%;
  transition: border-color 0.2s;
}
.form-input:focus { border-color: #FF6B00; }
.form-input::placeholder { color: #555; }
.form-hint { color: #888; font-size: 11px; }
.form-hint.red { color: #F44336; }

.form-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 1px;
  accent-color: #FF6B00;
  cursor: pointer;
}
.form-checkbox-text { color: #888; font-size: 12px; line-height: 1.4; }
.form-checkbox-text a { color: #FF6B00; text-decoration: underline; }

/* ===== PAYMENT ===== */
.pay-plan-name { color: #fff; font-size: 20px; font-weight: 700; text-align: center; }
.pay-plan-price { color: #FF6B00; font-size: 18px; font-weight: 600; text-align: center; }
.pay-info { color: #888; font-size: 12px; text-align: center; line-height: 1.5; }
.photo-upload-zone {
  width: 160px;
  height: 200px;
  background: #1A1A2E;
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}
.photo-upload-zone:hover { border-color: rgba(255,255,255,0.4); }
.photo-upload-zone.has-photo { border-style: solid; border-color: #4CAF50; }
.photo-upload-zone img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-upload-icon { font-size: 32px; color: #555; z-index: 1; }
.photo-upload-text { color: #888; font-size: 13px; z-index: 1; }
.photo-upload-zone input[type="file"] {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

/* ===== SUBSCRIPTION PICKER ===== */
.subs-grid { display: flex; flex-direction: column; gap: 12px; }
.sub-card {
  background: #1A1A2E;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid rgba(255,255,255,0.12);
  -webkit-tap-highlight-color: transparent;
}
.sub-card:active { background: #252550; border-color: #FF6B00; }
.sub-card-img {
  width: 100%;
  aspect-ratio: 3/1;
  object-fit: cover;
  display: block;
  background: #0F0F30;
}
.sub-card-body {
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sub-card-name { color: #fff; font-size: 15px; font-weight: 600; }
.sub-card-price { color: #FF6B00; font-size: 15px; font-weight: 700; white-space: nowrap; }
/* ===== MAP POPUP (full screen) ===== */
.map-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #0B0B2B;
  z-index: 1000;
  flex-direction: column;
  animation: fadeIn 0.15s ease;
}
.map-overlay.active { display: flex; }
.map-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  flex-shrink: 0;
  background: #0B0B2B;
  z-index: 5;
}
.map-header-title { color: #fff; font-size: 16px; font-weight: 700; }
.map-header-close {
  color: #888;
  font-size: 28px;
  cursor: pointer;
  padding: 10px;
  line-height: 1;
}
.map-header-close:hover { color: #fff; }

#map-container {
  flex: 1;
  width: 100%;
  background: #0F0F30;
  position: relative;
}

/* Map fallback (list view) */
.map-fallback {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px calc(16px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

/* Club card that slides up from bottom over the map */
.map-club-card {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0F0F30;
  border-radius: 16px 16px 0 0;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60%;
  overflow-y: auto;
}
.map-club-card.visible { transform: translateY(0); }
.map-club-card .club-name { font-size: 16px; }
.map-card-close {
  position: absolute;
  top: 8px;
  right: 10px;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 10px;
}
.map-card-btn {
  background: #1A1A2E;
  border: 1.5px solid rgba(255,255,255,0.15);
  border-radius: 50px;
  padding: 14px 20px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  text-align: center;
  cursor: pointer;
  display: block;
  -webkit-tap-highlight-color: transparent;
}
.map-card-btn:active { background: #252550; }

/* ===== PROFILE ===== */
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.profile-label { color: #888; font-size: 14px; }
.profile-value { color: #fff; font-size: 14px; font-weight: 600; }

/* ===== LOADING & TOAST ===== */
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #FF6B00;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 0;
  flex-direction: column;
  gap: 12px;
}
.loading-text { color: #888; font-size: 14px; }

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1A1A2E;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  z-index: 2000;
  transition: transform 0.3s ease;
  max-width: 90%;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.1);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: #F44336; }
