/* ── Reusable Components ───────────────────────────────────────── */
@import './variables.css';

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255,255,255,0.04);
  transition: box-shadow var(--transition-fast);
}

.card--actionable {
  cursor: pointer;
}

.card--actionable:active {
  box-shadow: var(--shadow-md);
  background: var(--bg-tertiary);
}

.card__icon {
  font-size: 1.5rem;
  margin-bottom: var(--space-sm);
}

.card__label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.card__sub {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.card--workout {
  border-left: 3px solid var(--accent-orange);
}

.card--meal {
  border-left: 3px solid var(--accent-green);
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  transition: all var(--transition-fast);
  min-height: 44px;
  min-width: 44px;
}

.btn--primary {
  background: var(--accent-green);
  color: #000;
}

.btn--primary:active {
  background: #00cc6a;
  transform: scale(0.97);
}

.btn--secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn--secondary:active {
  background: #2a2a45;
}

.btn--danger {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.btn--danger:active {
  background: rgba(255, 56, 96, 0.25);
}

.btn--block {
  width: 100%;
}

.btn--sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn--icon {
  padding: var(--space-sm);
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--radius-full);
}

/* ── Form Inputs ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.form-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  transition: border-color var(--transition-fast);
  min-height: 48px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px var(--accent-green-dim);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--font-size-md);
  min-height: 48px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23a0a0b8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-green);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

/* ── Tags / Chips ─────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-md);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.tag--green {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.tag--orange {
  background: var(--accent-orange-dim);
  color: var(--accent-orange);
}

.tag--red {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.tag--blue {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

/* ── Progress Bar ─────────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar__fill--green  { background: var(--accent-green); }
.progress-bar__fill--orange { background: var(--accent-orange); }
.progress-bar__fill--red    { background: var(--accent-red); }

/* ── List Item ────────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-item__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
}

.list-item__sub {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}

.list-item__right {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--accent-green);
}

/* ── Set Row (Workout Set Input) ──────────────────────────────── */
.set-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
}

.set-row__num {
  width: 28px;
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--text-muted);
}

.set-row input {
  width: 80px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-input);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--font-size-base);
  text-align: center;
  min-height: 40px;
}

.set-row input:focus {
  outline: none;
  border-color: var(--accent-green);
}

.set-row__label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  width: 40px;
}

.set-row__remove {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-red);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-full);
}

/* ── Macro Stats Row ──────────────────────────────────────────── */
.macro-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.macro-row__color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.macro-row__info {
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.macro-row__label {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
}

.macro-row__values {
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
}

.macro-row__values span {
  color: var(--text-primary);
  font-weight: var(--font-weight-semibold);
}

/* ── Toast Notification ───────────────────────────────────────── */
.toast {
  position: fixed;
  top: var(--space-lg);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-lg);
  animation: toastIn var(--transition-fast) ease, toastOut var(--transition-fast) ease 2.5s forwards;
  white-space: nowrap;
}

.toast--success {
  background: var(--accent-green);
  color: #000;
}

.toast--error {
  background: var(--accent-red);
  color: #fff;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}