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

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --danger: #dc2626;
  --success: #16a34a;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Auth pages ───────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--card);
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.auth-card h1 {
  font-size: 28px;
  margin-bottom: 4px;
  color: var(--primary);
}

.subtitle {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 14px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

input, select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  font-family: inherit;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

button {
  padding: 12px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

button:hover { background: var(--primary-dark); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 12px;
  padding: 10px;
  background: #fef2f2;
  border-radius: 6px;
  border-left: 3px solid var(--danger);
}

.footer-link {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.footer-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

/* ── Dashboard ────────────────────────── */
.dashboard-page { background: var(--bg); }

.top-bar {
  background: var(--card);
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-bar-left { display: flex; align-items: center; gap: 10px; }
.top-bar-right { display: flex; align-items: center; gap: 14px; }
.brand-icon { font-size: 22px; }
.greeting { font-size: 14px; color: var(--muted); }

.top-bar h1 {
  font-size: 20px;
  color: var(--primary);
  font-weight: 700;
}

.logout-btn {
  width: auto;
  padding: 8px 18px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 13px;
  border-radius: 8px;
}

.logout-btn:hover { background: var(--bg); color: var(--text); }

.dashboard-main {
  max-width: 760px;
  margin: 28px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.card {
  background: var(--card);
  padding: 22px;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

/* ── Stat cards ───────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.stat-card {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ── Add form (toggle) ────────────────── */
.add-card { padding: 0; overflow: hidden; }

.toggle-add {
  width: 100%;
  padding: 16px;
  background: var(--card);
  color: var(--primary);
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.toggle-add:hover { background: #f7f8fd; }

.add-form { display: flex; flex-direction: column; gap: 14px; padding: 0 22px 22px; }

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
}

.goal-input { display: flex; align-items: center; gap: 6px; }
.goal-input input { width: 56px; text-align: center; }
.goal-unit { font-size: 12px; color: var(--muted); white-space: nowrap; }
.optional { font-weight: 400; color: var(--muted); font-size: 12px; }

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-create {
  width: auto;
  padding: 11px 28px;
  font-size: 14px;
  background: var(--primary);
}
.btn-create:hover { background: var(--primary-dark); }
.btn-create:disabled { opacity: 0.6; }

/* ── Habit list ───────────────────────── */
.habits-list { display: flex; flex-direction: column; gap: 14px; }

.habit-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.habit-item:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

.habit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.habit-title { flex: 1; min-width: 0; }
.habit-title h3 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.habit-title p { font-size: 13px; color: var(--muted); }

.habit-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.badge {
  background: var(--bg);
  color: var(--text);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.habit-streak { text-align: center; flex-shrink: 0; }
.streak-num {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--muted);
}
.streak-num.active { color: #f59e0b; }
.streak-label { font-size: 10px; color: var(--muted); }

/* ── Week strip ───────────────────────── */
.week-strip {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 16px 0;
}

.day-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.day-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  transition: all 0.15s;
}

.day-cell.done .day-dot {
  background: var(--success);
  border-color: var(--success);
  box-shadow: 0 2px 6px rgba(22,163,74,0.3);
}

.day-cell.today .day-dot { border-color: var(--primary); border-width: 2.5px; }

.day-label { font-size: 10px; color: var(--muted); }
.day-cell.today .day-label { color: var(--primary); font-weight: 700; }

/* ── Habit footer ─────────────────────── */
.habit-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.footer-left { display: flex; gap: 8px; }

.btn-history, .btn-delete {
  width: auto;
  padding: 8px 14px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 13px;
  border-radius: 8px;
  font-weight: 500;
}
.btn-history:hover { background: #e9ebf0; }
.btn-delete { padding: 8px 12px; }
.btn-delete:hover { background: #fef2f2; border-color: var(--danger); }

.btn-track {
  width: auto;
  padding: 10px 22px;
  background: var(--success);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-track:hover { background: #15803d; }
.btn-track.completed { background: var(--muted); }
.btn-track.completed:hover { background: #4b5563; }

/* ── History panel ────────────────────── */
.history-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.log-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
}
.log-date { font-weight: 600; min-width: 70px; }
.log-done { color: var(--success); font-weight: 700; }
.log-note { color: var(--muted); font-style: italic; }
.log-photo {
  width: auto;
  padding: 2px 10px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.log-photo:hover { background: var(--bg); }
.log-photo-img {
  display: block;
  max-width: 140px;
  max-height: 180px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  margin-top: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.log-item { flex-wrap: wrap; }

/* ── Empty state ──────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { color: var(--text); font-size: 15px; }
.empty-sub { color: var(--muted) !important; font-size: 13px !important; margin-top: 4px; }

.loading {
  color: var(--muted);
  text-align: center;
  padding: 32px;
  font-size: 14px;
}

/* ── Modal ────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

/* hidden attribute'u display:flex'i ezemiyor — açıkça gizle */
.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h3 { font-size: 18px; color: var(--text); }

.modal-close {
  width: auto;
  background: none;
  border: none;
  font-size: 26px;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); background: none; }

.modal-sub { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }

#checkin-form { display: flex; flex-direction: column; gap: 16px; }
#checkin-form textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
#checkin-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

.file-label { font-size: 13px; color: var(--text); font-weight: 500; }
.file-label input { margin-top: 6px; font-size: 13px; }

.modal-status { font-size: 13px; min-height: 18px; }
.modal-status.error { color: var(--danger); }
.modal-status.uploading { color: var(--muted); font-style: italic; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-ghost-sm {
  width: auto;
  padding: 11px 22px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 14px;
  border-radius: 8px;
}
.btn-ghost-sm:hover { background: var(--bg); }

/* ── Mood picker (modal) ──────────────── */
.mood-block { display: flex; flex-direction: column; gap: 8px; }
.mood-label { font-size: 13px; font-weight: 500; color: var(--text); }
.mood-picker { display: flex; gap: 8px; }
.mood-btn {
  width: auto;
  flex: 1;
  padding: 8px 0;
  font-size: 24px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s;
  filter: grayscale(0.4);
  opacity: 0.7;
}
.mood-btn:hover { transform: scale(1.08); filter: none; opacity: 1; }
.mood-btn.selected {
  border-color: var(--primary);
  background: rgba(79,70,229,0.08);
  filter: none;
  opacity: 1;
  transform: scale(1.05);
}

/* ── Count pill (bölüm başlıkları) ────── */
.count-pill {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 9px;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Bugün takip edilenler (özet) ─────── */
.today-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 4px; }
.today-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
}
.chip-mood { font-size: 18px; }
.chip-name { font-weight: 600; color: #065f46; }
.chip-streak { font-size: 12px; color: #047857; font-weight: 700; }

/* ── Tamamlanan habit kartı vurgusu ───── */
.habit-item.is-done { border-color: #a7f3d0; background: #f7fefb; }
.title-mood { font-size: 18px; }

/* ── Haftalık ilerleme çubuğu ─────────── */
.progress-row { display: flex; align-items: center; gap: 10px; margin: 14px 0 4px; }
.progress-track {
  flex: 1;
  height: 8px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #16a34a);
  border-radius: 999px;
  transition: width 0.4s ease;
}
.progress-text { font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 600; }

/* ── Motivasyon satırı ────────────────── */
.motivation {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 6px 0 0;
}

/* ── Streak 0 (sönük) ─────────────────── */
.streak-num.zero { color: var(--border); }

/* ── Geçmiş mood ──────────────────────── */
.log-mood { font-size: 16px; }

/* ── Konfeti ──────────────────────────── */
.confetti {
  position: fixed;
  top: -12px;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  z-index: 999;
  pointer-events: none;
  animation: confetti-fall 1.4s ease-in forwards;
}
@keyframes confetti-fall {
  to { transform: translateY(105vh) rotate(540deg); opacity: 0; }
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .stats-row { gap: 8px; }
  .stat-value { font-size: 26px; }
  .mood-btn { font-size: 20px; }
}

/* ── Welcome / Landing page ─────────────── */
.welcome-page {
  background: linear-gradient(180deg, #f4f6fb 0%, #ffffff 100%);
}

.welcome-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.welcome-nav nav { display: flex; gap: 12px; align-items: center; }

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
}

.nav-link:hover { background: var(--bg); }

.nav-cta {
  background: var(--primary);
  color: #fff;
}
.nav-cta:hover { background: var(--primary-dark); color: #fff; }

.welcome-hero {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: 760px;
  margin: 0 auto;
}

.welcome-hero h1 {
  font-size: 44px;
  line-height: 1.15;
  margin-bottom: 20px;
  color: var(--text);
  font-weight: 800;
}

.welcome-hero .accent { color: var(--primary); }

.hero-text {
  font-size: 17px;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary, .btn-ghost {
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  display: inline-block;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-ghost:hover { background: rgba(79, 70, 229, 0.05); }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 1000px;
  margin: 40px auto;
  padding: 0 24px;
}

.feature-card {
  background: #fff;
  padding: 28px 24px;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}

.feature-icon { font-size: 36px; margin-bottom: 12px; }

.feature-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.feature-card p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.how-it-works {
  max-width: 720px;
  margin: 60px auto;
  padding: 0 24px;
  text-align: center;
}

.how-it-works h2 {
  font-size: 26px;
  margin-bottom: 24px;
  color: var(--text);
}

.steps {
  list-style: none;
  counter-reset: step;
  text-align: left;
  display: grid;
  gap: 14px;
}

.steps li {
  counter-increment: step;
  background: #fff;
  padding: 18px 22px 18px 64px;
  border-radius: 10px;
  border: 1px solid var(--border);
  position: relative;
  font-size: 15px;
  color: var(--text);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.welcome-footer {
  text-align: center;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

.welcome-footer p { margin: 4px 0; }
.welcome-footer a { color: var(--primary); text-decoration: none; }
.welcome-footer a:hover { text-decoration: underline; }

/* "← Ana sayfa" link on auth pages */
.back-link {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 16px;
}
.back-link:hover { color: var(--primary); }
