/* ===== RESET ===== */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* ===== BACKGROUND FIXED ===== */
body {
  font-family: system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, #fde68a66, transparent 45%),
    radial-gradient(circle at 80% 30%, #bfdbfe66, transparent 45%),
    radial-gradient(circle at 50% 80%, #a7f3d066, transparent 50%),
    #fdfcff;
  background-attachment: fixed;
  overflow: hidden;
}

/* ===== APP LAYOUT ===== */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== HEADER ===== */
.topbar {
  flex-shrink: 0;
  text-align: center;
  padding: 16px;
  background: transparent;
  backdrop-filter: blur(6px);
}

.topbar h1 {
  margin: 20px;
  font-size: 30px;
}

/* .btn {
  margin-top: 8px;
  margin: 5px;
  padding: 6px 14px;
  border-radius: 10%;
  border: none;
  background: rgba(255,255,255,.75);
  cursor: pointer;
} */

.add-habit, .logout{
  margin: 2px;
  margin-top: 5px;
  padding: 6px 14px;
  height: 40px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}

.add-habit{
  background: rgba(255,255,255,.75);
}


/* ===== SCROLL AREA ===== */
.habit-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  display: flex;
  /* flex-direction: column; */
  justify-content: center;

  gap: 28px;

  padding: 32px 0 120px;
}

/* ===== BUBBLE (PROPORSIONAL) ===== */
.bubble {
  width: 96px;
  height: 96px;
  min-width: 96px;
  min-height: 96px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;

  border-radius: 50%;
  padding: 10px;

  font-size: 12px;            /* FIX */
  line-height: 1.25;          /* FIX */
  text-align: center;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  box-shadow:
    inset 0 0 30px rgba(255,255,255,.6),
    0 18px 40px rgba(0,0,0,.15);

  transition:
    background 280ms ease,
    box-shadow 280ms ease,
    transform 200ms ease;

}

@keyframes floatSlow {
  50% { transform: translateY(-6px); }
}

@keyframes floatMedium {
  50% { transform: translateY(-10px); }
}

@keyframes breatheSoft {
  50% { transform: scale(1.04); }
}

/* kelas animasi */
.bubble.anim-1 { animation: floatSlow 7s ease-in-out infinite; }
.bubble.anim-2 { animation: floatMedium 9s ease-in-out infinite; }
.bubble.anim-3 { animation: breatheSoft 6s ease-in-out infinite; }

/* ===== DETAIL ===== */
.detail {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: none;
  z-index: 20;
}

.detail.active { display: block; }

/* ⬇️ KUNCI VERTICAL CENTER */
.detail-content {
  min-height: 100vh;
  max-width: 420px;
  margin: 0 auto;

  display: flex;
  flex-direction: column;
  justify-content: center;    /* FIX UTAMA */
  align-items: center;

  padding: 32px 20px;
  gap: 14px;
  text-align: center;
}

/* ===== DETAIL BUBBLE ===== */
.detail-bubble {
  width: 100px;
  height: 100px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  margin-bottom: 4px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 12px;            /* FIX */
  line-height: 1.2;
  text-align: center;
  word-break: break-word; /* FIX */

  box-shadow:
    inset 0 0 30px rgba(255,255,255,.6),
    0 18px 40px rgba(0,0,0,.15);
}

/* ===== STATS ===== */
.stats {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin: 8px 0 4px;
  font-size: 14px;
}

/* ===== CONSISTENCY GRID (SELALU MUNCUL) ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.cell {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: #e5e7eb;    /* BASELINE VISIBLE */
  opacity: 1;             /* FIX: JANGAN HILANG */
}

/* ===== MODAL ===== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.modal-card {
  background: #fff;
  padding: 20px;
  border-radius: 16px;
  width: 90%;
  max-width: 320px;
}

input, button {
  width: 150px;
  padding: 10px;
  border-radius: 10px;
  border: none;
  margin-top: 8px;
}

.detail {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;

  /* BACKGROUND DETAIL (VERSI HALUS) */
  background:
    radial-gradient(circle at 30% 20%, #fde68a44, transparent 50%),
    radial-gradient(circle at 70% 40%, #bfdbfe44, transparent 50%),
    radial-gradient(circle at 50% 80%, #a7f3d044, transparent 55%),
    #ffffff;
}

.detail.active {
  display: block;
}

/* ===== HABIT DONE TODAY ===== */
.bubble.done,
.detail-bubble.done {
  background: var(--habit-color) !important; /* ⬅️ INI KUNCI */
  color: #111;
  filter: saturate(1.3);
  transform: scale(1.06);

  box-shadow:
    inset 0 0 40px rgba(255,255,255,.9),
    0 22px 45px rgba(0,0,0,.25);
}


/* Grid hari ini (done) */
.cell.today {
  outline: 2px solid #111827;
  outline-offset: 2px;
}

.cell.done {
  background: var(--habit-color) !important;
}


@keyframes fillIn {
  0%   { transform: scale(0.96); filter: saturate(0.9); }
  60%  { transform: scale(1.08); filter: saturate(1.15); }
  100% { transform: scale(1);    filter: saturate(1.3); }
}

@keyframes fillOut {
  0%   { transform: scale(1); }
  100% { transform: scale(0.98); }
}

/* saat DONE */
.bubble.done,
.detail-bubble.done {
  animation: fillIn 280ms ease-out;
}

/* saat UNDO */
.bubble.undo,
.detail-bubble.undo {
  animation: fillOut 180ms ease-in;
}

@keyframes cellPop {
  0%   { transform: scale(0.7); }
  70%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.cell.pop {
  animation: cellPop 220ms ease-out;
}

.detail {
  transition: background-position 400ms ease;
}

.detail.active {
  background-position: center;
}

/* detail bubble animatable */
.detail-bubble {
  transition:
    background 280ms ease,
    box-shadow 280ms ease,
    transform 200ms ease;
  will-change: transform;
}

/* state awal (sebelum masuk) */
.detail-bubble.enter {
  transform: translate(var(--from-x), var(--from-y)) scale(.4);
  opacity: 0;
}

/* state akhir */
.detail-bubble.enter-active {
  transform: translate(0, 0) scale(1);
  opacity: 1;
}


.delete-btn {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  border: none;
  font-weight: 600;
  cursor: pointer;
}

.delete-btn:hover {
  background: #fecaca;
}

.detail-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}

.action-btn {
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid transparent;
  background: rgba(0,0,0,0.04);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}

.action-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.07);
}

/* EDIT */
.action-btn.edit {
  color: #374151; /* neutral */
}

/* DELETE (halus, tidak merah menyala) */
.action-btn.delete {
  color: #7f1d1d;
  background: rgba(127, 29, 29, 0.06);
}

.action-btn.delete:hover {
  background: rgba(127, 29, 29, 0.12);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s ease, background 0.15s ease;
}


.icon-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,0.07);
}

/* EDIT */
.icon-btn.edit {
  color: #374151; /* netral */
}

/* DELETE — halus tapi jelas */
.icon-btn.delete {
  color: #7f1d1d;
  background: rgba(127, 29, 29, 0.06);
}

.icon-btn.delete:hover {
  background: rgba(127, 29, 29, 0.12);
}

.input-error {
  border: 1.5px solid #ef4444;
}

.input-hint {
  font-size: 12px;
  color: #ef4444;
  margin-top: 4px;
}

.perfect-day {
  margin-top: 8px;
  font-size: 0.85rem;
  text-align: center;
  letter-spacing: 0.3px;
}

.perfect-day.active {
  color: #16a34a;
  font-weight: 500;
}

.cell.perfect {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.6);
}

.cell.perfect.done {
  background: linear-gradient(
    135deg,
    var(--habit-color),
    #86efac
  );
}

.cell.perfect {
  position: relative;
}

.perfect-total {
  margin-top: 4px;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.8;
}


@media (max-width: 600px) {
  .perfect-star {
    bottom: 0;
    right: 0;
    font-size: 13px;
  }
  .habit-list{
    flex-direction: column;
    align-items: center;
  }
}


.cell {
  position: relative;
  overflow: visible; /* ⬅️ PENTING */
}

.perfect-star {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  z-index: 10;
  pointer-events: none;
}

/* .cell.perfect::after {
  content: "★";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #facc15;
  z-index: 10;
} */




.grid {
  overflow: visible;
}

.login-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 50;
}

.login-screen button {
  padding: 10px 16px;
  border-radius: 999px;
  border: none;
  background: #111827;
  color: white;
  cursor: pointer;
}

.habit-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 180px));
  gap: 30px;

  justify-items: center;
  padding: 100px;
  padding-top: 80px;

}




