/* Wilma Actometer — buttons, inputs, badges, cards */

button, .btn {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-md);
  padding: 12px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
  -webkit-tap-highlight-color: transparent;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(1px); }

.btn-secondary {
  background: var(--card);
  color: var(--primary);
  border-color: var(--primary);
}
.btn-secondary:hover:not(:disabled) { background: var(--primary-soft); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); }

.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #c44a47; border-color: #c44a47; }

.btn-link {
  background: transparent;
  color: var(--primary);
  border: none;
  padding: 8px 4px;
  min-height: auto;
  text-decoration: underline;
}

.btn-small {
  font-size: 0.875rem;
  padding: 8px 12px;
  min-height: 36px;
}

.btn-block {
  width: 100%;
}

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

label .hint {
  display: block;
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 2px;
}

input[type="text"], input[type="number"], input[type="date"], input[type="time"],
input[type="email"], textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  min-height: 44px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.18);
}

textarea {
  min-height: 88px;
  resize: vertical;
  font-family: var(--font-body);
}

input[type="number"] {
  font-family: var(--font-mono);
}

input[type="date"], input[type="time"] {
  font-family: var(--font-mono);
}

input[type="range"] {
  width: 100%;
  margin: 6px 0;
}

input[type="radio"], input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.radio-group, .choice-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.radio-group label,
.choice-group label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--card);
  cursor: pointer;
  font-weight: 400;
  margin: 0;
  min-height: 44px;
  transition: all 0.15s ease;
}

.radio-group label:has(input:checked),
.choice-group label:has(input:checked) {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 500;
}

.range-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.range-wrap .range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

.range-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
}

.range-emoji {
  text-align: center;
  font-size: 1.4rem;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--border);
  color: var(--text);
  white-space: nowrap;
}

.badge.success { background: var(--success-soft); color: #2d7a2d; }
.badge.warning { background: var(--warning-soft); color: #8a5c1f; }
.badge.danger  { background: var(--danger-soft); color: #9c2e2a; }
.badge.muted   { background: var(--border); color: var(--muted); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
.status-dot.green  { background: var(--success); }
.status-dot.yellow { background: var(--warning); }
.status-dot.gray   { background: var(--border-strong); }

.field-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 4px;
}

.helper-text {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px;
  min-height: auto;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { color: var(--primary); border-color: var(--border); background: var(--card); }

.list-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.list-card:hover { background: var(--primary-soft); text-decoration: none; }

.list-card .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list-card .right { display: flex; align-items: center; gap: 8px; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 24px 0 8px 0;
}

dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-md);
  max-width: 420px;
  width: calc(100% - 32px);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.4); }

dialog .dialog-body { padding: 20px; }
dialog h3 { margin-bottom: 8px; }
dialog .dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.toast {
  position: fixed;
  bottom: calc(80px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.toast.visible { opacity: 1; }