/* ========== RESET & DASAR ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

.hidden {
  display: none !important;
}

/* ========== ONBOARDING ========== */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.4s, visibility 0.4s;
}

.onboarding-overlay.fade-out {
  opacity: 0;
  visibility: hidden;
}

.onboarding-card {
  text-align: center;
  max-width: 360px;
  padding: 2rem 1.5rem;
  animation: slideUp 0.5s ease-out;
}

.onboarding-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  animation: float 3s ease-in-out infinite;
}

.onboarding-title {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.brand {
  background: linear-gradient(135deg, #007aff, #5856d6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.onboarding-desc {
  color: #666;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.name-input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border: 2px solid #eaeaea;
  border-radius: 14px;
  font-size: 1rem;
  text-align: center;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
  background: #f9f9f9;
}

.name-input:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 4px rgba(0,122,255,0.1);
  background: #fff;
}

.start-btn {
  margin-top: 1.2rem;
  width: 100%;
  padding: 0.9rem;
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
}

.start-btn:hover {
  box-shadow: 0 6px 20px rgba(0,122,255,0.25);
}

.start-btn:active {
  transform: scale(0.96);
}

/* ========== POP-UP INSTALL ========== */
.install-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  padding: 1rem;
  animation: slideUp 0.4s ease-out;
}

.install-popup-card {
  background: #fff;
  border-radius: 18px;
  padding: 1.2rem 1.5rem;
  box-shadow: 0 -2px 20px rgba(0,0,0,0.1);
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.install-text {
  font-size: 0.95rem;
  margin-bottom: 1rem;
  color: #333;
}

.install-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-install {
  background: #007aff;
  color: #fff;
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-install:active {
  transform: scale(0.95);
}

.btn-later {
  background: transparent;
  color: #007aff;
  border: 1.5px solid #007aff;
  padding: 0.7rem 1.5rem;
  border-radius: 12px;
  font-weight: 500;
  cursor: pointer;
}

/* ========== APLIKASI UTAMA ========== */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 1rem 1.2rem 2rem;
}

.app-header {
  margin-bottom: 1.2rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-area {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007aff, #5856d6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}

.greeting {
  font-weight: 600;
  font-size: 0.95rem;
  color: #333;
}

.app-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: 0.8rem;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #007aff, #5856d6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleReveal 0.8s ease-out;
}

/* ========== TAB NAVIGASI ========== */
.tab-nav {
  display: flex;
  gap: 0.3rem;
  background: #f5f5f7;
  border-radius: 12px;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  color: #888;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.tab-btn.active {
  background: #fff;
  color: #007aff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease-out;
}

/* ========== INPUT TUGAS ========== */
.add-task {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

#task-input {
  flex: 1;
  padding: 0.85rem 1rem;
  border: 2px solid #f0f0f0;
  border-radius: 14px;
  font-size: 0.95rem;
  background: #fafafa;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}

#task-input:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
  background: #fff;
}

.add-btn-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #007aff;
  color: #fff;
  border: none;
  font-size: 1.6rem;
  font-weight: 300;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.add-btn-circle:hover {
  box-shadow: 0 6px 18px rgba(0,122,255,0.3);
}

.add-btn-circle:active {
  transform: scale(0.9);
}

/* ========== DAFTAR TUGAS ========== */
.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  background: #fff;
  border: 1px solid #f2f2f2;
  border-radius: 14px;
  margin-bottom: 0.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  transform-style: preserve-3d;
  perspective: 600px;
}

.task-item:hover {
  transform: rotateY(1.5deg) translateY(-1px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.04);
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #d1d1d6;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
}

.task-checkbox.checked {
  background: #34c759;
  border-color: #34c759;
}

.task-text {
  flex: 1;
  font-size: 0.95rem;
  cursor: pointer;
}

.task-edit-input {
  flex: 1;
  font-size: 0.95rem;
  border: 2px solid #007aff;
  border-radius: 8px;
  padding: 0.3rem 0.5rem;
  outline: none;
}

.task-actions {
  display: flex;
  gap: 0.3rem;
}

.action-btn {
  background: transparent;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  transition: background 0.2s, transform 0.1s;
}

.action-btn:hover {
  background: #f5f5f5;
}

.action-btn:active {
  transform: scale(0.85);
}

.edit-btn { color: #ff9500; }
.delete-btn { color: #ff3b30; }

.empty-msg {
  color: #aaa;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.9rem;
  display: none;
}

.empty-msg.visible {
  display: block;
}

/* ========== RIWAYAT ========== */
.history-controls {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  justify-content: center;
}

.btn-secondary {
  background: #f5f5f7;
  border: 1px solid #e5e5ea;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  color: #333;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-secondary:hover {
  background: #ebebed;
}

.history-date-group {
  margin-bottom: 1.5rem;
}

.history-date-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  padding-left: 0.3rem;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 0.7rem 1rem;
  background: #fafafa;
  border-radius: 12px;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
  color: #555;
  gap: 0.7rem;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;
  flex-shrink: 0;
}

.history-text {
  flex: 1;
  text-decoration: line-through;
  text-decoration-color: #ccc;
}

/* ========== ANIMASI ========== */
@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes titleReveal {
  from { opacity: 0; letter-spacing: 2px; }
  to { opacity: 1; letter-spacing: -0.5px; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Animasi saat task selesai */
.task-item.completing {
  animation: completePop 0.4s ease-out;
}

@keyframes completePop {
  0% { transform: scale(1); }
  40% { transform: scale(1.04) rotateY(5deg); }
  100% { transform: scale(1); }
}

/* Animasi saat task dihapus */
.task-item.deleting {
  animation: deleteOut 0.25s ease-in forwards;
}

@keyframes deleteOut {
  to { transform: scale(0.9) rotateX(8deg); opacity: 0; }
}