/* ============================================================
   PAGE: ENTRY MODAL (FAB) + EDIT MODAL
   ============================================================ */

/* ============================================================
   ENTRY MODAL — Bottom sheet input pemasukan / pengeluaran
   ============================================================ */
.entry-modal {
  background: #fff;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  border-radius: 24px 24px 0 0;
  display: flex;
  flex-direction: column;
  max-height: 95vh;
  animation: slideUp .3s cubic-bezier(.32,.72,0,1);
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ============ HEAD ============ */
.entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.entry-head h3 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.3px;
}
.entry-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--red-soft);
  color: #DC2626;
  display: grid;
  place-items: center;
  font-size: 16px;
}

/* ============ BODY ============ */
.entry-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  scrollbar-width: thin;
}
.entry-body::-webkit-scrollbar { width: 5px; }
.entry-body::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 10px;
}

/* ============ TABS ============ */
.entry-tabs {
  display: flex;
  background: var(--bg);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 18px;
}
.entry-tab {
  flex: 1;
  padding: 10px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
  transition: .2s;
}
.entry-tab.active {
  background: #fff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.entry-tab.active[data-type="expense"] { color: #DC2626; }
.entry-tab.active[data-type="income"]  { color: #059669; }

/* ============ CAT HEAD ============ */
.cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.cat-head a {
  color: var(--blue);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  font-size: 12px;
}

/* ============ SEARCH BOX ============ */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.search-box svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  fill: none;
  flex-shrink: 0;
}
.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}

/* ============ CAT GRID ============ */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 4px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: #fff;
  transition: .15s;
  text-align: center;
}
.cat-item.active {
  border-color: var(--green);
  background: var(--green-soft);
}
.cat-item.active .cat-icon { background: #fff; }
.cat-item.active .cat-name { color: #059669; }
.cat-item.add {
  border-style: dashed;
  color: var(--muted);
}
.cat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.cat-name {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--navy-2);
}

/* ============ FOOTER ============ */
.entry-foot {
  border-top: 1px solid var(--border);
  padding: 14px 20px calc(16px + env(safe-area-inset-bottom));
  background: #fff;
  flex-shrink: 0;
}
.amount-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 10px;
}
.amount-row .label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.amount-row .val {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: var(--navy);
}
.amount-row .val.expense { color: #DC2626; }
.amount-row .val.income  { color: #059669; }

/* ============ NUMPAD ============ */
.numpad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.numpad button {
  padding: 14px 0;
  border-radius: 12px;
  background: var(--bg);
  font-weight: 700;
  font-size: 17px;
  color: var(--navy);
  transition: .1s;
}
.numpad button:active { transform: scale(.94); }
.numpad button.op {
  background: var(--blue-soft);
  color: #2563EB;
}
.numpad button.clear {
  background: var(--red-soft);
  color: #DC2626;
}

/* ============ SUBMIT ============ */
.entry-submit {
  width: 100%;
  padding: 15px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0F172A, #1E293B);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  transition: .15s;
}
.entry-submit:active { transform: scale(.98); }
.entry-submit.income  { background: linear-gradient(135deg, #10B981, #059669); }
.entry-submit.expense { background: linear-gradient(135deg, #EF4444, #DC2626); }

/* ============================================================
   EDIT MODAL — Additional styles
   ============================================================ */
.edit-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.edit-color-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 6px;
}
.edit-color-btn {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: .15s;
}
.edit-color-btn.active {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px #fff inset;
}

/* Preview box di atas form edit */
.edit-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  margin-bottom: 16px;
}
.edit-preview .icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--blue-soft);
  color: #2563EB;
  flex-shrink: 0;
}
.edit-preview .info { flex: 1; min-width: 0; }
.edit-preview .info h4 {
  font-size: 14px;
  font-weight: 800;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edit-preview .info p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ============================================================
   DESKTOP
   ============================================================ */
@media (min-width: 900px) {
  .entry-modal {
    border-radius: 24px;
    max-height: 90vh;
    animation: pop .25s cubic-bezier(.34,1.56,.64,1);
  }
  @keyframes pop {
    from { transform: scale(.94); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
  }
  .cat-grid { grid-template-columns: repeat(5, 1fr); }
  .cat-item { padding: 14px 4px; }
  .edit-icon-grid  { grid-template-columns: repeat(8, 1fr); }
  .edit-color-grid { grid-template-columns: repeat(8, 1fr); }
}
/* ============================================================
   CONFIRM MODAL
   ============================================================ */
.confirm-modal {
  background: #fff;
  border-radius: 20px;
  padding: 26px 22px 20px;
  max-width: 380px;
  width: 100%;
  margin: auto;
  text-align: center;
  animation: pop .25s cubic-bezier(.34,1.56,.64,1);
  box-shadow: 0 20px 60px rgba(15,23,42,.3);
}
.confirm-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--red-soft);
  color: #DC2626;
  display: grid;
  place-items: center;
  font-size: 28px;
  margin: 0 auto 14px;
}
.confirm-icon.info { background: var(--blue-soft); color: #2563EB; }
.confirm-icon.warn { background: var(--orange-soft); color: #D97706; }

.confirm-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
  letter-spacing: -.3px;
}
.confirm-message {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 20px;
}
.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.confirm-btn {
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  transition: .15s;
}
.confirm-btn:active { transform: scale(.97); }
.confirm-btn.cancel {
  background: var(--bg);
  color: var(--navy-2);
}
.confirm-btn.danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,.3);
}
.confirm-btn.confirm {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}

/* Loading state untuk tombol */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: .7;
}
.btn-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}