@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@300;400;500&family=Cormorant+Garamond:ital,wght@0,400;0,500;1,400;1,500&family=Inter:wght@300;400;500&display=swap');

:root {
  --cream: #FDFCF8;
  --mint: #DBE5C8;
  --white: #FFFFFF;
  --charcoal: #4A4A4A;
  --rose: #D4A5A5;
  --sage: #8FA482;
  --border: #E8E4DD;
  --muted: #8A8A8A;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--cream);
  color: var(--charcoal);
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--sage);
  text-decoration: none;
}

/* ---------- Header ---------- */

.site-header {
  text-align: center;
  padding: 32px 20px 20px;
}

.site-title {
  font-family: 'Playfair Display', serif;
  font-weight: 300;
  font-size: 32px;
  color: var(--rose);
  letter-spacing: 0.05em;
  margin: 0;
}

.site-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 500;
  font-size: 16px;
  color: var(--sage);
  margin: 6px 0 20px;
}

.hair-divider {
  border: none;
  border-top: 1px solid var(--border);
  max-width: 640px;
  margin: 0 auto;
}

/* ---------- Nav ---------- */

.site-nav {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--border);
}

.nav-links {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--charcoal);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}

.nav-links a.active {
  color: var(--sage);
  border-bottom-color: var(--sage);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.nav-user .chip {
  background: var(--mint);
  color: var(--charcoal);
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 500;
}

.nav-user a {
  color: var(--muted);
}

/* ---------- Layout ---------- */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

.welcome {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 20px;
}

h1, h2, h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 400;
  color: var(--charcoal);
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

.section-tagline {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--muted);
  margin-top: -8px;
  margin-bottom: 20px;
}

.category-heading {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 500;
  color: var(--sage);
  margin: 28px 0 12px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  padding: 20px;
  margin-bottom: 16px;
}

.card.emphasis {
  background: var(--mint);
  box-shadow: none;
}

.card-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 4px;
}

.card-meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 8px;
}

.card-preview {
  font-size: 15px;
  color: var(--charcoal);
}

.card a.card-link {
  display: block;
  color: inherit;
}

.card a.card-link:hover .card-title {
  color: var(--sage);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--sage);
  color: var(--white);
  border: none;
  border-radius: 4px;
  padding: 14px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  text-align: center;
  transition: opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn.btn-secondary {
  background: var(--white);
  color: var(--sage);
  border: 1px solid var(--sage);
}

.btn.btn-danger {
  background: var(--white);
  color: #B85C5C;
  border: 1px solid #B85C5C;
}

.btn.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  min-height: 36px;
}

.btn.btn-large {
  padding: 18px 24px;
  font-size: 17px;
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 14px;
  color: var(--charcoal);
  margin-bottom: 6px;
  font-weight: 500;
}

input, select, textarea {
  width: 100%;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--white);
  color: var(--charcoal);
  min-height: 44px;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

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

.field {
  margin-bottom: 16px;
}

.field-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1;
  min-width: 120px;
}

@media (max-width: 599px) {
  .field-row {
    flex-direction: column;
  }

  .field-row .field {
    min-width: 100%;
  }
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

.checkbox-row label {
  margin: 0;
  font-weight: 400;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  background: var(--mint);
  color: var(--charcoal);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: capitalize;
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 74, 74, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal {
  background: var(--white);
  border-radius: 8px;
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: flex-end;
}

.hidden {
  display: none !important;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--charcoal);
  color: var(--white);
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 14px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.toast.error {
  background: #B85C5C;
}

.toast.has-action {
  pointer-events: auto;
}

.toast-action {
  pointer-events: auto;
  margin-left: 16px;
  background: none;
  border: none;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
}

/* ---------- Tagline / footer ---------- */

.footer-tagline {
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
  margin-top: 48px;
}

/* ---------- Utilities ---------- */

.muted { color: var(--muted); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---------- Login page ---------- */

.login-wrap {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  padding: 32px 28px;
  max-width: 380px;
  width: 100%;
}

.error-text {
  color: #B85C5C;
  font-size: 14px;
  margin-top: 8px;
}

/* ---------- Mode toggle (log workout) ---------- */

.mode-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 24px;
}

.mode-toggle button {
  flex: 1;
  background: var(--white);
  border: none;
  padding: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  cursor: pointer;
  min-height: 44px;
}

.mode-toggle button.active {
  background: var(--sage);
  color: var(--white);
}

.transcript-box {
  background: var(--mint);
  border-radius: 8px;
  padding: 16px;
  min-height: 80px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 17px;
  margin: 16px 0;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #B85C5C;
  font-size: 14px;
}

.recording-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #B85C5C;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.exercise-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}

.card.set-card {
  position: relative;
}

.exercise-block .remove-exercise,
.set-card .remove-exercise {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.exercise-block .remove-exercise:hover,
.set-card .remove-exercise:hover {
  color: #B85C5C;
}

.autocomplete-wrap {
  position: relative;
}

.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.autocomplete-list .option {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 15px;
}

.autocomplete-list .option:hover,
.autocomplete-list .option.highlighted {
  background: var(--mint);
}

.autocomplete-list .option.add-new {
  color: var(--sage);
  font-weight: 500;
  border-top: 1px solid var(--border);
}

@media (max-width: 480px) {
  .site-title { font-size: 26px; }
  .nav-links { gap: 16px; font-size: 14px; }
}
