/* =========================
   APP HEADER ALIGNMENT FIX
========================= 

/* =========================
   RESET & BASE
========================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  background: #f6ede3;
  color: #1f2933;
  padding-bottom: 96px;
}

/* =========================
   APP HEADER
========================= */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.header-content {
  max-width: 420px;
  margin: 0 auto;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.header-left {
  height: 1px;
}

.header-center {
  justify-self: center;
}

.header-right {
  justify-self: end;
}

/* =========================
   CONNECTION STATUS
========================= */

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #ecfdf3;
  color: #166534;
  font-size: 0.75rem;
  font-weight: 600;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
}

/* =========================
   SUNKEN BALANCE CHIP
========================= */

.header-balance {
  font-weight: 700;
  font-size: 0.85rem;
}

.sunken-balance {
  padding: 8px 14px;
  border-radius: 14px;
  color: #1f2933;
  background: #f3f4f6;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.08),
    inset 0 -1px 2px rgba(255, 255, 255, 0.6);
}

/* =========================
   APP LAYOUT
========================= */

.app {
  max-width: 420px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

.card-header {
  margin-bottom: 24px;
}

.app-title {
  font-size: 1.6rem;
  font-weight: 600;
}

.app-subtitle {
  margin-top: 6px;
  color: #6b7280;
  font-size: 0.95rem;
}

/* =========================
   BALANCE / LEDGER
========================= */

.balance-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.balance-card {
  padding: 16px 18px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.balance-card.highlight {
  background: #f3f6fa;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-amount {
  font-weight: 600;
}

/* =========================
   PAY STATUS
========================= */

.pay-status {
  margin-top: 24px;
  padding: 28px 20px;
  border-radius: 18px;
  background: #f9fafb;
  text-align: center;
}

.pay-indicator {
  width: 22px;
  height: 22px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #1f2933;
  animation: pulse 1.8s ease-in-out infinite;
}

.pay-state-title {
  font-size: 1.3rem;
  font-weight: 600;
}

.pay-state-subtitle {
  font-size: 0.9rem;
  color: #6b7280;
}

/* States */

.pay-status.approved .pay-indicator {
  background: #22c55e;
  animation: none;
  transform: scale(1.3);
}

.pay-status.declined .pay-indicator {
  background: #ef4444;
  animation: none;
}

.pay-status.authorizing .pay-indicator {
  background: #6b7280;
  animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.4; transform: scale(0.9); }
}

/* =========================
   FUNDING SOURCES
========================= */

.funding-source {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.funding-pills {
  display: flex;
  gap: 10px;
}

.funding-pill {
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #f3f6fa;
  border: 1px solid rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
}

.funding-pill.active {
  background: #1f2933;
  color: #ffffff;
  border-color: #1f2933;
}

/* =========================
   FOOTER NAVIGATION
========================= */

.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  z-index: 100;
  display: flex;
  align-items: center;
}

.bottom-nav {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.nav-item {
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
}

.nav-item.active {
  color: #1f2933;
}

/* ✅ LEGACY FOOTER ALIGNMENT (CRITICAL) */
.nav-item:first-child {
  justify-self: start;
}

.nav-item:last-child {
  justify-self: end;
}

.pay-button {
  justify-self: center;
  padding: 12px 28px;
  border-radius: 999px;
  background: #1f2933;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* =========================
   AUTH / RECOVERY FORMS
========================= */

/* Full-width, calm input fields */
.text-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  font-size: 0.95rem;
  font-weight: 500;
  background: #ffffff;
  color: #1f2933;
  outline: none;
  transition: border 0.15s ease, box-shadow 0.15s ease;
}

.text-input::placeholder {
  color: #9ca3af;
  font-weight: 500;
}

.text-input:focus {
  border-color: #1f2933;
  box-shadow: 0 0 0 3px rgba(31, 41, 51, 0.08);
}

/* Space inputs nicely in recovery cards */
.balance-content .text-input {
  margin-bottom: 14px;
}

/* =========================
   HEADER FIX FOR AUTH PAGES
========================= */

/*
  When header-center and header-right are empty
  (login / recovery pages), the header looked collapsed.
  This stabilizes vertical rhythm WITHOUT affecting
  main app pages.
*/

.app-header .header-content {
  min-height: 48px;
}

/* Brand alignment for auth pages */
.brand-wordmark {
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 700;
  color: #1f2933;
  letter-spacing: 0.02em;
}

/* Ensure header-left actually occupies space */
.header-left {
  display: flex;
  align-items: center;
}

/* =========================
   AUTH BUTTON CONSISTENCY
========================= */

/* Buttons on auth pages should breathe */
.balance-content .pay-button {
  margin-top: 6px;
}

/* Secondary links spacing */
.link-secondary {
  display: inline-block;
  margin-top: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  text-decoration: none;
}

.link-secondary:hover {
  text-decoration: underline;
}
