/* ClearBill App Styles — matches landing page design language */

:root {
  --ink: #0a0f1a;
  --slate: #3d4663;
  --mist: #8892b0;
  --ice: #e8ecf4;
  --snow: #f7f8fc;
  --white: #ffffff;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --teal-glow: rgba(13, 148, 136, 0.12);
  --coral: #f97066;
  --coral-glow: rgba(249, 112, 102, 0.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'DM Sans', sans-serif;
  color: var(--ink);
  background: var(--white);
  line-height: 1.6;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; line-height: 1.15; }

/* ─── NAV ─── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.25rem 2rem;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--ice);
}
.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.5px;
}
.logo span { color: var(--teal); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-links a {
  color: var(--slate);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links a:hover { color: var(--teal); }
.nav-links .btn-nav {
  background: var(--teal);
  color: var(--white) !important;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
}

/* ─── PAGE LAYOUT ─── */
.page-wrapper {
  padding-top: 5rem;
  min-height: 100vh;
  background: var(--snow);
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--slate);
  max-width: 520px;
  margin: 0 auto;
}

/* ─── UPLOAD CARD ─── */
.upload-card {
  background: var(--white);
  border-radius: 20px;
  padding: 3rem;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  border: 1px solid var(--ice);
}

.drop-zone {
  border: 2px dashed var(--ice);
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 1.5rem;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--teal);
  background: var(--teal-glow);
}

.drop-zone-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.drop-zone h3 {
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.drop-zone p {
  color: var(--mist);
  font-size: 0.9rem;
}

.upload-form { display: flex; flex-direction: column; gap: 1.5rem; }

.form-group { display: flex; flex-direction: column; gap: 0.5rem; }

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type="text"] {
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--ice);
  border-radius: 10px;
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  transition: border-color 0.2s;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--teal);
}

.btn-primary {
  background: var(--teal);
  color: var(--white);
  border: none;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  width: 100%;
}

.btn-primary:hover { background: var(--teal-light); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── RESULT PAGE ─── */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--white);
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  border: 1px solid var(--ice);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--mist);
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}

.stat-card.savings .stat-value { color: var(--teal); }
.stat-card.errors .stat-value { color: var(--coral); }

.stat-card .stat-sub {
  font-size: 0.85rem;
  color: var(--mist);
  margin-top: 0.5rem;
}

/* ─── ERRORS LIST ─── */
.errors-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  border: 1px solid var(--ice);
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-item {
  padding: 1.25rem;
  background: var(--snow);
  border-radius: 12px;
  border-left: 4px solid var(--coral);
  margin-bottom: 1rem;
}

.error-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--coral);
  margin-bottom: 0.5rem;
}

.error-item h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.error-item p {
  font-size: 0.9rem;
  color: var(--slate);
  line-height: 1.5;
}

.error-savings {
  margin-top: 0.75rem;
  display: inline-block;
  background: var(--teal-glow);
  color: var(--teal);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

/* ─── DISPUTE LETTER ─── */
.letter-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  border: 1px solid var(--ice);
  margin-bottom: 2rem;
}

.letter-content {
  background: var(--snow);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  white-space: pre-wrap;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--slate);
  font-family: 'DM Sans', serif;
}

.btn-secondary {
  background: var(--white);
  color: var(--teal);
  border: 2px solid var(--teal);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-secondary:hover {
  background: var(--teal);
  color: var(--white);
}

/* ─── STATUS POLLING ─── */
.analysis-progress {
  text-align: center;
  padding: 3rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--ice);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

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

.progress-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.5rem;
}

.progress-sub { color: var(--mist); font-size: 0.9rem; }

/* ─── NO ERRORS STATE ─── */
.clean-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--ice);
}

.clean-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.clean-state h2 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.clean-state p { color: var(--mist); font-size: 0.95rem; }

/* ─── FILE PREVIEW ─── */
.file-preview {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--snow);
  border-radius: 10px;
  margin-top: 1rem;
}

.file-preview .file-icon { font-size: 1.5rem; }
.file-preview .file-info { flex: 1; }
.file-preview .file-name { font-weight: 600; font-size: 0.9rem; }
.file-preview .file-size { color: var(--mist); font-size: 0.8rem; }