:root {
  --sidebar-bg: #1e1f24;
  --sidebar-text: #d4d4d8;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: #2e3038;
  --divider: #3f3f46;
  --content-bg: #101013;
  --content-text: #e4e4e7;
}

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

body {
  display: flex;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 240px;
  background-color: var(--sidebar-bg);
  padding: 16px 12px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 15px;
}

.sidebar-item svg {
  flex-shrink: 0;
}

.sidebar-item:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.sidebar-item.active {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.sidebar-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 16px 4px;
}

.chat-history {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.chat-history-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
  padding: 0 8px;
  margin-bottom: 8px;
}

.chat-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  margin-bottom: 8px;
}

.chat-history-header .chat-history-title {
  padding: 0;
  margin-bottom: 0;
}

.chat-new-session-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background-color: transparent;
  color: #71717a;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.chat-new-session-btn:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.chat-session-list {
  list-style: none;
}

.chat-session-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

.chat-session-title {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-session-menu-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  padding: 3px;
  border: none;
  border-radius: 6px;
  background-color: transparent;
  color: #71717a;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.1s ease, background-color 0.15s ease, color 0.15s ease;
}

.chat-session-item:hover .chat-session-menu-btn,
.chat-session-menu-btn:focus-visible,
.chat-session-menu-btn.menu-open {
  opacity: 1;
}

.chat-session-menu-btn:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.session-menu {
  position: fixed;
  z-index: 1000;
  min-width: 140px;
  padding: 4px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background-color: var(--sidebar-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.session-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background-color: transparent;
  color: var(--sidebar-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.session-menu-item:hover {
  background-color: var(--sidebar-hover);
}

.session-menu-item.danger {
  color: #f87171;
}

.session-menu-item.danger:hover {
  background-color: rgba(248, 113, 113, 0.1);
}

.chat-session-rename-input {
  flex: 1;
  min-width: 0;
  padding: 2px 6px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background-color: var(--sidebar-hover);
  color: var(--content-text);
  font-size: 14px;
  outline: none;
}

.chat-session-item:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.chat-session-item.active {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.content {
  flex: 1;
  padding: 32px;
  background-color: var(--content-bg);
  color: var(--content-text);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Profile view */

.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  margin-bottom: 16px;
  border-radius: 12px;
  background-color: #242530;
}

.profile-avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 50%;
  background-color: #e4e4e7;
  color: #101013;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.profile-identity {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-name {
  font-size: 28px;
  font-weight: 600;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  background-color: #1e1f24;
  font-size: 12px;
  color: #a1a1aa;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.profile-stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  background-color: #1e1f24;
}

.profile-stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
}

.profile-stat-value {
  font-size: 20px;
  font-weight: 600;
}

.profile-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 960px;
}

.profile-card {
  padding: 20px 24px;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  background-color: #1e1f24;
}

.profile-card > .profile-section-title + .profile-chip-list {
  margin-top: 0;
}

.profile-card > .profile-chip-list {
  margin-top: 8px;
  margin-bottom: 20px;
}

.profile-card > .profile-section-title:first-child {
  margin-top: 0;
}

.profile-card > .profile-toggle-row {
  margin-top: 8px;
}

.profile-card > .profile-chip-list:last-child,
.profile-card > .profile-toggle-row:last-child {
  margin-bottom: 0;
}

.profile-section-title {
  margin-top: 20px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
}

.profile-card > .profile-chip-list:not(:last-child) {
  margin-bottom: 16px;
}

.profile-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  background-color: #242530;
  font-size: 13px;
  color: var(--content-text);
}

.profile-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.profile-toggle-text {
  font-size: 14px;
  color: var(--content-text);
}

.profile-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background-color: #3f3f46;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.profile-toggle-on {
  background-color: #e4e4e7;
}

.profile-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: #a1a1aa;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.profile-toggle:focus-visible {
  outline: 2px solid #a1a1aa;
  outline-offset: 2px;
}

.profile-toggle-on .profile-toggle-knob {
  transform: translateX(20px);
  background-color: #101013;
}

/* Coach chat */

.chat-container {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-height: calc(100vh - 64px);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.chat-empty-state {
  margin: auto;
  text-align: center;
}

.chat-empty-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
}

.chat-empty-subtitle {
  color: #a1a1aa;
}

.chat-suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-width: 560px;
  margin: 28px auto 0;
}

.chat-messages > .chat-suggestion-grid {
  align-self: center;
  margin-top: -12px;
}

.chat-suggestion {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  background-color: #27272a;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.chat-suggestion:hover {
  background-color: #2e3038;
  border-color: #52525b;
}

.chat-suggestion:focus-visible {
  outline: 2px solid #a1a1aa;
  outline-offset: 2px;
}

.chat-suggestion-icon {
  color: #a1a1aa;
}

.chat-suggestion-title {
  font-weight: 600;
  font-size: 14px;
}

.chat-suggestion-example {
  color: #a1a1aa;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .chat-suggestion-grid {
    grid-template-columns: 1fr;
  }
}

.chat-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.user {
  align-self: flex-end;
  background-color: #2e3038;
}

.chat-message.assistant {
  align-self: flex-start;
  background-color: transparent;
  padding-left: 0;
  padding-right: 0;
}

.chat-classification {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -16px 0 0;
  padding: 4px 12px;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  font-size: 12px;
  color: #a1a1aa;
}

.chat-classification::before {
  content: "Message type";
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: #71717a;
}

.chat-input-form {
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  padding: 0 8px 16px;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background-color: #1e1f24;
  border: 1px solid #3f3f46;
  border-radius: 24px;
  padding: 10px 10px 10px 20px;
}

.chat-input-wrapper:focus-within {
  border-color: #52525b;
}

.chat-input {
  flex: 1;
  align-self: center;
  background: none;
  border: none;
  outline: none;
  resize: none;
  color: var(--content-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  max-height: 200px;
}

.chat-input::placeholder {
  color: #71717a;
}

.chat-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background-color: #e4e4e7;
  color: #101013;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.chat-send-btn:hover {
  background-color: #ffffff;
}

.chat-send-btn:disabled {
  background-color: #3f3f46;
  color: #71717a;
  cursor: not-allowed;
}

.chat-disclaimer {
  margin-top: 10px;
  text-align: center;
  font-size: 12px;
  color: #71717a;
}

.chat-workout-link {
  align-self: flex-start;
  margin-top: -16px;
  color: #a1a1aa;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.chat-workout-link:hover {
  color: #e4e4e7;
}

/* Workout view */

.workout-title {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 24px;
}

.workout-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 24px;
  width: calc(50% + 100px);
  min-width: 420px;
  margin: 0 auto 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background-color: #242530;
}

.workout-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.workout-exercise-name {
  font-size: 20px;
  font-weight: 700;
}

.workout-exercise-meta {
  font-size: 13px;
  color: #a1a1aa;
}

.workout-card-actions {
  display: flex;
  gap: 8px;
}

.workout-icon-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 4px;
  border: none;
  border-radius: 6px;
  background-color: transparent;
  color: #a1a1aa;
  cursor: pointer;
}

.workout-icon-btn:hover {
  background-color: #3f3f46;
  color: #e4e4e7;
}

.workout-icon-btn svg {
  width: 20px;
  height: 20px;
}

.sets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 12px;
  margin-top: 12px;
}

.sets-grid-header {
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #a1a1aa;
}

.sets-weight,
.sets-reps {
  text-align: center;
  background-color: #1e1f24;
  border: 1px solid #3f3f46;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--content-text);
  font-size: 14px;
  width: 100%;
  outline: none;
}

.sets-weight:focus,
.sets-reps:focus {
  border-color: #52525b;
}

.sets-weight:disabled,
.sets-reps:disabled {
  opacity: 0.55;
}

.sets-complete {
  display: flex;
  justify-content: center;
  align-items: center;
}

.sets-check {
  appearance: none;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #71717a;
  border-radius: 6px;
  cursor: pointer;
  color: transparent;
}

.sets-check:checked {
  background-color: #e4e4e7;
  border-color: #e4e4e7;
  color: #101013;
  cursor: pointer;
}

.sets-check:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.sets-check:checked:disabled {
  cursor: pointer;
}

.sets-check::after {
  content: "✓";
  font-size: 14px;
  line-height: 1;
}

.workout-complete-btn {
  display: block;
  padding: 10px 20px;
  margin-bottom: 16px;
  border: none;
  border-radius: 8px;
  background-color: #e4e4e7;
  color: #101013;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.workout-complete-btn:hover:not(:disabled) {
  background-color: #ffffff;
}

.workout-complete-btn:disabled {
  background-color: #3f3f46;
  color: #71717a;
  cursor: not-allowed;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  position: relative;
  width: min(640px, 80vw);
  height: min(480px, 70vh);
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #1e1f24;
  border: 1px solid #3f3f46;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content {
  color: var(--content-text, #e4e4e7);
  font-size: 20px;
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 6px;
  border: none;
  border-radius: 8px;
  background-color: transparent;
  color: #a1a1aa;
  cursor: pointer;
}

.modal-close-btn:hover {
  background-color: #3f3f46;
  color: #e4e4e7;
}

.modal-close-btn svg {
  width: 20px;
  height: 20px;
}
