/* transactions.css — LedgerSync transaction page styles */

/* ── LAYOUT ── */
.app-main {
  min-height: calc(100vh - 64px);
  background: var(--bg);
  padding: 40px 0;
}

.app-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── STATS BAR ── */
.stats-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 100px;
  letter-spacing: 0.2px;
}

.stat-accuracy { background: rgba(34,197,94,0.15); color: #16a34a; }
.stat-accuracy svg { stroke: #16a34a; }

/* ── IMPORT SECTION ── */
.import-section {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(27,42,74,0.06);
}

.import-hint {
  font-size: 13px;
  color: var(--text-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  border: none;
}

.btn-primary {
  background: var(--amber);
  color: var(--navy);
}

.btn-primary:hover {
  background: #d4962e;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── FILTER BAR ── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  border: 1px solid rgba(27,42,74,0.12);
  background: var(--white);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-chip:hover { color: var(--navy); border-color: rgba(27,42,74,0.3); }

.filter-chip.active {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

/* ── TRANSACTION LIST ── */
.tx-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--white);
  border-radius: 12px;
  border: 1px solid rgba(27,42,74,0.06);
  overflow: hidden;
}

.tx-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px 140px 60px;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(27,42,74,0.06);
  cursor: pointer;
  transition: background 0.1s;
}

.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: var(--bg); }

.tx-date {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.tx-desc {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tx-amount {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tx-amount.credit  { color: #16a34a; }
.tx-amount.debit   { color: var(--text); }
.tx-amount::before { content: ''; }

/* ── CATEGORY BADGE ── */
.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.cat-badge:hover { filter: brightness(0.9); }

.cat-badge.very-high { background: rgba(34,197,94,0.15); color: #16a34a; }
.cat-badge.high      { background: rgba(34,197,94,0.1); color: #15803d; }
.cat-badge.medium    { background: rgba(232,168,56,0.15); color: #b45309; }
.cat-badge.low       { background: rgba(239,68,68,0.12); color: #dc2626; }

/* ── CONFIDENCE DOT ── */
.conf-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  justify-self: center;
}
.conf-dot.vhigh { background: #22c55e; }
.conf-dot.high  { background: #84cc16; }
.conf-dot.med   { background: #e8a838; }
.conf-dot.low   { background: #ef4444; }

/* ── EMPTY STATE ── */
.tx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
}

.tx-empty svg { opacity: 0.3; }
.tx-empty p { font-size: 16px; font-weight: 500; color: var(--navy); }
.tx-empty-sub { font-size: 14px; color: var(--text-muted); font-weight: 400; }

/* ── LOADING ── */
.tx-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 14px;
  gap: 10px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(27,42,74,0.1);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── MODAL ── */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27,42,74,0.4);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(27,42,74,0.15);
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover { color: var(--navy); }

.modal-tx-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Category grid */
.cat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cat-choice {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(27,42,74,0.1);
  background: var(--bg);
  font-size: 13px;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s;
}

.cat-choice:hover {
  background: var(--navy);
  color: var(--white);
  border-color: var(--navy);
}

.cat-choice.selected {
  background: var(--amber);
  color: var(--navy);
  border-color: var(--amber);
}

/* ── RESPONSIVE ── */
@media (max-width: 680px) {
  .tx-row {
    grid-template-columns: 80px 1fr 90px 48px;
  }
  .cat-badge-text { display: none; }
  .tx-amount { font-size: 13px; }
}

@media (max-width: 480px) {
  .app-container { padding: 0 16px; }
  .tx-row {
    grid-template-columns: 1fr 80px 48px;
    grid-template-rows: auto auto;
    gap: 4px 12px;
  }
  .tx-desc { grid-column: 1 / -1; font-size: 13px; }
  .filter-bar { gap: 6px; }
}