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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* Auth */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-title {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: #16213e;
  margin-bottom: 24px;
}

.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: #f0f2f5;
  border-radius: 10px;
  padding: 3px;
}

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

.auth-tab.active {
  background: #fff;
  color: #16213e;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-form input {
  padding: 12px 14px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.auth-form input:focus {
  border-color: #0f3460;
}

.auth-message {
  display: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.auth-message.error {
  display: block;
  background: #fef0f0;
  color: #e74c3c;
  border: 1px solid #f5c6cb;
}

.auth-message.success {
  display: block;
  background: #f0fef4;
  color: #27ae60;
  border: 1px solid #c3e6cb;
}

/* User bar */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.user-email {
  font-size: 0.8rem;
  color: #888;
}

.user-bar .btn-icon {
  font-size: 0.8rem;
  color: #aaa;
  padding: 2px 6px;
}

.user-bar .btn-icon:hover {
  color: #e74c3c;
  background: #fef0f0;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

header {
  text-align: center;
  margin-bottom: 24px;
}

header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #16213e;
}

/* Toplam Birikim */
.total-section {
  background: linear-gradient(135deg, #0f3460, #16213e);
  color: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  margin-bottom: 16px;
}

.total-label {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.total-amount {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -1px;
}

/* Hedef */
.goal-section {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

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

.goal-label {
  font-size: 0.9rem;
  color: #555;
}

.goal-label strong {
  color: #1a1a2e;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  color: #555;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: #f0f2f5;
}

.progress-bar-container {
  background: #e8ecf1;
  border-radius: 8px;
  height: 12px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #0f3460, #533483);
  border-radius: 8px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 0.8rem;
  color: #777;
  margin-top: 6px;
  text-align: right;
}

.goal-form {
  margin-top: 12px;
}

.goal-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.goal-form input:focus {
  border-color: #0f3460;
}

.goal-form-actions {
  display: flex;
  gap: 8px;
}

/* Birikim Ekleme */
.add-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.add-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

#addForm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#addForm input {
  padding: 12px 14px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

#addForm input:focus {
  border-color: #0f3460;
}

/* Butonlar */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-primary {
  background: #0f3460;
  color: #fff;
  padding: 14px;
  font-size: 1rem;
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.85rem;
  background: #0f3460;
  color: #fff;
}

.btn-secondary {
  background: #e8ecf1;
  color: #555;
}

/* Birikim Geçmişi */
.history-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.history-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.empty-state {
  text-align: center;
  color: #999;
  padding: 24px 0;
  font-size: 0.9rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #f0f2f5;
}

.history-item:last-child {
  border-bottom: none;
}

.history-item-info {
  flex: 1;
}

.history-item-amount {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f3460;
}

.history-item-note {
  font-size: 0.8rem;
  color: #888;
  margin-top: 2px;
}

.history-item-date {
  font-size: 0.75rem;
  color: #aaa;
  margin-top: 2px;
}

.history-item-delete {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.history-item-delete:hover {
  color: #e74c3c;
  background: #fef0f0;
}

/* Rozetler */
.badges-section {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.badges-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.badges-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.badges-count {
  font-size: 0.8rem;
  color: #888;
  background: #f0f2f5;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

@media (max-width: 400px) {
  .badges-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.badge-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  background: #f8f4ff;
  border: 2px solid #e8e0f0;
  transition: transform 0.3s, box-shadow 0.3s;
}

.badge-item.unlocked .badge-icon {
  background: linear-gradient(135deg, #f8f4ff, #ede4ff);
  border-color: #c9b3e8;
  box-shadow: 0 2px 8px rgba(83, 52, 131, 0.15);
}

.badge-item.unlocked .badge-icon:hover {
  transform: scale(1.15);
}

.badge-item.locked .badge-icon {
  background: #f0f2f5;
  border-color: #e0e0e0;
  filter: grayscale(1);
  opacity: 0.35;
}

.badge-name {
  font-size: 0.65rem;
  color: #555;
  font-weight: 500;
  line-height: 1.2;
}

.badge-item.locked .badge-name {
  color: #bbb;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.badge-toast {
  background: #fff;
  border: 1.5px solid #e8e0f0;
  border-radius: 12px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  animation: toastIn 0.4s ease, toastOut 0.4s ease 2.6s forwards;
  pointer-events: auto;
  white-space: nowrap;
}

.badge-toast-icon {
  font-size: 1.5rem;
}

.badge-toast-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1a1a2e;
}

.badge-toast-text small {
  display: block;
  font-weight: 400;
  color: #888;
  font-size: 0.75rem;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Pulse animasyonu — toplam kart */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(83, 52, 131, 0); }
  50% { transform: scale(1.02); box-shadow: 0 0 24px rgba(83, 52, 131, 0.25); }
  100% { transform: scale(1); box-shadow: 0 0 0 rgba(83, 52, 131, 0); }
}

.total-section.pulse {
  animation: pulse 0.6s ease;
}

/* Slide-in animasyonu — yeni geçmiş kaydı */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.history-item-new {
  animation: slideIn 0.4s ease;
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}
