@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.08);
  --primary-glow: rgba(99, 102, 241, 0.15);
  --secondary: #8b5cf6;
  --bg: #f8fafc;
  --bg-dark: #0f172a;
  --text: #1e293b;
  --text-light: #64748b;
  --text-lighter: #94a3b8;
  --card: #ffffff;
  --card-border: #e2e8f0;
  --card-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --card-shadow-hover: 0 10px 25px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --error: #ef4444;
  --error-bg: #fef2f2;
  --error-border: #fecaca;
  --info: #3b82f6;
  --info-bg: #eff6ff;
  --info-border: #bfdbfe;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: 0.2s ease;
}

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

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--primary-hover);
}

.site-header {
  background: white;
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.92);
}

.site-header .inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
}

.logo {
  font-weight: 800;
  font-size: 1.35rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

nav {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
nav a {
  color: var(--text-light);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
nav a:hover {
  color: var(--primary);
  background: var(--primary-light);
  text-decoration: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  padding: 2.5rem 0 4rem;
}

.flash {
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.flash.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #065f46;
}
.flash.error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: #991b1b;
}
.flash.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: #92400e;
}
.flash.info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  color: #1e40af;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow var(--transition);
}
.card:hover {
  box-shadow: var(--card-shadow-hover);
}
.card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.form-row {
  margin-bottom: 1.25rem;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

input[type="file"] {
  padding: 0.6rem;
  border: 1.5px dashed var(--card-border);
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  cursor: pointer;
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text-light);
}
input[type="file"]:hover {
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  font-family: inherit;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  transition: all var(--transition);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  text-decoration: none;
  color: #fff;
}
.btn:active {
  transform: translateY(0);
}

.btn.secondary {
  background: white;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  box-shadow: none;
}
.btn.secondary:hover {
  background: var(--primary-light);
  box-shadow: none;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.85rem 0.75rem;
  background: var(--bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-light);
  border-bottom: 2px solid var(--card-border);
}

td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--card-border);
  vertical-align: middle;
}

tr:hover td {
  background: var(--primary-light);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge.queued {
  background: #f1f5f9;
  color: #475569;
}
.badge.researching {
  background: #dbeafe;
  color: #1d4ed8;
}
.badge.writing {
  background: #fef3c7;
  color: #b45309;
}
.badge.formatting {
  background: #fed7aa;
  color: #c2410c;
}
.badge.complete {
  background: #d1fae5;
  color: #065f46;
}
.badge.failed {
  background: #fee2e2;
  color: #991b1b;
}

.progress {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.hero {
  text-align: center;
  padding: 3.5rem 1rem 2.5rem;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1rem;
}
.hero p {
  color: var(--text-light);
  font-size: 1.15rem;
  max-width: 38rem;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.plan-card {
  text-align: center;
  padding: 2rem 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.plan-card:hover {
  transform: translateY(-4px);
}

.plan-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.plan-price {
  font-size: 2.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0.5rem 0;
}

.plan-card .btn {
  width: 100%;
  margin-top: 1rem;
}

.help {
  font-size: 0.82rem;
  color: var(--text-lighter);
  margin-top: 0.3rem;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
}
.auth-card h1 {
  text-align: center;
  margin-bottom: 1.5rem;
}
.auth-card .btn {
  width: 100%;
  margin-top: 0.5rem;
}
.auth-footer {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-light);
}

.comparison-table td:first-child {
  font-weight: 600;
}
.comparison-table td {
  font-size: 0.88rem;
}

.generate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 700px) {
  .generate-grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 1.75rem;
  }
  .site-header .inner {
    padding: 0.6rem 1rem;
  }
  nav a {
    padding: 0.4rem 0.5rem;
    font-size: 0.82rem;
  }
}

.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.divider {
  height: 1px;
  background: var(--card-border);
  margin: 1.5rem 0;
}

.stats-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}
.stat-item {
  flex: 1;
  min-width: 120px;
  text-align: center;
  padding: 1rem;
  background: var(--primary-light);
  border-radius: var(--radius);
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}
