/* ─── Clinchr Public Website ─── */

:root {
  --bg: #0A0A0A;
  --surface: #141414;
  --surface-alt: #1C1C1C;
  --border: #222;
  --border-light: #2A2A2A;
  --red: #E53935;
  --red-dark: #C62828;
  --blue: #1E88E5;
  --gold: #FFD600;
  --silver: #B0BEC5;
  --bronze: #8D6E63;
  --green: #43A047;
  --err: #EF5350;
  --t1: #FFFFFF;
  --t2: #A0A0A0;
  --t3: #5A5A5A;
  --radius: 10px;
  --radius-sm: 6px;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--t1);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ─── Logo & Brand ─── */

.brand { display: flex; align-items: center; gap: 12px; }

.dash-logo {
  width: 28px;
  height: auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--red);
}

/* ─── Social Links (landing) ─── */

.social-links { display: flex; align-items: center; gap: 16px; }

.social-links a {
  color: var(--t3);
  transition: color .2s;
  display: flex;
  align-items: center;
}
.social-links a:hover { color: var(--t2); }
.social-links svg { width: 18px; height: 18px; }

.app-link {
  font-size: .7rem;
  text-decoration: none;
  color: var(--t3) !important;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.app-link:hover { border-color: var(--t3); color: var(--t2) !important; }

/* ─── Shared Footer ─── */

.footer-links { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.footer-links a { color: var(--t3); text-decoration: none; font-size: .8rem; transition: color .2s; }
.footer-links a:hover { color: var(--t2); }
.footer-sep { color: var(--t3); font-size: .7rem; }

/* ─────────────────────────────
   LANDING VIEW
   ───────────────────────────── */

.landing-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

/* Hero logo centered above title */
.hero-logo {
  width: 64px;
  height: auto;
  display: block;
  margin: 0 auto 12px;
}

.hero .logo {
  display: block;
  margin-bottom: 20px;
}

.landing-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 460px;
  width: 100%;
  text-align: center;
}

/* Hero */
.hero { margin-bottom: 44px; }

.hero-title {
  font-size: 3.25rem;
  font-weight: 700;
  line-height: 1.08;
  margin-bottom: 14px;
  letter-spacing: -1px;
}

.hero-accent { color: var(--red); }

.hero-sub {
  font-size: 1.05rem;
  color: var(--t2);
  line-height: 1.6;
  max-width: 380px;
  margin: 0 auto;
}

/* App Store Buttons */
.app-stores { display: flex; gap: 10px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }

.store-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--t1);
  transition: all .2s;
  min-width: 168px;
}
.store-btn:hover { background: var(--surface-alt); border-color: var(--red); transform: translateY(-1px); }
.store-btn svg { width: 24px; height: 24px; flex-shrink: 0; }
.store-text { display: flex; flex-direction: column; }
.store-small { font-size: .6rem; color: var(--t3); text-transform: uppercase; letter-spacing: .5px; line-height: 1.2; }
.store-name { font-size: 1rem; font-weight: 600; line-height: 1.2; }

/* Code Gate */
.code-gate { text-align: center; }
.code-hint { color: var(--t3); font-size: .8rem; margin-bottom: 10px; }
.code-row { display: flex; gap: 8px; justify-content: center; max-width: 260px; margin: 0 auto; }
.code-row input {
  flex: 1;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--t1);
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  text-align: center;
  letter-spacing: 1px;
  transition: border-color .2s;
}
.code-row input:focus { border-color: var(--t3); }
.code-row button {
  padding: 9px 16px;
  background: var(--surface-alt);
  color: var(--t2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
}
.code-row button:hover { background: var(--border-light); color: var(--t1); }
.error-msg { color: var(--err); font-size: .8rem; margin-top: 8px; min-height: 16px; }

/* Landing Footer */
.landing-footer {
  padding: 20px;
  text-align: center;
  color: var(--t3);
  font-size: .75rem;
  width: 100%;
}

/* ─────────────────────────────
   DASHBOARD VIEW
   ───────────────────────────── */

#dashboard-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Dashboard Header */
.dash-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.dash-tagline {
  color: var(--t2);
  font-size: .875rem;
  font-weight: 400;
  letter-spacing: .5px;
}

.dash-nav {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-social-link {
  color: var(--t3);
  display: flex;
  align-items: center;
  transition: color .2s;
}
.dash-social-link:hover { color: var(--t2); }
.dash-social-link svg { width: 17px; height: 17px; }

.dash-beta {
  font-size: .65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--gold);
  background: rgba(255, 214, 0, .1);
  border: 1px solid rgba(255, 214, 0, .25);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Dashboard Main */
.dash-main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 0;
}

/* ─── Stats Grid ─── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1px;
}

.stat-label {
  font-size: .7rem;
  color: var(--t3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .8px;
}

.stat-value {
  font-family: 'DM Mono', 'SF Mono', 'Consolas', monospace;
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -1px;
  color: var(--t1);
  margin: 2px 0 1px;
}

.stat-period {
  font-size: .65rem;
  color: var(--t3);
  letter-spacing: .2px;
}

/* ─── Dashboard Panels ─── */

.dash-columns {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
}

.dash-panel {
  background: var(--surface);
  padding: 16px 18px;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: -.2px;
}

.panel-meta {
  font-size: .7rem;
  color: var(--t3);
  letter-spacing: .3px;
}

/* ─── Feed ─── */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 300px;
  overflow-y: auto;
}

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.feed-item:hover { background: var(--surface-alt); }

.feed-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-top: 7px;
  flex-shrink: 0;
}
.feed-dot--workout { background: var(--red); }
.feed-dot--gym_join { background: var(--blue); }
.feed-dot--new_member { background: var(--green); }

.feed-content { flex: 1; min-width: 0; }

.feed-text {
  font-size: .875rem;
  line-height: 1.45;
  color: var(--t2);
}
.feed-actor { font-weight: 600; color: var(--t1); }
.feed-highlight { color: var(--red); font-weight: 500; }

.feed-time {
  font-size: .7rem;
  color: var(--t3);
  margin-top: 2px;
  display: block;
}

.empty-state {
  text-align: center;
  color: var(--t3);
  padding: 36px 16px;
  font-size: .85rem;
}

/* ─── Leaderboard ─── */

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 300px;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.leaderboard-row:hover { background: var(--surface-alt); }

.leaderboard-rank {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--t3);
  font-family: 'DM Mono', monospace;
}

.leaderboard-rank-1 .leaderboard-rank { background: var(--gold); color: #000; }
.leaderboard-rank-2 .leaderboard-rank { background: var(--silver); color: #000; }
.leaderboard-rank-3 .leaderboard-rank { background: var(--bronze); color: #fff; }

.leaderboard-info { flex: 1; min-width: 0; }

.leaderboard-name {
  font-size: .875rem;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-detail {
  font-size: .7rem;
  color: var(--t3);
}

.leaderboard-hours {
  font-family: 'DM Mono', monospace;
  font-size: .85rem;
  font-weight: 500;
  color: var(--t1);
  white-space: nowrap;
}

/* ─── CTA Section ─── */

.dash-cta { margin-bottom: 12px; }

.cta-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cta-text h2 { font-size: 1.05rem; font-weight: 600; margin-bottom: 2px; }
.cta-text p { color: var(--t2); font-size: .85rem; }
.cta-inner .app-stores { margin-top: 0; }

/* ─── Partner Bar ─── */

.partner-section { margin-bottom: 0; }

.partner-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
}

.partner-badge {
  font-size: .55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--t3);
  background: var(--surface-alt);
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.partner-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.partner-logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.partner-logo-placeholder { font-size: .4rem; font-weight: 700; letter-spacing: 1px; color: var(--t3); }
.partner-name { font-size: .8rem; font-weight: 600; white-space: nowrap; }
.partner-desc { font-size: .7rem; color: var(--t2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

.partner-link {
  margin-left: auto;
  padding: 5px 14px;
  background: var(--red);
  color: var(--t1);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: .7rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .2s;
  flex-shrink: 0;
}
.partner-link:hover { background: var(--red-dark); }

/* ─── Dashboard Footer ─── */

.dash-footer {
  text-align: center;
  padding: 12px 24px;
  color: var(--t3);
  font-size: .7rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
  padding-top: 32px;
}

/* ─── Skeleton Loading ─── */

.skeleton {
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.03) 50%, transparent 100%);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-num { display: inline-block; width: 60px; height: 28px; }
.skeleton-row { height: 46px; margin-bottom: 2px; }

/* ─── Scrollbars ─── */

.feed-list::-webkit-scrollbar,
.leaderboard-list::-webkit-scrollbar { width: 3px; }

.feed-list::-webkit-scrollbar-track,
.leaderboard-list::-webkit-scrollbar-track { background: transparent; }

.feed-list::-webkit-scrollbar-thumb,
.leaderboard-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.feed-list::-webkit-scrollbar-thumb:hover,
.leaderboard-list::-webkit-scrollbar-thumb:hover { background: var(--t3); }

/* ─────────────────────────────
   LEGAL PAGES (Terms / Privacy)
   ───────────────────────────── */

.legal-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.legal-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.legal-header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 24px;
}

.legal-header .brand {
  text-decoration: none;
  display: inline-flex;
}

.legal-main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 60px;
}

.legal-content h1 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 4px;
}

.legal-updated {
  font-size: .8rem;
  color: var(--t3);
  margin-bottom: 36px;
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section h2 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--t1);
  margin-bottom: 8px;
}

.legal-section p {
  font-size: .9rem;
  color: var(--t2);
  line-height: 1.7;
  margin-bottom: 8px;
}

.legal-section ul {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}

.legal-section ul li {
  position: relative;
  padding-left: 16px;
  font-size: .875rem;
  color: var(--t2);
  line-height: 1.7;
  margin-bottom: 4px;
}

.legal-section ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--t3);
}

.legal-section ul li strong {
  color: var(--t1);
  font-weight: 600;
}

.legal-footer {
  text-align: center;
  padding: 16px 24px;
  color: var(--t3);
  font-size: .7rem;
  border-top: 1px solid var(--border);
}

/* ─── Responsive ─── */

@media (max-width: 960px) {
  .dash-columns { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .cta-inner { flex-direction: column; text-align: center; }
  .partner-desc { display: none; }
}

@media (max-width: 600px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .stat-card { padding: 14px 10px; }
  .stat-value { font-size: 1.4rem; }
  .stat-label { font-size: .6rem; }

  .dash-main { padding: 16px 14px 0; }
  .dash-panel { padding: 16px 14px; }

  .dash-columns {
    border-radius: var(--radius-sm);
  }

  .store-btn { min-width: 0; flex: 1; padding: 10px 14px; }
  .store-btn svg { width: 20px; height: 20px; }
  .store-name { font-size: .9rem; }

  .hero-title { font-size: 2.5rem; }
  .hero-sub { font-size: .95rem; }
  .landing-header { padding: 14px 16px; }

  .partner-bar { padding: 8px 12px; gap: 8px; }
  .partner-name { font-size: .75rem; }
  .partner-badge { font-size: .5rem; padding: 2px 6px; }
  .partner-link { padding: 4px 10px; font-size: .65rem; }

  .cta-inner { padding: 16px; }
  .cta-text h2 { font-size: .95rem; }
  .cta-text p { font-size: .8rem; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 1.25rem; }
  .hero-title { font-size: 2.1rem; }
  .logo { font-size: 1.25rem; letter-spacing: 3px; }
  .app-link { display: none; }
}
