@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0066FF;
  --primary-light: #E6F0FF;
  --primary-dark: #0052CC;
  --success: #00C853;
  --success-light: #E8F5E9;
  --danger: #FF3B30;
  --danger-light: #FFEBEE;
  --text-primary: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-tertiary: #9E9E9E;
  --bg-primary: #F5F7FA;
  --bg-secondary: #FFFFFF;
  --border: #E5E5E5;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
}

/* Header */
header {
  background: var(--bg-secondary);
  padding: 24px;
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.date {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.header-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-icon:hover {
  transform: scale(1.05);
  background: var(--primary);
  color: white;
}

/* Balance Card */
.balance-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 28px;
  border-radius: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-lg);
  color: white;
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.balance-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.balance-card:hover::before {
  transform: scale(1.2);
}

.balance-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.balance-label {
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
}

.balance-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.balance-amount {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.balance-amount.pulse-animate {
  animation: numberPulse 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes numberPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Balance Info (Simple Row) */
.balance-info {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  position: relative;
  z-index: 1;
}

.info-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-label {
  font-size: 11px;
  opacity: 0.8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.info-divider {
  width: 1px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.2s backwards;
}

.stat-card {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card:active {
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-icon.cash {
  background: var(--success-light);
  color: var(--success);
}

.stat-icon.qris {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-card:hover .stat-icon {
  transform: rotate(-5deg) scale(1.05);
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 28px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.3s backwards;
}

.btn {
  padding: 16px 24px;
  border: none;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary:active {
  transform: translateY(0);
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.4s backwards;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.filter-select {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', sans-serif;
}

.filter-select:hover {
  border-color: var(--primary);
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Transaction List */
.transaksi-list {
  background: var(--bg-secondary);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.5s backwards;
}

.transaksi-item {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.transaksi-item:last-child {
  border-bottom: none;
}

.transaksi-item:hover {
  background: var(--bg-primary);
}

.transaksi-info {
  flex: 1;
}

.transaksi-tipe {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.transaksi-tipe.masuk {
  color: var(--success);
}

.transaksi-tipe.keluar {
  color: var(--danger);
}

.transaksi-detail {
  font-size: 13px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.transaksi-nominal {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.btn-delete {
  background: var(--danger-light);
  color: var(--danger);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: bold;
}

.btn-delete:hover {
  background: var(--danger);
  color: white;
  transform: rotate(90deg);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
  font-size: 14px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.modal.show {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}

.modal-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: 28px 28px 0 0;
  padding: 24px 24px 32px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
  animation: slideUpModal 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUpModal {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.modal-content form {
  width: 100%;
  overflow-x: hidden;
}

.amount-display,
.payment-grid,
.note-input,
.btn-save {
  max-width: 100%;
  box-sizing: border-box;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: var(--bg-primary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
  transform: rotate(90deg);
}

.modal-close:active {
  transform: rotate(90deg) scale(0.9);
}

/* Amount Display */
.amount-display {
  background: linear-gradient(135deg, var(--primary-light) 0%, #F0F4FF 100%);
  border: 2px solid var(--primary);
  border-radius: 20px;
  padding: 24px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;  /* ← TAMBAHIN INI */
  max-width: 100%;  /* ← TAMBAHIN INI */
}

.amount-display:focus-within {
  border-color: var(--primary-dark);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
  transform: translateY(-2px);
}

.amount-currency {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.amount-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Inter', sans-serif;
  outline: none;
  min-width: 0;  /* ← TAMBAHIN INI */
  max-width: 100%;  /* ← TAMBAHIN INI */
  overflow: hidden;  /* ← TAMBAHIN INI */
  text-overflow: ellipsis;  /* ← TAMBAHIN INI */
  white-space: nowrap;  /* ← TAMBAHIN INI */
}

.amount-input::placeholder {
  color: rgba(0, 102, 255, 0.3);
}

/* Form Section */
.form-section {
  margin-bottom: 24px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.optional-badge {
  background: var(--bg-primary);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
}

/* Payment Grid */
.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px;  /* ← TAMBAHIN padding biar gak kepotong */
}

.payment-card {
  cursor: pointer;
  position: relative;
  margin: 2px;
}

.payment-card input[type="radio"] {
  display: none;
}

.payment-content {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.payment-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cash-icon {
  background: var(--success-light);
  color: var(--success);
}

.qris-icon {
  background: var(--primary-light);
  color: var(--primary);
}

.payment-label {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-secondary);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.payment-check {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.payment-card:hover .payment-content {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.15);
}

.payment-card input:checked + .payment-content {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: scale(1.00);
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.2);
}

.payment-card input:checked + .payment-content .payment-icon {
  transform: scale(1.1);
}

.payment-card input:checked + .payment-content .payment-label {
  color: var(--primary);
}

.payment-card input:checked + .payment-content .payment-check {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}

/* Note Input */
.note-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.note-input::placeholder {
  color: var(--text-tertiary);
}

.note-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.1);
  transform: translateY(-1px);
}

/* Save Button */
.btn-save {
  width: 100%;
  padding: 18px 24px;
  background: var(--primary);
  border: none;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.3);
  position: relative;
  overflow: hidden;
  margin-top: 28px;
}

.btn-save::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-save:active::before {
  width: 400px;
  height: 400px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-save:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 102, 255, 0.4);
}

.btn-save:hover .btn-icon {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.3);
}

.btn-save:active {
  transform: translateY(0);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--success);
  color: white;
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  font-weight: 600;
  font-size: 15px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(10px);
}

.toast.keluar {
  background: var(--danger);
}

@keyframes toastSlideUp {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.toast::before {
  content: "✓";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  font-size: 14px;
  animation: checkBounce 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkBounce {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.3);
  }
}

/* Responsive */
@media (max-width: 480px) {
  .container {
    padding: 16px;
  }
  
  .balance-amount {
    font-size: 32px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Confirmation Modal */
.confirm-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.confirm-modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.confirm-backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.confirm-content {
  position: relative;
  background: var(--bg-secondary);
  border-radius: 24px;
  padding: 32px 28px;
  width: 90%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
  animation: confirmPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes confirmPop {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.confirm-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  background: var(--danger-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  animation: iconShake 0.5s ease-in-out;
}

@keyframes iconShake {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-8deg);
  }
  75% {
    transform: rotate(8deg);
  }
}

.confirm-content h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.confirm-content p {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-confirm-cancel,
.btn-confirm-delete {
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', sans-serif;
}

.btn-confirm-cancel {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.btn-confirm-cancel:hover {
  background: var(--border);
  transform: translateY(-2px);
}

.btn-confirm-delete {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.btn-confirm-delete:hover {
  background: #E63027;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 59, 48, 0.4);
}

.btn-confirm-cancel:active,
.btn-confirm-delete:active {
  transform: translateY(0);
}
