/* ============================================================
   DESIGN TOKENS & BASE
   ============================================================ */
:root {
  --indigo-950: #1e1b4b;
  --indigo-900: #312e81;
  --indigo-600: #4f46e5;
  --indigo-500: #6366f1;
  --indigo-100: #e0e7ff;
  --indigo-50:  #eef2ff;
  --emerald-500: #10b981;
  --emerald-100: #d1fae5;
  --amber-500: #f59e0b;
  --amber-100: #fef3c7;
  --rose-500: #f43f5e;
  --rose-100: #ffe4e6;
  --shadow-card: 0 1px 3px 0 rgb(0 0 0 / 0.07), 0 1px 2px -1px rgb(0 0 0 / 0.07);
  --shadow-lift: 0 10px 30px -8px rgb(0 0 0 / 0.15), 0 4px 8px -4px rgb(0 0 0 / 0.1);
  --shadow-modal: 0 25px 60px -10px rgb(0 0 0 / 0.35), 0 8px 20px -8px rgb(0 0 0 / 0.2);
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

body {
  font-family: 'DM Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.font-serif-display {
  font-family: 'Instrument Serif', Georgia, serif;
}

/* ============================================================
   HEADER — GLASSMORPHISM
   ============================================================ */
header {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(99, 102, 241, 0.08) !important;
  box-shadow: 0 1px 0 0 rgba(99, 102, 241, 0.06), 0 4px 16px -4px rgba(0,0,0,0.06);
}

/* ============================================================
   HERO SECTION
   ============================================================ */
#section-hero {
  background: linear-gradient(135deg, #0f0c29 0%, #1e1b4b 40%, #2d2a6e 75%, #312e81 100%) !important;
  position: relative;
  overflow: hidden;
}

#section-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 50%, rgba(99,102,241,0.15) 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, rgba(139,92,246,0.1) 0%, transparent 40%),
                    url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* ============================================================
   UPLOAD DROPZONE
   ============================================================ */
.upload-zone {
  position: relative;
  border: 2px dashed rgba(99, 102, 241, 0.35) !important;
  background: linear-gradient(145deg, #fafafe 0%, #f5f3ff 100%) !important;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  overflow: hidden;
}

.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at center, rgba(99,102,241,0.04) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.upload-zone:hover::before {
  opacity: 1;
}

.upload-zone:hover {
  border-color: rgba(99, 102, 241, 0.7) !important;
  background: linear-gradient(145deg, #f5f3ff 0%, #ede9fe 100%) !important;
  transform: scale(1.005);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.06), var(--shadow-lift);
}

.upload-zone.drag-active {
  border-color: var(--indigo-600) !important;
  background: linear-gradient(145deg, #ede9fe 0%, #ddd6fe 100%) !important;
  transform: scale(1.015) !important;
  box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.1), var(--shadow-lift);
}

.upload-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(99, 102, 241, 0.1);
  transition: all 0.3s ease;
}

.upload-zone:hover .upload-icon-wrap {
  background: rgba(99, 102, 241, 0.15);
  transform: translateY(-3px);
}

.upload-zone.drag-active .upload-icon-wrap {
  background: rgba(99, 102, 241, 0.2);
  animation: upload-pulse 1s ease-in-out infinite;
}

@keyframes upload-pulse {
  0%, 100% { transform: translateY(-3px) scale(1); }
  50%        { transform: translateY(-6px) scale(1.05); }
}

.pdf-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1.5px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--indigo-600);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============================================================
   PROGRESS — PIPELINE STAGES
   ============================================================ */
.progress-pipeline {
  background: white;
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(99,102,241,0.08);
}

.stage-indicators {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 24px;
}

.stage-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}

.stage-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

.stage-dot.active {
  border-color: var(--indigo-600);
  color: var(--indigo-600);
  background: var(--indigo-50);
  box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.1);
  animation: stage-pulse 1.5s ease-in-out infinite;
}

.stage-dot.done {
  border-color: var(--emerald-500);
  background: var(--emerald-500);
  color: white;
}

@keyframes stage-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12); }
  50%        { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.06); }
}

.stage-connector {
  width: 56px;
  height: 2px;
  background: #e5e7eb;
  transition: background 0.4s ease;
  margin: 0 2px;
  margin-bottom: 24px; /* align with dot center visually */
}

.stage-connector.done {
  background: var(--emerald-500);
}

.stage-label {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.stage-item.active .stage-label {
  color: var(--indigo-600);
  font-weight: 600;
}

.stage-item.done .stage-label {
  color: var(--emerald-500);
}

/* Shimmer progress bar */
.progress-track {
  width: 100%;
  background: #f3f4f6;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

#progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--indigo-600) 0%, #818cf8 50%, var(--indigo-600) 100%);
  background-size: 200% 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

#progress-bar.animating {
  animation: shimmer-bar 1.8s linear infinite;
}

@keyframes shimmer-bar {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

.progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.elapsed-counter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.elapsed-counter::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--indigo-500);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%        { opacity: 0.2; }
}

/* ============================================================
   THUMBNAIL GRID
   ============================================================ */
.thumb-card {
  position: relative;
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid transparent;
  box-shadow: var(--shadow-card);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: white;
}

.thumb-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: var(--shadow-lift);
  border-color: rgba(99,102,241,0.3);
}

.thumb-card.selected {
  border-color: var(--indigo-600) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2), var(--shadow-lift) !important;
  transform: translateY(-2px);
}

.thumb-card .page-number-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.03em;
}

.thumb-card .selected-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--indigo-600);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.6);
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.thumb-card.selected .selected-check {
  opacity: 1;
  transform: scale(1);
}

.thumb-card img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

/* ============================================================
   PREVIEW SECTION — BEFORE/AFTER
   ============================================================ */
#preview-section {
  background: linear-gradient(180deg, #fafafe 0%, #f5f3ff 100%);
  border: 1px solid rgba(99,102,241,0.1);
  border-radius: 20px;
}

.preview-panel {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-card);
  border: 1px solid rgba(0,0,0,0.05);
}

.preview-panel-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 10px;
}

#preview-img {
  border-radius: 10px;
  box-shadow: 0 4px 16px -4px rgba(0,0,0,0.12), 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.06) !important;
  width: 100%;
}

#preview-txt {
  font-family: 'Berkeley Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.7;
  background: #0f172a !important;
  color: #e2e8f0;
  border: none !important;
  border-radius: 10px;
  padding: 16px !important;
  max-height: 320px;
  overflow-y: auto;
  white-space: pre-wrap;
}

#preview-txt::-webkit-scrollbar {
  width: 5px;
}
#preview-txt::-webkit-scrollbar-track {
  background: transparent;
}
#preview-txt::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: 3px;
}

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-credit-card {
  background: linear-gradient(135deg, #0f0c29 0%, #1e1b4b 45%, #312e81 100%);
  border-radius: 20px;
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}

.dashboard-credit-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99,102,241,0.25) 0%, transparent 70%);
  pointer-events: none;
}

.dashboard-credit-card::after {
  content: '';
  position: absolute;
  bottom: -20px;
  left: 40%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.credit-badge-large {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 12px 20px;
  backdrop-filter: blur(8px);
}

.credit-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(99,102,241,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.job-card {
  background: white;
  border-radius: 14px;
  padding: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: var(--shadow-card);
  transition: all 0.2s ease;
}

.job-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}

.status-badge.done {
  background: var(--emerald-100);
  color: #065f46;
}

.status-badge.processing {
  background: var(--amber-100);
  color: #92400e;
}

.status-badge.error {
  background: var(--rose-100);
  color: #9f1239;
}

/* Timeline for credit history */
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  position: relative;
}

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

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  margin-top: 5px;
  flex-shrink: 0;
}

.timeline-dot.credit-in {
  background: var(--emerald-500);
}

.timeline-dot.credit-out {
  background: var(--indigo-500);
}

/* ============================================================
   CREDIT CONFIRMATION MODAL
   ============================================================ */
#credit-modal {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  background: rgba(0,0,0,0.45) !important;
}

#credit-modal > div {
  border-radius: 24px !important;
  padding: 32px !important;
  box-shadow: var(--shadow-modal) !important;
  border: 1px solid rgba(255,255,255,0.08);
  animation: modal-enter 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-icon-ring {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--indigo-50);
  border: 2px solid var(--indigo-100);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.modal-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.modal-cost-row + .modal-cost-row {
  border-top: 1px dashed #e5e7eb;
}

.modal-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 0;
  margin-top: 4px;
  border-top: 2px solid #e5e7eb;
}

/* ============================================================
   HOW IT WORKS — STEPS
   ============================================================ */
.step-card {
  background: white;
  border-radius: 20px;
  padding: 28px;
  border: 1px solid rgba(0,0,0,0.05);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.step-number {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--indigo-50);
  border: 2px solid var(--indigo-100);
  color: var(--indigo-600);
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* ============================================================
   PRICING CARDS
   ============================================================ */
.pricing-card {
  border-radius: 20px;
  padding: 28px;
  border: 1px solid #e5e7eb;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pricing-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
}

.pricing-card.featured {
  border: 2px solid var(--indigo-600) !important;
  position: relative;
}

/* ============================================================
   FAQ ACCORDION
   ============================================================ */
details {
  background: white;
  border-radius: 14px;
  border: 1px solid #f0f0f5;
  overflow: hidden;
  transition: box-shadow 0.2s ease;
}

details[open] {
  box-shadow: 0 4px 16px -4px rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.15);
}

details summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

details summary::before {
  display: none; /* remove old arrow */
}

details summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--indigo-600);
  line-height: 1;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

details[open] summary::after {
  transform: rotate(45deg);
}

details p {
  padding: 0 20px 18px;
}

/* ============================================================
   SECTION FADE-IN ANIMATION
   ============================================================ */
.fade-in-up {
  opacity: 0;
  transform: translateY(24px);
  animation: fade-in-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fade-in-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up-1 { animation-delay: 0.08s; }
.fade-in-up-2 { animation-delay: 0.16s; }
.fade-in-up-3 { animation-delay: 0.24s; }
.fade-in-up-4 { animation-delay: 0.32s; }

/* ============================================================
   DOWNLOAD BUTTON
   ============================================================ */
#download-section a {
  background: linear-gradient(135deg, var(--indigo-600) 0%, #6366f1 100%) !important;
  box-shadow: 0 4px 20px -4px rgba(79,70,229,0.5);
  transition: all 0.25s ease !important;
}

#download-section a:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 28px -4px rgba(79,70,229,0.6) !important;
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: #0f0c29;
  border-top: none !important;
}

footer a {
  color: #94a3b8;
  transition: color 0.15s ease;
}

footer a:hover {
  color: #e2e8f0;
}

/* ============================================================
   SECTION TRANSITIONS (keep original IDs working)
   ============================================================ */
#progress-section,
#preview-section,
#download-section,
#error-box {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ============================================================
   SCROLLBAR GLOBAL
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ============================================================
   MISC UTILITY
   ============================================================ */
.text-balance {
  text-wrap: balance;
}

/* Error box */
#error-box {
  border-radius: 14px !important;
  border-left: 4px solid var(--rose-500) !important;
  background: linear-gradient(135deg, #fff5f5 0%, #ffe4e6 100%) !important;
}

/* Copy toast */
#copy-toast {
  font-weight: 500;
}

/* Lang switcher */
#lang-switcher {
  font-size: 13px;
  border-radius: 8px !important;
  border: 1px solid rgba(99,102,241,0.15) !important;
  background: var(--indigo-50) !important;
  color: var(--indigo-900);
  padding: 4px 8px;
  cursor: pointer;
}

/* Subtle section divider */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99,102,241,0.15), transparent);
  margin: 0;
}
