/* ===========================
   Habit Tracker - styles
   Base tone matches tokens.css (Terracotta & Cream);
   accent overridden to a warm flame-orange for the streak theme.
   =========================== */

*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  color-scheme: light;

  /* Base tone (from tokens.css) */
  --bg: #FAF4EC;
  --card: #FFFFFF;
  --border: #EDE2D4;
  --divider: #F4EBDF;
  --ink: #3D3229;
  --text-2: #6B5F51;
  --muted: #8C7F70;
  --faint: #B5A794;
  --error: #C0392B;
  --error-tint: rgba(192, 57, 43, 0.08);
  --success: #2E9E54;
  --success-tint: #F0FAF3;

  /* Accent overridden to flame-orange for this app */
  --accent: #E8792E;
  --accent-hover: #CC6420;
  --accent-tint: #FCE9D9;
  --accent-line: #F3CBA3;

  --radius-card: 20px;
  --radius-input: 12px;
  --radius-pill: 999px;
  --shadow-card: 0 2px 10px rgba(60, 40, 20, 0.06);
  --focus-ring: 0 0 0 3px rgba(232, 121, 46, 0.15);

  --font: "Nunito", sans-serif;
}

body {
  font-family: var(--font);
  margin: 0;
  padding: 40px 20px;
  background-color: var(--bg);
  color: var(--ink);
}

header, main {
  max-width: 680px;
  margin: 0 auto;
}

header {
  margin-bottom: 40px;
}

h1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 8px;
}

.title-icon {
  width: 26px;
  height: 26px;
  color: var(--accent);
  flex-shrink: 0;
}

.title-accent {
  color: var(--accent);
}

header p {
  color: var(--text-2);
  font-size: 14px;
  margin: 0;
}

h2.card-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group-grow {
  flex: 1;
  min-width: 200px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.form-group input {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-input);
  color: var(--ink);
  background: var(--card);
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.form-error {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--error);
  min-height: 1em;
}

#habit-section {
  margin-bottom: 40px;
}

.habit-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.habit-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-radius: var(--radius-card);
  padding: 16px 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  border-left: 4px solid var(--accent);
}

.habit-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.habit-name {
  font-weight: 700;
  font-size: 15px;
  word-break: break-word;
}

.habit-streak {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-2);
}

.habit-streak-flame {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

.habit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.checkin-btn {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  transition: background-color 150ms ease;
  white-space: nowrap;
}

.checkin-btn:hover {
  background: var(--accent-hover);
}

.checkin-btn:disabled {
  background: var(--success-tint);
  color: var(--success);
  cursor: default;
}

.habit-delete {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 6px;
  border-radius: 50%;
}

.habit-delete:hover {
  color: var(--error);
  background: var(--error-tint);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 32px 16px;
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

@media (max-width: 480px) {
  .inline-form {
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .habit-entry {
    flex-wrap: wrap;
  }
}
