/* app.css — PayHound app UI styles (extends theme.css) */

/* ── App chrome ── */
.app-body {
  background: var(--bg);
  min-height: 100vh;
}

.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.app-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 16px;
}

.nav-links {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-link.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user {
  font-size: 14px;
  color: var(--fg-muted);
  font-family: var(--font-display);
}

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Page headers ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.page-sub {
  font-size: 14px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:hover { opacity: 0.88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: #0a0a0c;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--fg-dim);
  color: var(--fg);
  opacity: 1;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Summary stat row ── */
.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.summary-label {
  font-size: 12px;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-dim);
  margin-bottom: 8px;
}

.summary-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.summary-value.accent { color: var(--accent); }
.summary-value.red { color: var(--red); }
.summary-value.green { color: var(--green); }

/* ── Invoice table ── */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-table th {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg-dim);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.invoice-table td {
  padding: 14px 16px;
  font-size: 15px;
  color: var(--fg);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

.invoice-table tr:hover td {
  background: rgba(255,255,255,0.02);
}

.invoice-table a {
  color: inherit;
  text-decoration: none;
}

.invoice-table a:hover {
  color: var(--accent);
}

/* ── Status badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge-pending {
  background: rgba(240, 180, 41, 0.12);
  color: var(--accent);
}

.badge-overdue {
  background: rgba(248, 113, 113, 0.12);
  color: var(--red);
}

.badge-escalated {
  background: rgba(248, 113, 113, 0.2);
  color: #ff4444;
}

.badge-paid {
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
}

/* ── Reliability score ── */
.score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
}

.score-high { color: var(--green); }
.score-mid { color: var(--accent); }
.score-low { color: var(--red); }

/* ── Forms ── */
.form-card {
  max-width: 600px;
}

.form-grid {
  display: grid;
  gap: 20px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-input,
.form-textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--accent);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 12px;
  color: var(--fg-dim);
}

/* ── Error / alert ── */
.alert {
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--red);
}

.alert-success {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--green);
}

/* ── Auth page ── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 40px 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  margin-bottom: 8px;
  text-decoration: none;
  display: block;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  text-align: center;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 14px;
  color: var(--fg-muted);
  text-align: center;
  margin-bottom: 28px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--fg-muted);
}

.auth-switch a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

/* ── Timeline / log ── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

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

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

.timeline-type {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  text-transform: capitalize;
}

.timeline-meta {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 2px;
}

/* ── Empty states ── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 8px;
}

.empty-sub {
  font-size: 15px;
  color: var(--fg-muted);
  margin-bottom: 24px;
}

/* ── Filter tabs ── */
.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.filter-tab {
  padding: 6px 14px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.15s;
}

.filter-tab:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.filter-tab.active {
  background: var(--accent-glow);
  border-color: rgba(240, 180, 41, 0.2);
  color: var(--accent);
}

/* ── Detail page ── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.detail-field {
  margin-bottom: 20px;
}

.detail-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--fg-dim);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 16px;
  color: var(--fg);
}

.amount-display {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin-bottom: 4px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .summary-row { grid-template-columns: 1fr 1fr; }
  .app-nav-inner { gap: 16px; }
  .nav-links { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
