/* FollowKit Cities - styles.css */
:root {
  --coral: #FF6B4A;
  --coral-light: #FF8A6E;
  --coral-dark: #E55A3A;
  --coral-bg: #FFF2EF;
  --text: #1A1A2E;
  --text-secondary: #5C5C7A;
  --text-muted: #9999B3;
  --bg: #F8F8FC;
  --card: #FFFFFF;
  --border: #EAEAF0;
  --success: #22C55E;
  --blue: #3B82F6;
  --purple: #8B5CF6;
  --gold: #F59E0B;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

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

html, body {
  height: 100%;
  width: 100%;
  max-width: 100%;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: hidden;
}

/* ---- Layout shell ---- */
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

#screen-container {
  flex: 1;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: var(--bg);
}

/* ---- Bottom nav ---- */
#bottom-nav {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--card);
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 4px 6px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  gap: 3px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.nav-item.active { color: var(--coral); }
.nav-item svg { width: 22px; height: 22px; flex-shrink: 0; }
.nav-item .nav-label { line-height: 1; }

/* ---- Screen ---- */
.screen { display: none; min-height: 100%; width: 100%; max-width: 100%; box-sizing: border-box; }
.screen.active { display: block; }

/* ---- Onboarding ---- */
#onboarding-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  background: var(--card);
  overflow-x: hidden;
}

.onboard-hero {
  background: linear-gradient(145deg, var(--coral), var(--coral-dark));
  color: white;
  padding: 48px 24px 32px;
  text-align: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.onboard-logo {
  width: 72px;
  height: 72px;
  background: white;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.onboard-hero h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; }
.onboard-hero p { font-size: 15px; opacity: 0.9; margin-top: 6px; }

.onboard-steps {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 20px 0 8px;
}

.onboard-step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.25s, width 0.25s;
}

.onboard-step-dot.active { background: var(--coral); width: 20px; border-radius: 4px; }
.onboard-step-dot.done { background: var(--coral-light); }

.onboard-panel {
  display: none;
  flex: 1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 24px 20px 32px;
  flex-direction: column;
  gap: 16px;
}

.onboard-panel.active { display: flex; }

.onboard-panel h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.onboard-panel p { font-size: 14px; color: var(--text-secondary); margin-top: -8px; }

/* ---- Form controls ---- */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.3px; }

input[type="text"], select, textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus, select:focus, textarea:focus {
  border-color: var(--coral);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239999B3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

textarea { resize: none; min-height: 80px; }

/* ---- Buttons ---- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

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

.btn-primary { background: var(--coral); color: white; width: 100%; }
.btn-secondary { background: var(--coral-bg); color: var(--coral); }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-outline { background: none; border: 1.5px solid var(--border); color: var(--text); }

.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ---- Bucket picker grid ---- */
.bucket-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bucket-chip {
  padding: 12px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  line-height: 1.3;
}

.bucket-chip.selected {
  border-color: var(--coral);
  color: var(--coral);
  background: var(--coral-bg);
}

/* ---- Home screen ---- */
.screen-header {
  padding: 16px 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.screen-title { font-size: 22px; font-weight: 700; letter-spacing: -0.4px; }
.screen-subtitle { font-size: 14px; color: var(--text-secondary); margin-top: 2px; }

.section { padding: 20px 20px 0; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ---- Score banner ---- */
.score-banner {
  margin: 16px 20px;
  background: linear-gradient(135deg, var(--coral), var(--coral-dark));
  border-radius: var(--radius);
  padding: 20px;
  color: white;
  display: flex;
  align-items: center;
  gap: 16px;
  box-sizing: border-box;
  max-width: calc(100% - 40px);
}

.score-number { font-size: 42px; font-weight: 800; line-height: 1; }
.score-label { font-size: 13px; opacity: 0.85; margin-top: 2px; }
.score-points { font-size: 11px; opacity: 0.75; margin-top: 4px; }

/* ---- Weekly goal ring ---- */
.goal-ring-wrap {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.goal-ring-wrap .goal-label { font-size: 10px; opacity: 0.85; text-align: center; }

.ring-svg { width: 58px; height: 58px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.25); stroke-width: 4; }
.ring-fill { fill: none; stroke: white; stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease; }
.ring-center { fill: none; }

/* ---- Power list ---- */
.power-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  margin-bottom: 10px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.power-card-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--coral-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.account-name { font-size: 15px; font-weight: 600; }
.account-handle { font-size: 13px; color: var(--text-secondary); margin-top: 1px; }

.account-status-badge {
  margin-left: auto;
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.status-to-follow { background: var(--border); color: var(--text-secondary); }
.status-followed { background: #DBEAFE; color: #1D4ED8; }
.status-dmd { background: #F3E8FF; color: #7C3AED; }
.status-connected { background: #DCFCE7; color: #15803D; }

/* ---- Account card expanded ---- */
.account-card-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  gap: 10px;
  flex-direction: column;
}

.account-card-body.open { display: flex; }

.account-role { font-size: 13px; color: var(--text-secondary); padding-top: 12px; }

.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.action-btn:active { opacity: 0.75; transform: scale(0.97); }
.action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.action-ig { background: #FEE2E2; color: #DC2626; }
.action-dm { background: var(--coral-bg); color: var(--coral); }
.action-notes { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

.notes-field {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  resize: none;
  min-height: 60px;
  outline: none;
}

.notes-field:focus { border-color: var(--coral); }

/* ---- Group headers ---- */
.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 8px;
  margin-top: 16px;
}

.group-name { font-size: 14px; font-weight: 700; color: var(--text); }
.group-count { font-size: 12px; color: var(--text-muted); }

/* ---- Badges ---- */
.badges-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.badges-row::-webkit-scrollbar { display: none; }

.badge-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-width: 90px;
  flex-shrink: 0;
  text-align: center;
}

.badge-chip.earned { border-color: var(--gold); background: #FFFBEB; }
.badge-icon { font-size: 24px; }
.badge-name { font-size: 11px; font-weight: 600; color: var(--text-secondary); line-height: 1.2; }
.badge-chip.earned .badge-name { color: var(--gold); }

/* ---- Search screen ---- */
.search-bar-wrap {
  padding: 16px 20px 12px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  gap: 10px;
  transition: border-color 0.15s;
}

.search-bar:focus-within { border-color: var(--coral); }

.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

.search-input {
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text);
  flex: 1;
  outline: none;
  padding: 0;
}

.search-input::placeholder { color: var(--text-muted); }

/* ---- Filter chips ---- */
.filter-row {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  white-space: nowrap;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--card);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  flex-shrink: 0;
}

.filter-chip.active { background: var(--coral); border-color: var(--coral); color: white; }

/* ---- Cities list ---- */
.city-list-item {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  gap: 12px;
  background: var(--card);
}

.city-list-item:active { background: var(--bg); }

.city-item-info { flex: 1; }
.city-item-name { font-size: 16px; font-weight: 600; }
.city-item-state { font-size: 13px; color: var(--text-secondary); margin-top: 1px; }
.city-item-count { font-size: 13px; color: var(--text-muted); }
.city-item-chevron { color: var(--text-muted); }

/* ---- City detail ---- */
.city-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px 8px;
  cursor: pointer;
  color: var(--coral);
  font-size: 15px;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: none;
  font-family: inherit;
}

.city-detail-header { padding: 0 20px 16px; }
.city-detail-title { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.city-detail-meta { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.add-city-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 2px solid var(--coral);
  border-radius: 20px;
  color: var(--coral);
  font-size: 14px;
  font-weight: 600;
  background: none;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  margin-top: 10px;
  transition: all 0.15s;
}

.add-city-btn.added { background: var(--coral); color: white; }

/* ---- Tracker screen ---- */
.tracker-tabs {
  display: flex;
  margin: 16px 20px 0;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--border);
  gap: 2px;
  padding: 2px;
}

.tracker-tab {
  flex: 1;
  padding: 10px 4px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  background: none;
  border: none;
  font-family: inherit;
}

.tracker-tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }

.tracker-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 16px 20px 0;
}

.tracker-stat {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--border);
}

.tracker-stat-num { font-size: 22px; font-weight: 800; color: var(--coral); line-height: 1; }
.tracker-stat-lbl { font-size: 10px; font-weight: 600; color: var(--text-muted); margin-top: 3px; text-transform: uppercase; letter-spacing: 0.3px; }

/* ---- DM template modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  z-index: 1000;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-sheet {
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 24px 20px;
  padding-bottom: calc(24px + var(--safe-bottom));
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.open .modal-sheet { transform: translateY(0); }

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin: 0 auto 20px;
}

.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.modal-subtitle { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }

.template-option {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s;
}

.template-option:active { border-color: var(--coral); }
.template-text { font-size: 14px; color: var(--text); line-height: 1.6; }
.template-copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--coral);
  font-size: 13px;
  font-weight: 600;
}

.copied-toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s;
  z-index: 2000;
  white-space: nowrap;
}

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

/* ---- Settings ---- */
.settings-section { margin: 0 0 24px; }
.settings-section-title { font-size: 12px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; padding: 0 20px 8px; }

.settings-row {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  gap: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.settings-row:first-of-type { border-top: 1px solid var(--border); }
.settings-row svg { width: 20px; height: 20px; color: var(--text-secondary); flex-shrink: 0; }
.settings-row-label { flex: 1; font-size: 16px; }
.settings-row-value { font-size: 15px; color: var(--text-muted); }
.settings-row-chevron { color: var(--text-muted); }

/* ---- Progress bar ---- */
.progress-bar-wrap { background: var(--bg); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 4px; background: var(--coral); transition: width 0.4s ease; }

/* ---- My Cities chips ---- */
.my-cities-row {
  display: flex;
  gap: 8px;
  padding: 0 20px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.my-cities-row::-webkit-scrollbar { display: none; }

.my-city-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
}

.my-city-chip.active { background: var(--coral); border-color: var(--coral); color: white; }

/* ---- Load more ---- */
.load-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  margin: 8px 20px 20px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.15s;
  gap: 6px;
  width: calc(100% - 40px);
}

.load-more-btn:active { background: var(--border); }

/* ---- Empty states ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
  color: var(--text-secondary);
}

.empty-state-icon { font-size: 48px; }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--text); }
.empty-state-desc { font-size: 14px; line-height: 1.6; }

/* ---- Spinner ---- */
.spinner {
  width: 24px; height: 24px;
  border: 2.5px solid var(--border);
  border-top-color: var(--coral);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 32px auto;
}

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

.loading-wrap { display: flex; justify-content: center; padding: 24px; }

/* ---- Bucket emoji map ---- */
/* used via JS data-attr only, not CSS */

/* ---- Report modal ---- */
.report-textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  resize: none;
  min-height: 100px;
  outline: none;
}

.report-textarea:focus { border-color: var(--coral); }

/* ---- Utility ---- */
.pb-safe { padding-bottom: calc(16px + var(--safe-bottom)); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-coral { color: var(--coral); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }

.inline-flex { display: inline-flex; align-items: center; gap: 6px; }
.hidden { display: none !important; }

/* ---- Search results header ---- */
.results-header {
  padding: 0 20px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}
