/* KNB – Custom Styles (Tailwind über CDN ergänzt) */

:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
}

/* ---- Layout ---- */
body { background: #f9fafb; color: #111827; font-family: 'Inter', system-ui, sans-serif; }

#app { min-height: 100vh; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid #e5e7eb;
  padding: 0 1rem;
}
.navbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.nav-logo { display: flex; align-items: center; text-decoration: none; }
.nav-logo-img { height: 44px; width: auto; display: block; }
.nav-links { display: flex; gap: .25rem; }
.nav-link {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .75rem; border-radius: 8px;
  font-size: .875rem; font-weight: 500; color: #4b5563;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active { background: var(--green-50); color: var(--green-700); }
.nav-right { display: flex; align-items: center; gap: .75rem; }
.nav-points-badge {
  background: var(--green-50); color: var(--green-700);
  font-weight: 600; font-size: .875rem;
  padding: .3rem .75rem; border-radius: 99px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .5rem 1.1rem; border-radius: 8px;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: none; transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary   { background: var(--green-600); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-700); }
.btn-secondary { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover:not(:disabled) { background: #f9fafb; }
.btn-danger    { background: #ef4444; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm        { padding: .3rem .7rem; font-size: .8rem; }
.btn-full      { width: 100%; justify-content: center; }

/* ---- Cards ---- */
.card {
  background: #fff; border-radius: 12px;
  border: 1px solid #e5e7eb; padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-sm { padding: 1rem; }

/* ---- Form ---- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; color: #374151; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: .5rem .75rem; border-radius: 8px;
  border: 1px solid #d1d5db; font-size: .875rem; color: #111827;
  background: #fff; box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--green-600);
  box-shadow: 0 0 0 3px rgba(22,163,74,.15);
}
.form-hint { font-size: .78rem; color: #9ca3af; margin-top: .25rem; }

/* ---- Alerts ---- */
.alert { padding: .75rem 1rem; border-radius: 8px; font-size: .875rem; margin-bottom: 1rem; }
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-100); }
.alert-info    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---- Stats Grid ---- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (min-width: 640px)  { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: #111827; line-height: 1; }
.stat-label { font-size: .8rem; color: #6b7280; margin-top: .2rem; }
.stat-sub   { font-size: .75rem; color: #9ca3af; margin-top: .15rem; }
.stat-icon  {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}
.icon-green  { background: var(--green-100); }
.icon-blue   { background: #dbeafe; }
.icon-purple { background: #ede9fe; }
.icon-orange { background: #ffedd5; }

/* ---- Progress Bar ---- */
.progress-wrap { background: #e5e7eb; border-radius: 99px; height: 8px; overflow: hidden; }
.progress-bar  { height: 100%; background: var(--green-600); border-radius: 99px; transition: width .4s; }

/* ---- Badge ---- */
.badge-pill {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .2rem .6rem; border-radius: 99px;
  font-size: .75rem; font-weight: 600;
}
.badge-green  { background: var(--green-100); color: var(--green-700); }
.badge-gray   { background: #f3f4f6;          color: #374151; }
.badge-purple { background: #ede9fe;          color: #7c3aed; }
.badge-blue   { background: #dbeafe;          color: #1d4ed8; }
.badge-orange { background: #ffedd5;          color: #c2410c; }

/* ---- Leaderboard ---- */
.rank-row {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .5rem; border-radius: 8px; transition: background .1s;
}
.rank-row:hover { background: #f9fafb; }
.rank-num  { width: 2rem; text-align: center; font-weight: 600; color: #6b7280; }
.rank-avatar {
  width: 38px; height: 38px; border-radius: 99px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--green-500), var(--green-700));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1rem;
}
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-weight: 500; font-size: .9rem; }
.rank-sub  { font-size: .75rem; color: #9ca3af; }
.rank-pts  { font-weight: 700; color: var(--green-700); white-space: nowrap; }

/* ---- Activity Feed ---- */
.activity-row {
  display: flex; align-items: flex-start; gap: .75rem;
  padding: .75rem 0; border-bottom: 1px solid #f3f4f6;
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 36px; height: 36px; border-radius: 99px; flex-shrink: 0;
  background: var(--green-100); display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.activity-body { flex: 1; min-width: 0; }
.activity-name { font-size: .875rem; font-weight: 500; }
.activity-meta { font-size: .75rem; color: #9ca3af; margin-top: .15rem; }
.activity-pts  { font-weight: 700; color: var(--green-700); white-space: nowrap; font-size: .9rem; }

/* ---- Reward Card ---- */
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.25rem; }
.reward-card { display: flex; flex-direction: column; }
.reward-body { flex: 1; }
.reward-footer { border-top: 1px solid #f3f4f6; padding-top: 1rem; margin-top: 1rem; }
.reward-cost { font-size: 1.5rem; font-weight: 700; color: var(--green-700); }

/* ---- Page Container ---- */
.page-wrap { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }
.page-header { margin-bottom: 1.75rem; }
.page-title  { font-size: 1.5rem; font-weight: 700; color: #111827; }
.page-sub    { color: #6b7280; margin-top: .25rem; font-size: .9rem; }

/* ---- Top3 Podium ---- */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.podium-card { text-align: center; }
.podium-card.gold { border: 2px solid #fbbf24; background: #fffbeb; }
.podium-medal { font-size: 2rem; margin-bottom: .5rem; }

/* ---- Chart ---- */
.chart-wrap { position: relative; height: 180px; }
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.chart-bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; justify-content: flex-end; }
.chart-bar  { width: 100%; background: var(--green-500); border-radius: 3px 3px 0 0; min-height: 3px; transition: height .4s; }
.chart-label { font-size: .6rem; color: #9ca3af; margin-top: 3px; white-space: nowrap; overflow: hidden; }

/* ---- Landing page ---- */
.hero { text-align: center; padding: 5rem 1rem 4rem; background: linear-gradient(135deg, var(--green-50), #fff 60%, #eff6ff); }
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; line-height: 1.1; }
.hero h1 span { color: var(--green-600); }
.hero-sub { color: #6b7280; font-size: 1.1rem; max-width: 520px; margin: 1rem auto 2rem; }
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.feature-item { text-align: center; padding: 1.5rem 1rem; }
.feature-icon { font-size: 2.5rem; margin-bottom: .75rem; }
.feature-title { font-weight: 700; margin-bottom: .4rem; }
.feature-desc  { color: #6b7280; font-size: .875rem; }
.cta-band { background: var(--green-700); color: #fff; text-align: center; padding: 3.5rem 1rem; }
.cta-band h2 { font-size: 2rem; font-weight: 700; margin-bottom: .75rem; }
.cta-band p  { color: #bbf7d0; margin-bottom: 1.75rem; }
.btn-white { background: #fff; color: var(--green-700); }
.btn-white:hover { background: var(--green-50); }

/* ---- Auth ---- */
.auth-wrap { max-width: 440px; margin: 3rem auto; padding: 0 1rem; }
.auth-logo { text-align: center; margin-bottom: 2rem; }

/* ---- Spinner ---- */
.spinner {
  display: inline-block; width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 99px; animation: spin .6s linear infinite;
}
.spinner-dark { border-color: rgba(0,0,0,.15); border-top-color: #374151; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Empty state ---- */
.empty { text-align: center; padding: 3rem 1rem; color: #9ca3af; }
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; }

/* ---- Mobile bottom tab bar ---- */
.mobile-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; border-top: 1px solid #e5e7eb;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
}
.mobile-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: .45rem .25rem .35rem;
  text-decoration: none; color: #9ca3af;
  font-size: .6rem; font-weight: 500; gap: .1rem;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item .mn-icon { font-size: 1.35rem; line-height: 1; }
.mobile-nav-item.active { color: var(--green-700); }
.mobile-nav-item.active .mn-icon { transform: scale(1.1); }

@media (max-width: 640px) {
  /* Top bar: Links und Profilbutton ausblenden */
  .nav-links  { display: none !important; }
  .nav-profile-btn { display: none !important; }
  /* Punktebadge kompakter */
  .nav-points-badge { font-size: .75rem; padding: .25rem .55rem; }
  /* Logout-Button: nur Symbol auf sehr kleinen Screens */
  .nav-logout-text { display: none; }
  /* Abstand für Bottom-Nav */
  .page-wrap  { padding-bottom: 5.5rem; }
  .auth-wrap  { margin-bottom: 5rem; }
  /* Bottom-Nav einblenden */
  .mobile-nav { display: flex; }
}
