/* =============================================
   Whodja — Main Stylesheet
   Brand: Plum / Taupe / Gold / Teal
   ============================================= */

/* --- Brand Tokens --- */
:root {
  --color-primary:      #5C0E3D;
  --color-secondary:    #C1B2AB;
  --color-accent-warm:  #F5BC11;
  --color-accent-cool:  #559CAD;
  --color-success:      #63C132;
  --color-danger:       #B54848;
  --color-bg:           #F7F4F1;
  --color-surface:      #ffffff;
  --color-text:         #2B2B2B;
  --color-text-muted:   #6D6D6D;

  --gradient-connection: linear-gradient(90deg, #5C0E3D, #559CAD);
  --gradient-warm:       linear-gradient(90deg, #F5BC11, #C1B2AB);

  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-modal: 0 8px 32px rgba(0,0,0,0.14);

  --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
}

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

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

body {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

a { color: var(--color-accent-cool); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

h1 { font-size: clamp(28px, 5vw, 36px); }
h2 { font-size: clamp(22px, 4vw, 28px); }
h3 { font-size: 20px; }
h4 { font-size: 17px; }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

small, .text-sm { font-size: 14px; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container--wide {
  max-width: 960px;
}

/* --- Nav --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  padding: var(--space-3) var(--space-4);
}

.nav__inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav__logo {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.03em;
}

.nav__logo span {
  background: var(--gradient-connection);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Bottom Tab Bar (mobile nav) --- */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-surface);
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: stretch;
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-1);
  gap: 3px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  transition: color 120ms cubic-bezier(0.2,0.8,0.2,1);
  text-decoration: none;
}

.tab-bar__item.active,
.tab-bar__item:hover {
  color: var(--color-primary);
}

.tab-bar__item svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
}

.card + .card { margin-top: var(--space-4); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px var(--space-5);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: none;
  transition: all 120ms cubic-bezier(0.2,0.8,0.2,1);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: #4a0b32; color: #fff; }

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-text);
}
.btn--secondary:hover { background: #b0a099; }

.btn--outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}
.btn--outline:hover { background: var(--color-primary); color: #fff; }

.btn--teal {
  background: var(--color-accent-cool);
  color: #fff;
}
.btn--teal:hover { background: #4a8a9a; color: #fff; }

.btn--danger {
  background: var(--color-danger);
  color: #fff;
}
.btn--danger:hover { background: #a03c3c; color: #fff; }

.btn--full { width: 100%; }

.btn--sm {
  font-size: 13px;
  padding: 8px 16px;
}

/* --- Forms --- */
.form-group { margin-bottom: var(--space-4); }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--space-2);
  color: var(--color-text);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 12px var(--space-4);
  border: 1.5px solid var(--color-secondary);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 120ms ease;
  appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.form-hint {
  display: block;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.badge--gold {
  background: #FEF3C7;
  color: #92400E;
}

.badge--teal {
  background: #CCECF0;
  color: #1D6874;
}

.badge--plum {
  background: #F3E8EF;
  color: var(--color-primary);
}

.badge--green {
  background: #DCFCE7;
  color: #166534;
}

/* --- Sparks (points) display --- */
.sparks {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  color: var(--color-accent-warm);
}

.sparks::before {
  content: '✦';
  font-size: 0.85em;
}

/* --- Avatar --- */
.avatar {
  border-radius: var(--radius-full);
  object-fit: cover;
  background: var(--color-secondary);
  flex-shrink: 0;
}

.avatar--sm  { width: 36px; height: 36px; }
.avatar--md  { width: 52px; height: 52px; }
.avatar--lg  { width: 72px; height: 72px; }
.avatar--xl  { width: 96px; height: 96px; }

.avatar-placeholder {
  border-radius: var(--radius-full);
  background: var(--gradient-connection);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
}

/* --- Feed --- */
.feed-item {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.feed-item:last-child { border-bottom: none; }

.feed-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.feed-item__icon--connection { background: #F3E8EF; }
.feed-item__icon--meeting    { background: #CCECF0; }

.feed-item__body { flex: 1; min-width: 0; }
.feed-item__text { font-size: 14px; line-height: 1.5; }
.feed-item__time { font-size: 12px; color: var(--color-text-muted); margin-top: 3px; }

/* --- Connection card --- */
.connection-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.connection-card:last-child { border-bottom: none; }
.connection-card__info { flex: 1; min-width: 0; }
.connection-card__name { font-weight: 600; font-size: 15px; }
.connection-card__tagline { font-size: 13px; color: var(--color-text-muted); }

/* --- Alert / Toast --- */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: var(--space-4);
}

.alert--success { background: #DCFCE7; color: #166534; }
.alert--danger  { background: #FEE2E2; color: #991B1B; }
.alert--info    { background: #CCECF0; color: #1D6874; }

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--color-text-muted);
}

.empty-state__icon { font-size: 40px; margin-bottom: var(--space-4); }
.empty-state__text { font-size: 15px; line-height: 1.6; }

/* --- Progress bar --- */
.progress {
  height: 6px;
  background: var(--color-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  background: var(--gradient-warm);
  border-radius: var(--radius-full);
  transition: width 800ms ease-in-out;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease-out;
}

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

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  padding: var(--space-5);
  padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom));
  transform: translateY(40px);
  transition: transform 250ms ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal__handle {
  width: 40px;
  height: 4px;
  background: var(--color-secondary);
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-5);
}

/* --- Divider --- */
.divider {
  border: none;
  border-top: 1px solid rgba(0,0,0,0.08);
  margin: var(--space-5) 0;
}

/* --- Utility --- */
.flex        { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between{ display: flex; align-items: center; justify-content: space-between; }
.gap-2       { gap: var(--space-2); }
.gap-3       { gap: var(--space-3); }
.gap-4       { gap: var(--space-4); }
.mt-2        { margin-top: var(--space-2); }
.mt-3        { margin-top: var(--space-3); }
.mt-4        { margin-top: var(--space-4); }
.mt-5        { margin-top: var(--space-5); }
.mb-4        { margin-bottom: var(--space-4); }
.mb-5        { margin-bottom: var(--space-5); }
.pb-tab-bar  { padding-bottom: 80px; }

/* --- Loading spinner --- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-secondary);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* --- Responsive --- */
@media (min-width: 768px) {
  .container { padding: 0 var(--space-5); }
  .modal-overlay { align-items: center; padding: var(--space-5); }
  .modal { border-radius: var(--radius-lg); max-height: 80vh; }
  .tab-bar { display: none; }
}

/* --- Desktop nav links (hidden on mobile, shown on desktop) --- */
.nav__links {
  display: none;
  align-items: center;
  gap: var(--space-1);
}

.nav__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all 120ms cubic-bezier(0.2,0.8,0.2,1);
}

.nav__link:hover {
  background: var(--color-bg);
  color: var(--color-text);
  text-decoration: none;
}

.nav__link.active {
  background: #F3E8EF;
  color: var(--color-primary);
  font-weight: 600;
}

.nav__link svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* Override responsive section to also show desktop nav */
@media (min-width: 768px) {
  .nav__links { display: flex; }
  .nav__inner { max-width: 960px; }
  .page { max-width: 600px !important; }
}

/* Logo uses default nav__logo styles */
