/* =============================================
   REFUND TRACKER — Premium Redesign
   ============================================= */

/* --- Design Tokens --- */
:root {
  /* Surfaces */
  --bg-base: #07080e;
  --bg-raised: #0d0f18;
  --bg-card: #111420;
  --bg-card-alt: #161929;
  --bg-hover: #1a1e30;
  --bg-input: #0b0d16;

  /* Borders */
  --border: rgba(255, 255, 255, 0.05);
  --border-subtle: rgba(255, 255, 255, 0.03);
  --border-focus: rgba(124, 105, 255, 0.45);

  /* Text */
  --t1: #f4f4f7;
  --t2: #a1a5bf;
  --t3: #5c6080;

  /* Accent — purple */
  --accent: #7c69ff;
  --accent-soft: rgba(124, 105, 255, 0.15);
  --accent-glow: rgba(124, 105, 255, 0.35);

  /* Semantic */
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.12);
  --green-glow: rgba(52, 211, 153, 0.35);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 999px;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  color: var(--t1);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* --- Ambient Background --- */
.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
}
.orb-1 {
  width: 600px; height: 600px;
  top: -20%; left: 30%;
  background: radial-gradient(circle, rgba(124, 105, 255, 0.25), transparent 70%);
  animation: drift 20s ease-in-out infinite alternate;
}
.orb-2 {
  width: 500px; height: 500px;
  top: 40%; right: -10%;
  background: radial-gradient(circle, rgba(52, 211, 153, 0.12), transparent 70%);
  animation: drift 25s ease-in-out infinite alternate-reverse;
}
.orb-3 {
  width: 400px; height: 400px;
  bottom: -10%; left: -5%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.1), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(40px, -30px) scale(1.08); }
}

.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* --- App Shell --- */
.app {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Nav --- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 12px;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-logo {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), #5b4ee8);
  border-radius: var(--r-sm);
  color: white;
}
.nav-title {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  color: var(--t1);
}
.nav-badge {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(52, 211, 153, 0.15);
  padding: 4px 10px;
  border-radius: var(--r-full);
  letter-spacing: 0.01em;
}

/* ===========================
   SEARCH VIEW
   =========================== */
.view-search {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0 60px;
  gap: 36px;
}

/* Hero */
.hero {
  text-align: center;
}
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 105, 255, 0.12);
  padding: 6px 14px;
  border-radius: var(--r-full);
  margin-bottom: 24px;
}
.chip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: var(--t1);
  margin-bottom: 16px;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent), #a78bfa, var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-desc {
  font-size: 1rem;
  color: var(--t2);
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Search Box */
.search-box {
  width: 100%;
  max-width: 480px;
}
.search-field {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 5px 5px 5px 18px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.search-field:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 8px 32px rgba(0, 0, 0, 0.3);
}
.search-icon {
  color: var(--t3);
  display: flex;
  flex-shrink: 0;
  transition: color 0.3s;
}
.search-field:focus-within .search-icon {
  color: var(--accent);
}
#order-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--t1);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 14px 12px;
  letter-spacing: 0.02em;
  min-width: 0;
}
#order-input::placeholder {
  color: var(--t3);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  letter-spacing: 0;
}
#search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--accent), #5b4ee8);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 13px 22px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  flex-shrink: 0;
}
#search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
#search-btn:active { transform: translateY(0); }
#search-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-spinner { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.search-error {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(248, 113, 113, 0.15);
  border-radius: var(--r-md);
  animation: slideError 0.35s ease;
}
@keyframes slideError {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Footer */
.hero-footer {
  display: flex;
  gap: 24px;
  justify-content: center;
}
.hero-footer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--t3);
  font-weight: 500;
}

/* ===========================
   RESULTS VIEW
   =========================== */
.view-results {
  padding: 8px 0 40px;
  animation: resultsIn 0.5s ease;
}
@keyframes resultsIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Back Btn */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--t3);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 20px;
  transition: color 0.2s;
}
.back-btn:hover { color: var(--t2); }

/* Result Hero */
.result-hero {
  margin-bottom: 24px;
}
.result-hero-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.order-id-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(124, 105, 255, 0.12);
  padding: 4px 10px;
  border-radius: var(--r-sm);
  letter-spacing: 0.04em;
}
.status-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--r-full);
  letter-spacing: 0.02em;
  text-transform: capitalize;
}
.status-badge.sb-requested   { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(124,105,255,0.15); }
.status-badge.sb-under_review { background: var(--amber-soft); color: var(--amber); border: 1px solid rgba(251,191,36,0.15); }
.status-badge.sb-approved    { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52,211,153,0.15); }
.status-badge.sb-processing  { background: var(--blue-soft); color: var(--blue); border: 1px solid rgba(96,165,250,0.15); }
.status-badge.sb-completed   { background: var(--green-soft); color: var(--green); border: 1px solid rgba(52,211,153,0.15); }
.status-badge.sb-denied      { background: var(--red-soft); color: var(--red); border: 1px solid rgba(248,113,113,0.15); }

.result-title {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.result-customer {
  color: var(--t2);
  font-size: 0.88rem;
  margin-top: 2px;
}

/* Metrics Grid */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.metric-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  transition: background 0.2s, border-color 0.2s;
}
.metric-card:hover {
  background: var(--bg-hover);
  border-color: rgba(255,255,255,0.07);
}
.metric-icon {
  width: 40px; height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  flex-shrink: 0;
}
.mi-method { background: var(--accent-soft); color: var(--accent); }
.mi-amount { background: var(--green-soft); color: var(--green); }
.mi-date   { background: var(--blue-soft); color: var(--blue); }
.mi-eta    { background: var(--amber-soft); color: var(--amber); }

.metric-data { display: flex; flex-direction: column; min-width: 0; }
.metric-label {
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--t3);
  margin-bottom: 1px;
}
.metric-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===========================
   TIMELINE
   =========================== */
.timeline-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 16px;
}
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.timeline-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.timeline-step-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--t3);
}

/* Horizontal Progress Track */
.progress-track {
  position: relative;
  height: 4px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  margin-bottom: 28px;
}
.progress-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--green), var(--accent));
  border-radius: 4px;
  width: 0%;
  transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.progress-nodes {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
}
.pnode {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2.5px solid rgba(255,255,255,0.08);
  position: relative;
  transition: all 0.5s ease;
}
.pnode.pn-done {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 0 10px var(--green-glow);
}
.pnode.pn-done::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 5px; height: 3px;
  border-left: 1.5px solid white;
  border-bottom: 1.5px solid white;
  transform: translate(-50%, -60%) rotate(-45deg);
}
.pnode.pn-active {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  animation: nodePulse 2s ease-in-out infinite;
}
@keyframes nodePulse {
  0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
  50% { box-shadow: 0 0 22px var(--accent-glow); }
}
.pnode.pn-denied {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.3);
}

/* Steps List */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.step-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  transition: background 0.2s;
  opacity: 0;
  animation: stepIn 0.4s ease forwards;
}
.step-row:hover {
  background: rgba(255,255,255,0.02);
}
@keyframes stepIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-num {
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}
.step-row.sr-done .step-num {
  background: var(--green-soft);
  color: var(--green);
}
.step-row.sr-active .step-num {
  background: var(--accent-soft);
  color: var(--accent);
}
.step-row.sr-pending .step-num {
  background: rgba(255,255,255,0.04);
  color: var(--t3);
}
.step-row.sr-denied .step-num {
  background: var(--red-soft);
  color: var(--red);
}

.step-info { flex: 1; min-width: 0; }
.step-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--t1);
}
.step-row.sr-pending .step-name { color: var(--t3); }

.step-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--r-full);
  flex-shrink: 0;
}
.step-tag.st-done    { background: var(--green-soft); color: var(--green); }
.step-tag.st-active  { background: var(--accent-soft); color: var(--accent); }
.step-tag.st-pending { background: rgba(255,255,255,0.04); color: var(--t3); }
.step-tag.st-denied  { background: var(--red-soft); color: var(--red); }

/* Notes */
.notes-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--blue-soft);
  border: 1px solid rgba(96, 165, 250, 0.12);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 12px;
  color: var(--blue);
}
.notes-banner p {
  font-size: 0.85rem;
  color: var(--t2);
  line-height: 1.5;
}

/* Updated */
.updated-at {
  text-align: center;
  font-size: 0.72rem;
  color: var(--t3);
  margin-top: 4px;
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 20px 0 16px;
  text-align: center;
}
.app-footer p {
  font-size: 0.75rem;
  color: var(--t3);
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 540px) {
  .hero-title { font-size: 2rem; }
  .hero-desc { font-size: 0.9rem; }
  .search-field {
    flex-direction: column;
    padding: 10px;
    gap: 0;
  }
  .search-icon { display: none; }
  #order-input {
    text-align: center;
    padding: 12px 8px;
  }
  #search-btn {
    width: 100%;
    justify-content: center;
    padding: 14px;
  }
  .metrics {
    grid-template-columns: 1fr;
  }
  .result-title { font-size: 1.3rem; }
  .timeline-container { padding: 18px; }
  .hero-footer {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
}
