/* =========================================================
   HABITS – das Aussehen (und die Rang-Karte, die auch im Journal steht)
   (benutzt auch Teile aus journal.css: .journal-streak, .journal-karte,
    .journal-titel, .journal-wahl, .gespeichert-hinweis ...)
   ========================================================= */

/* ---------- Die Rang-Karte: leuchtend roter Rand ---------- */
.rang-karte {
  background: var(--flaeche);
  border: 1.5px solid rgba(255, 31, 61, 0.65);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 0 14px rgba(255, 31, 61, 0.18);
}
.rang-oben { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rang-klein { font-size: 0.78rem; color: var(--text-leise); }
.rang-name { font-size: 1.45rem; font-weight: 800; line-height: 1.2; }
.rang-punkte {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 99px;
  border: 1.5px solid rgba(255, 31, 61, 0.65);
}
.rang-balken {
  height: 8px;
  border-radius: 99px;
  background: var(--hintergrund);
  margin: 12px 0;
  overflow: hidden;
}
.rang-balken span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--verlauf);
  box-shadow: var(--rot-glow);
  transition: width 0.4s ease;
}
.rang-unten { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rang-unten .rang-klein { text-align: right; }

/* Die Farben der Ränge: wie Metall glänzend */
.rang-name.bronze, .rang-name.silber, .rang-name.gold, .rang-name.platin,
.rang-name.diamant {
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.rang-name.bronze  { background-image: linear-gradient(90deg, #7a4a24, #e3a46a 50%, #7a4a24); }
.rang-name.silber  { background-image: var(--silber-verlauf); }
.rang-name.gold    { background-image: var(--gold-verlauf); }
.rang-name.platin  { background-image: linear-gradient(90deg, #8f9aa0, #ffffff 50%, #8f9aa0); }
.rang-name.diamant { background-image: linear-gradient(90deg, #a9c9d0, #ffffff 35%, #d8f2f5 65%, #a9c9d0); }
.rang-name.meister { color: var(--rot); text-shadow: 0 0 10px rgba(255, 31, 61, 0.5); }
.rang-name.grossmeister { color: #ff4a60; text-shadow: var(--rot-glow); }

/* ---------- Fenster "Ränge ansehen" ---------- */
#raenge-liste {
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 12px;
}
.rang-zeile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  background: var(--hintergrund);
  border: 1px solid var(--linie);
}
.rang-name.klein { font-size: 1rem; font-weight: 700; }
.rang-pkt { font-size: 0.8rem; color: var(--text-leise); }
.rang-zeile.geschafft { opacity: 0.55; }
.rang-zeile.aktuell { border-color: rgba(255, 31, 61, 0.7); box-shadow: 0 0 10px rgba(255, 31, 61, 0.25); }
.rang-du {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  background: var(--rot-kreis);
  border-radius: 99px;
  padding: 2px 9px;
}

/* "Neuer Rang!": der Hinweis unten leuchtet rot statt gold */
.gespeichert-hinweis.feiern {
  background: var(--rot-kreis);
  border-color: transparent;
  color: white;
  box-shadow: 0 0 16px rgba(255, 31, 61, 0.6);
}

/* ---------- Monatsübersicht ---------- */
.habit-monats-bereich summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-leise);
  padding: 4px 0 10px;
  list-style: none;
}
.habit-monats-bereich summary::-webkit-details-marker { display: none; }
.habit-monats-bereich summary::before { content: "▸ "; }
.habit-monats-bereich[open] summary::before { content: "▾ "; }

.habit-monat {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}
.h-tag {
  aspect-ratio: 1;
  max-height: 46px;
  border-radius: 10px;
  border: 1px solid var(--linie);
  background: var(--hintergrund);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.h-tag:disabled { opacity: 0.3; cursor: default; }
/* geteilter Tag: links Journal (Gold), rechts Habits (Rot) – Hintergrund kommt aus habits.js */
.h-tag.gefuellt {
  background-color: var(--hintergrund);
  background-origin: border-box;
  border-color: rgba(255, 255, 255, 0.12);
  color: white;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
/* Heute: roter Rand mit Leuchten. Gewählter Tag: weißer Rand.
   Nur EIN Rand pro Tag (kein doppelter Ring), die Farben gehen bis an den Rand. */
.h-tag.heute { border: 2px solid var(--rot); box-shadow: 0 0 12px rgba(255, 31, 61, 0.6); font-weight: 800; }
.h-tag.gewaehlt { border: 2px solid white; }

/* Erklärung unter dem Kalender */
.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text);
}
.legende span { display: flex; align-items: center; gap: 6px; }
.legende .leise { color: var(--text-leise); }
.legende i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }
.legende .l-journal { background: linear-gradient(90deg, #d8b45a 0 50%, var(--hintergrund) 50%); border: 1px solid rgba(255, 255, 255, 0.12); }
.legende .l-habits  { background: linear-gradient(90deg, var(--hintergrund) 0 50%, #e8132f 50%); border: 1px solid rgba(255, 255, 255, 0.12); }
#journal-monat { margin-top: 10px; }

/* ---------- Die Habits des Tages ---------- */
.habit-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.habit-stand { font-size: 0.85rem; color: var(--text-leise); font-weight: 600; white-space: nowrap; }

.habit {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--hintergrund);
  border: 1px solid var(--linie);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 8px;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.habit:last-child { margin-bottom: 0; }
.habit-name { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.habit-pkt { font-size: 0.75rem; color: var(--text-leise); }
/* Abgehakt: roter Kreis mit Häkchen (wie bei den ToDos), Text bleibt gut lesbar */
.habit.fertig { border-color: rgba(255, 31, 61, 0.45); }
.habit.fertig .habit-pkt { color: #f0d68a; font-weight: 700; }
.habit.fertig .haken {
  border-color: transparent;
  background: var(--rot-kreis);
  box-shadow: 0 0 10px rgba(255, 31, 61, 0.5);
}
.habit.fertig .haken::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.95rem;
}

/* ---------- Habits bearbeiten ---------- */
#habit-liste .pfeil { padding: 6px 10px; }
#habit-liste .pfeil:disabled { opacity: 0.25; cursor: default; }
