/* ============================================================
   LOCKEDFANS APP — STYLES
   ============================================================ */

:root {
  --bg: #050505;
  --panel: #0d0d0d;
  --line: rgba(255,255,255,0.06);
  --text: #f9f9f9;
  --muted: #888;
  --gold: #d4af37;
  --gold-dim: rgba(212,175,55,0.15);
  --green: #49d17c;
  --red: #ff6b6b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; position: relative; }

/* ---- SCREENS ---- */
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
  padding-bottom: 80px;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: block; }
.screen::-webkit-scrollbar { display: none; }

/* ---- LOADING ---- */
.loading-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s;
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.loading-spinner {
  width: 32px; height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- INPUTS ---- */
.input {
  width: 100%;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  margin-bottom: 12px;
  transition: 0.2s;
}
.input:focus { border-color: var(--gold); }
.input::placeholder { color: #555; }

/* ---- BUTTONS ---- */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: 0.2s;
}
.btn-primary:hover { background: #e6c243; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-outline {
  padding: 14px;
  background: transparent;
  color: var(--gold);
  border: 1px solid rgba(212,175,55,0.4);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: 0.2s;
}
.btn-outline:hover { background: rgba(212,175,55,0.1); }

/* ---- AUTH ---- */
/* ---- AUTH & SPLASH ---- */
.splash-container {
  max-width: 360px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.splash-top { text-align: center; margin-bottom: 40px; }
.splash-logo { height: 56px; width: auto; margin-bottom: 16px; }
.splash-tagline {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: rgba(255,255,255,0.6);
  line-height: 1.5;
  font-style: italic;
}
.splash-features { margin-bottom: 40px; }
.splash-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.splash-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.splash-feature-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.splash-feature-desc {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
}
.splash-buttons { margin-bottom: 24px; }
.splash-footer {
  text-align: center;
  font-size: 11px;
  color: #444;
  letter-spacing: 0.5px;
}

.auth-container {
  max-width: 360px;
  margin: 0 auto;
  padding: 80px 24px 40px;
  text-align: center;
}
.auth-logo { margin-bottom: 16px; }
.auth-logo-img { height: 48px; width: auto; }
.auth-title {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  color: var(--text);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.auth-title span { color: var(--gold); }
.auth-sub {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 36px;
}
.auth-switch {
  margin-top: 20px;
  font-size: 13px;
  color: var(--muted);
}
.auth-switch a {
  color: var(--gold);
  cursor: pointer;
  text-decoration: none;
}
.auth-error {
  margin-top: 16px;
  font-size: 13px;
  color: var(--red);
  min-height: 20px;
}
.verify-intro {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  line-height: 1.5;
}
.verify-success { color: var(--green); }
.verify-status {
  margin-top: 12px;
  font-size: 13px;
  min-height: 20px;
  text-align: center;
}
.verify-status.error { color: var(--red); }
.verify-status.success { color: var(--green); }

/* ---- HEADER ---- */
.app-header {
  padding: 16px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-logo {
  display: flex;
  align-items: center;
}
.app-logo span { color: var(--gold); }
.header-logo-img { height: 28px; width: auto; }
.app-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid rgba(212,175,55,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--gold);
  cursor: pointer;
}
.header-title {
  font-size: 14px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
}
.back-btn { cursor: pointer; }

/* ---- COMMON ---- */
.section-pad { padding: 0 24px; }
.gold { color: var(--gold); }
.green { color: var(--green); }

/* ---- STATS GRID ---- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 0 24px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.stat-val { font-size: 22px; font-weight: 600; margin-bottom: 2px; }
.stat-lbl { font-size: 9px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- EMPTY STATE ---- */
.empty-state { text-align: center; padding: 40px 32px; }
.empty-lock {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.15);
  display: flex; align-items: center; justify-content: center;
}
.empty-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px; color: var(--text);
  margin-bottom: 8px;
}
.empty-sub { font-size: 13px; color: #666; line-height: 1.6; margin-bottom: 28px; }

/* ---- START SESSION ---- */
.start-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px; color: var(--text);
  text-align: center; margin-bottom: 8px;
}
.start-sub {
  font-size: 13px; color: #666;
  text-align: center; margin-bottom: 32px;
}
.duration-picker {
  display: flex; gap: 12px;
  justify-content: center; margin-bottom: 32px;
}
.dur-col { text-align: center; }
.dur-col label {
  font-size: 10px; color: #666;
  text-transform: uppercase; letter-spacing: 1px;
  display: block; margin-bottom: 6px;
}
.dur-input {
  width: 90px; height: 72px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 32px; font-weight: 300;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.dur-input:focus { border-color: var(--gold); }

.option-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.option-label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 10px;
}
.freq-options { display: flex; gap: 8px; }
.freq-btn {
  flex: 1; padding: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted); font-size: 13px;
  font-weight: 500; text-align: center;
  cursor: pointer; transition: 0.2s;
  font-family: 'DM Sans', sans-serif;
}
.freq-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(212,175,55,0.08);
}
.lock-warning {
  font-size: 12px; color: #555;
  text-align: center; margin-top: 12px;
  line-height: 1.5;
}

/* ---- ACTIVE SESSION ---- */
.session-hero { text-align: center; padding: 24px 24px 20px; }
.session-status { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.s-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(73,209,124,0.5);
}
.s-text {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 2px; color: var(--green); font-weight: 600;
}
.timer-display {
  font-size: 44px; font-weight: 300;
  color: var(--text); letter-spacing: 2px; margin-bottom: 4px;
}
.timer-sub {
  font-size: 10px; color: rgba(255,255,255,0.45);
  text-transform: uppercase; letter-spacing: 2px;
  margin-bottom: 20px; font-weight: 500;
}

.progress-wrap { padding: 0 40px; margin-bottom: 6px; }
.progress-bar-bg {
  height: 4px; background: var(--line);
  border-radius: 2px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #d4af37, #e6c243);
  border-radius: 2px; transition: width 1s;
}
.progress-labels {
  display: flex; justify-content: space-between;
  padding: 0 40px; margin-bottom: 28px;
}
.progress-labels span { font-size: 10px; color: #555; }

.session-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 0 24px; margin-bottom: 20px;
}
.ss-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px; text-align: center;
}
.ss-val { font-size: 28px; font-weight: 600; margin-bottom: 2px; }
.ss-lbl { font-size: 9px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }

/* ---- CHECK-IN ---- */
.checkin-card {
  margin: 0 24px 16px;
  background: var(--panel);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 14px;
  padding: 18px;
}
.checkin-top {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 14px;
}
.checkin-title {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); font-weight: 500;
}
.checkin-due { font-size: 12px; color: var(--gold); font-weight: 600; }
.checkin-btn {
  width: 100%; padding: 14px;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.3);
  border-radius: 10px;
  color: var(--gold); font-size: 14px;
  font-weight: 600; text-align: center;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  transition: 0.2s;
}
.checkin-btn:hover { background: rgba(212,175,55,0.2); }

.checkin-screen-content { text-align: center; padding: 40px 24px; }

.share-btn-wrap { padding: 0 24px; margin-bottom: 16px; }
.share-btn {
  width: 100%; padding: 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted); font-size: 13px;
  font-weight: 500; text-align: center;
  cursor: pointer; font-family: 'DM Sans', sans-serif;
  display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.end-session-link { text-align: center; padding: 12px; }
.end-session-link a {
  font-size: 12px; color: #444;
  text-decoration: none; cursor: pointer;
}

/* ---- CAGE CHECK CARD ---- */
.card-preview {
  position: relative; width: 100%;
  aspect-ratio: 4/5;
  background: #0a0a0a;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.card-photo {
  position: absolute; inset: 0;
  background: #111;
  display: flex; align-items: center; justify-content: center;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo-placeholder { text-align: center; color: #444; cursor: pointer; }
.card-photo-placeholder svg { margin-bottom: 8px; opacity: 0.4; }
.card-photo-placeholder p { font-size: 12px; }

.card-watermark {
  position: absolute; top: 16px; right: 16px;
  display: flex; align-items: center; gap: 5px;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  padding: 5px 10px 5px 8px; border-radius: 20px; z-index: 5;
}
.card-watermark span { font-size: 11px; color: #fff; font-weight: 500; letter-spacing: 0.3px; }

.card-gradient {
  position: absolute; bottom: 0; left: 0; right: 0; height: 55%;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.5) 45%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 20px 22px 22px; pointer-events: none;
}
.card-status-row { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.card-stats-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; }
.card-timer { font-size: 30px; font-weight: 300; color: #fff; letter-spacing: 1px; line-height: 1; }
.card-timer-label { font-size: 9px; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; font-weight: 500; }
.card-streak { text-align: right; }
.card-streak-val { font-size: 24px; font-weight: 600; color: var(--gold); line-height: 1; }
.card-streak-label { font-size: 9px; color: rgba(255,255,255,0.55); text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; font-weight: 500; }
.card-progress { width: 100%; height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px; overflow: hidden; }
.card-progress-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #d4af37, #e6c243); border-radius: 2px; }

/* ---- HISTORY ---- */
.history-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px; color: var(--text);
  padding: 16px 24px;
}
.history-item {
  margin: 0 24px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex; align-items: center;
  justify-content: space-between;
}
.hi-left { flex: 1; }
.hi-duration { font-size: 16px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.hi-date { font-size: 11px; color: #666; }
.hi-right { text-align: right; }
.hi-status {
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 20px;
  display: inline-block; margin-bottom: 4px;
}
.hi-status.completed { background: rgba(73,209,124,0.1); color: var(--green); }
.hi-status.early { background: rgba(255,107,107,0.1); color: var(--red); }
.hi-checkins { font-size: 10px; color: #555; }

/* ---- PROFILE ---- */
.profile-header { text-align: center; padding: 24px 24px 20px; }
.profile-avatar-wrap {
  position: relative;
  width: 80px; height: 80px;
  margin: 0 auto 12px;
  cursor: pointer;
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(212,175,55,0.12);
  border: 2px solid rgba(212,175,55,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 600; color: var(--gold);
}
.profile-avatar-img {
  position: absolute; inset: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(212,175,55,0.3);
}
.avatar-edit-badge {
  position: absolute;
  bottom: 0; right: 0;
  width: 28px; height: 28px;
  background: var(--gold);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg);
}
.profile-name {
  font-family: 'Playfair Display', serif;
  font-size: 22px; color: var(--text); margin-bottom: 4px;
}
.profile-handle { font-size: 13px; color: #666; margin-bottom: 16px; }
.profile-url {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: rgba(212,175,55,0.08);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 20px;
  font-size: 11px; color: var(--gold);
}

.profile-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 1px; background: var(--line);
  border-radius: 12px; overflow: hidden;
  margin: 0 24px 24px;
}
.ps-item { background: var(--panel); padding: 16px 8px; text-align: center; }
.ps-val { font-size: 24px; font-weight: 600; color: var(--gold); margin-bottom: 2px; }
.ps-lbl { font-size: 9px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }

.profile-link {
  margin: 0 24px 12px;
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text); font-size: 14px;
  cursor: pointer;
}
.profile-link .arrow { color: #444; font-size: 16px; }

.edit-name-row {
  margin: 0 24px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---- NAV BAR ---- */
.nav-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: rgba(10,10,10,0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  display: flex; align-items: center;
  justify-content: space-around;
  padding: 0 20px;
  z-index: 50;
}
.nav-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  cursor: pointer; opacity: 0.4; transition: 0.2s;
}
.nav-item.active { opacity: 1; }
.nav-item svg { width: 22px; height: 22px; }
.nav-label { font-size: 9px; color: var(--muted); letter-spacing: 0.3px; }
.nav-item.active .nav-label { color: var(--gold); }

/* ---- SAFE AREA (iOS) ---- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .nav-bar { padding-bottom: env(safe-area-inset-bottom); height: calc(64px + env(safe-area-inset-bottom)); }
  .screen { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}
