/* Main app styles - landing pages */

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

:root {
  --primary: #c47c3a;
  --primary-dark: #a56628;
  --bg: #faf8f5;
  --text: #2d2d2d;
  --grey: #888;
  --border: #e8e8e8;
  --shadow: 0 2pt 8pt rgba(0,0,0,0.06);
  --shadow-lg: 0 8pt 32pt rgba(0,0,0,0.08);
  --accent-blue: #2563a8;
  --accent-green: #6c9b6c;
  --accent-orange: #c47c3a;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity 0.2s;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============== Navbar ============== */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: bold;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), #e8a566);
  color: #fff;
  border-radius: 8px;
  font-size: 18px;
}

.logo-text {
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 14px;
  color: #666;
  font-weight: 500;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--primary);
}

/* ============== Hero ============== */
.hero {
  padding: 80px 0;
  background: linear-gradient(135deg, #fef9f0 0%, #f5ede0 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 10%;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(196,124,58,0.1) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 60px;
  align-items: center;
}

.hero-badge {
  display: inline-block;
  background: rgba(196,124,58,0.12);
  color: var(--primary-dark);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 24px;
  font-weight: 600;
}

.hero-title {
  font-size: 48px;
  line-height: 1.2;
  margin-bottom: 24px;
  font-weight: 700;
}

.hero-title strong {
  color: var(--primary);
  position: relative;
}

.hero-title strong::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  height: 6px;
  background: rgba(196,124,58,0.2);
  z-index: -1;
}

.hero-desc {
  color: #555;
  font-size: 16px;
  margin-bottom: 36px;
  max-width: 540px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 50px;
}

.hero-stats {
  display: flex;
  gap: 40px;
}

.stat {
  border-left: 3px solid var(--primary);
  padding-left: 14px;
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 13px;
  color: var(--grey);
  margin-top: 2px;
}

/* Paper stack visual */
.paper-stack {
  position: relative;
  width: 100%;
  height: 520px;
  perspective: 1500px;
}

.paper {
  position: absolute;
  width: 360px;
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  padding: 24px 22px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid #f0f0f0;
}

.paper-1 {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-3deg);
  z-index: 3;
}

.paper-2 {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(2deg) translate(20px, -20px);
  z-index: 2;
  opacity: 0.7;
}

.paper-3 {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(5deg) translate(40px, -40px);
  z-index: 1;
  opacity: 0.4;
}

.paper-header {
  font-size: 11px;
  color: #777;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.paper-header .triangles {
  color: #aaa;
  margin-right: 4px;
}

.paper-section {
  font-size: 18px;
  margin: 8px 0;
  color: #222;
}

.paper-pill {
  display: inline-block;
  background: #666;
  color: #fff;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  margin: 6px 0;
}

.paper-text {
  color: #444;
  margin: 8px 0;
}

.paper-text.small {
  font-size: 12px;
  color: #666;
}

.paper-sub {
  font-size: 13px;
  color: #222;
  margin: 8px 0 4px;
}

.paper-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 11px;
}

.paper-table th,
.paper-table td {
  border: 1px solid #ddd;
  padding: 4px 6px;
  text-align: left;
}

.paper-table th {
  background: #f5f5f5;
}

.paper-page-num {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 24px;
  height: 24px;
  background: #999;
  color: #fff;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

/* ============== Buttons ============== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196,124,58,0.3);
}

.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1.5px solid var(--primary);
}

.btn-ghost:hover {
  background: var(--primary);
  color: #fff;
}

.btn-white {
  background: #fff;
  color: var(--primary-dark);
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
}

.btn-big {
  padding: 16px 36px;
  font-size: 16px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.btn-link:hover {
  color: var(--primary);
}

.btn-mini {
  background: #f0f0f0;
  color: #666;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

.btn-mini:hover {
  background: #e0e0e0;
}

.btn-mini:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* OCR 识别状态行 */
.ocr-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.ocr-status {
  font-size: 13px;
  color: #2f7d4f;
}

.ocr-status.ocr-error {
  color: #c0392b;
}

/* ============== How it works ============== */
.how {
  padding: 80px 0;
  background: #fff;
}

.section-title {
  font-size: 36px;
  text-align: center;
  margin-bottom: 50px;
  font-weight: 700;
}

.section-title .accent {
  color: var(--primary);
  position: relative;
}

.section-title .accent::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  opacity: 0.3;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.step {
  background: var(--bg);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  transition: all 0.3s;
  position: relative;
}

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

.step-num {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  opacity: 0.3;
}

.step-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.step-title {
  font-size: 18px;
  margin-bottom: 12px;
}

.step p {
  font-size: 14px;
  color: var(--grey);
}

/* ============== Features ============== */
.features {
  padding: 80px 0;
  background: var(--bg);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.feature-card {
  background: #fff;
  padding: 32px 24px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

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

.feature-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.feature-card h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.feature-card p {
  font-size: 14px;
  color: var(--grey);
  line-height: 1.7;
}

/* ============== CTA ============== */
.cta {
  padding: 80px 0;
  background: linear-gradient(135deg, var(--primary) 0%, #e8a566 100%);
}

.cta-box {
  text-align: center;
  color: #fff;
}

.cta-box h2 {
  font-size: 36px;
  margin-bottom: 16px;
}

.cta-box p {
  margin-bottom: 32px;
  font-size: 16px;
  opacity: 0.9;
}

/* ============== Footer ============== */
.footer {
  background: #2a2a2a;
  color: #aaa;
  padding: 32px 0;
  font-size: 14px;
}

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

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ============== Create Page ============== */
.create-page {
  padding: 50px 0 80px;
}

.page-header-wrap {
  text-align: center;
  margin-bottom: 40px;
}

.big-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 12px;
}

.big-sub {
  color: var(--grey);
  font-size: 16px;
}

.create-form {
  max-width: 900px;
  margin: 0 auto;
}

.form-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.form-section legend {
  font-size: 18px;
  font-weight: 600;
  padding-bottom: 8px;
}

.legend-num {
  display: inline-block;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  font-size: 14px;
  margin-right: 10px;
}

.form-hint {
  font-size: 13px;
  color: var(--grey);
  margin-bottom: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}

.form-row:last-child {
  margin-bottom: 0;
}

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

.form-group-full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  font-weight: 500;
}

.req {
  color: #e44;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196,124,58,0.12);
}

/* Upload Area */
.upload-area {
  border: 2px dashed #d0d0d0;
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fafafa;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: #fef9f0;
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.upload-text {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
}

.upload-hint {
  font-size: 13px;
  color: var(--grey);
}

.upload-preview {
  position: relative;
}

.upload-preview img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.btn-reupload {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.95);
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

/* Text Area */
.text-area-wrap {
  position: relative;
}

#essay-text {
  width: 100%;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.7;
  resize: vertical;
  min-height: 200px;
}

#essay-text:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(196,124,58,0.12);
}

.text-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.word-count {
  font-size: 13px;
  color: var(--grey);
}

/* Topic Cards */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.topic-card {
  display: block;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.topic-card:hover {
  border-color: var(--primary);
}

.topic-card input {
  position: absolute;
  top: 14px;
  right: 14px;
}

.topic-card input:checked ~ .topic-content .topic-title {
  color: var(--primary);
}

.topic-card:has(input:checked) {
  border-color: var(--primary);
  background: #fef9f0;
}

.topic-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.topic-desc {
  font-size: 12px;
  color: var(--grey);
  line-height: 1.5;
  padding-right: 24px;
}

/* Form Actions */
.form-actions {
  text-align: center;
  margin: 36px 0;
}

.btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn.loading .btn-spinner {
  display: inline-block;
}

.btn.loading .btn-text {
  opacity: 0.7;
}

.info-card {
  max-width: 900px;
  margin: 0 auto;
  background: #fff8ed;
  border: 1px solid #f0d8a8;
  border-radius: 12px;
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.7;
}

.info-card strong {
  color: var(--primary-dark);
}

.info-card ul {
  margin: 10px 0 0 20px;
}

.info-card li {
  margin-bottom: 4px;
}

/* ============== Responsive ============== */
@media (max-width: 768px) {
  .hero-grid,
  .steps,
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .hero-title {
    font-size: 32px;
  }
}

/* ============== Engine status badge ============== */
.engine-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 7px 16px;
  border-radius: 30px;
  font-size: 13px;
  border: 1px solid #e0e0e0;
  background: #fff;
}

.engine-badge.engine-llm {
  background: linear-gradient(135deg, #eaf6ff, #f4faff);
  border-color: #a8d4f0;
  color: #1b6aa8;
}

.engine-badge.engine-rule {
  background: #f6f6f6;
  border-color: #ddd;
  color: #666;
}

.engine-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ccc;
}

.engine-llm .engine-dot {
  background: #1b8ae0;
  box-shadow: 0 0 0 3px rgba(27,138,224,0.18);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.engine-rule .engine-dot {
  background: #bdbdbd;
}

.engine-badge .engine-msg {
  color: #999;
  font-weight: 400;
  font-size: 12px;
  margin-left: 2px;
}
