/* OCRNeo Design System - DocNeo Style Clone */
:root {
  /* Core Colors - Light Theme */
  --bg: #eef2f7;
  --bg-gradient: linear-gradient(135deg, #e8eef5 0%, #f0f4f8 50%, #e6ecf3 100%);
  --card: #ffffff;
  --card-hover: #fafbfc;
  --border: #d1d9e6;
  --border-light: #e2e8f0;
  
  /* Text Colors */
  --text: #1a2332;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  
  /* Brand Colors - Blue + Orange Accent */
  --primary: #5545f5;
  --primary-hover: #4535e0;
  --primary-dim: rgba(85, 69, 245, 0.1);
  --accent: #f97316;
  --accent-dim: rgba(249, 115, 22, 0.1);
  
  /* Status Colors */
  --error: #dc2626;
  --error-light: rgba(220, 38, 38, 0.08);
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 30px;
  --font-size-4xl: 36px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text);
  background-color: #e8edf4;
  background-image: 
    radial-gradient(ellipse at 20% 20%, rgba(37, 99, 235, 0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(249, 115, 22, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.8) 0%, transparent 70%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Container */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ========== HEADER ========== */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

/* Logo - Blue Orange Gradient */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-decoration: none;
}

.logo:hover {
  text-decoration: none;
}

.logo-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  background: linear-gradient(135deg, #5545f5 0%, #6d5ff7 50%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-link {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

/* Language Selector */
.lang-selector {
  position: relative;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.lang-btn svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
}

.lang-selector.open .lang-btn svg {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
  z-index: 100;
  max-height: 320px;
  overflow-y: auto;
}

.lang-selector.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-dropdown a {
  display: block;
  padding: 10px 14px;
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.lang-dropdown a:hover {
  background: var(--primary-dim);
  color: var(--primary);
}

.lang-dropdown a.active {
  color: var(--primary);
  background: var(--primary-dim);
  font-weight: 600;
}

/* ========== MAIN CONTENT ========== */
.main {
  flex: 1;
  padding: var(--space-2xl) 0;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

/* Privacy Badge */
.privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  letter-spacing: 0.3px;
}

.privacy-badge svg {
  width: 14px;
  height: 14px;
  color: var(--success);
}

/* Hero Title */
.hero-title {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  letter-spacing: -0.5px;
}

.hero-title .normal {
  color: var(--text);
}

.hero-title .highlight {
  color: var(--primary);
}

/* Hero Subtitle */
.hero-subtitle {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
  font-weight: 400;
}

/* ========== UPLOAD SECTION ========== */
.upload-section {
  margin-bottom: var(--space-xl);
}

.upload-box {
  position: relative;
  background: var(--card);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-xl);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
}

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

.upload-box.dragover {
  transform: scale(1.005);
}

.upload-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 20px;
  color: #94a3b8;
}

.upload-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.upload-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: 20px;
}

.upload-btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--primary);
  color: #ffffff;
  font-size: var(--font-size-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.upload-btn:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.upload-formats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.format-tag {
  padding: 5px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.file-input {
  display: none;
}

/* ========== PREVIEW SECTION ========== */
.preview-section {
  display: none;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  margin-bottom: var(--space-xl);
  box-shadow: var(--shadow-md);
}

.preview-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.preview-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-filename {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text);
}

.preview-filesize {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  padding: 4px 10px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
}

.remove-btn {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.remove-btn:hover {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-light);
}

.preview-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-lg);
  background: #f8fafc;
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.preview-image {
  max-width: 100%;
  max-height: 260px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

/* ========== PROGRESS ========== */
.progress-container {
  display: none;
  margin-bottom: var(--space-lg);
}

.progress-container.active {
  display: block;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.progress-bar {
  height: 6px;
  background: #f1f5f9;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #6d5ff7);
  border-radius: var(--radius-full);
  width: 0%;
  transition: width var(--transition-normal);
}

/* ========== RESULT SECTION ========== */
.result-section {
  display: none;
}

.result-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.result-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-title {
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text);
}

.result-lang {
  padding: 4px 10px;
  background: var(--primary-dim);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.5px;
}

.result-actions {
  display: flex;
  gap: 10px;
  margin-bottom: var(--space-md);
}

.result-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.result-btn:hover {
  background: var(--card-hover);
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.result-btn.copied {
  border-color: var(--success);
  color: var(--success);
  background: rgba(16, 185, 129, 0.05);
}

.result-btn svg {
  width: 16px;
  height: 16px;
}

.result-textarea {
  width: 100%;
  min-height: 180px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-family);
  font-size: 15px;
  line-height: 1.8;
  resize: vertical;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.result-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.result-textarea::placeholder {
  color: var(--text-muted);
}

/* ========== ERROR ========== */
.error-message {
  display: none;
  padding: 14px 16px;
  background: var(--error-light);
  border: 1px solid rgba(220, 38, 38, 0.15);
  border-radius: var(--radius-md);
  color: var(--error);
  text-align: center;
  margin-bottom: var(--space-lg);
  font-size: var(--font-size-sm);
  font-weight: 500;
}

.error-message.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Flat Icons */
.feature-icon svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

/* ========== FEATURES ========== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid #e2e8f0;
}

.feature {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--transition-fast);
}

.feature:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.feature-content {
  text-align: left;
}

.feature-title {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.feature-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ========== FAQ ========== */
.faq-section {
  margin: var(--space-2xl) 0;
  padding-top: var(--space-xl);
  border-top: 1px solid #e2e8f0;
}

.faq-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: var(--space-xl);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--primary);
}

.faq-question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 18px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-family);
  transition: all var(--transition-fast);
}

.faq-question:hover {
  color: var(--primary);
}

.faq-question svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  color: var(--text-secondary);
}

.faq-item.open .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-normal);
}

.faq-answer-content {
  padding: 0 20px 18px;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  line-height: 1.7;
}

.faq-item.open .faq-answer {
  max-height: 500px;
}

/* ========== FOOTER ========== */
.footer {
  padding: var(--space-xl) 0;
  text-align: center;
}

.footer-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.footer-links a {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--primary);
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--text);
  border-radius: var(--radius-md);
  color: #ffffff;
  font-size: var(--font-size-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: all var(--transition-normal);
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

/* ========== RTL ========== */
[dir="rtl"] .header .container {
  flex-direction: row-reverse;
}

[dir="rtl"] .header-right {
  flex-direction: row-reverse;
}

[dir="rtl"] .lang-dropdown {
  right: auto;
  left: 0;
}

[dir="rtl"] .preview-header,
[dir="rtl"] .result-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .result-actions {
  flex-direction: row-reverse;
}

[dir="rtl"] .feature-content {
  text-align: right;
}

[dir="rtl"] .toast {
  left: auto;
  right: 50%;
  transform: translateX(50%) translateY(100px);
}

[dir="rtl"] .toast.show {
  transform: translateX(50%) translateY(0);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }
  
  .header .container {
    height: 56px;
  }
  
  .logo {
    font-size: 18px;
  }
  
  .header-right {
    gap: 12px;
  }
  
  .header-link {
    display: none;
  }
  
  .upload-box {
    padding: 36px 20px;
  }
  
  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .feature {
    padding: 14px 16px;
  }
  
  .hero-title {
    font-size: 26px;
  }
  
  .result-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .result-actions {
    width: 100%;
  }
  
  .result-btn {
    flex: 1;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .header-right {
    gap: 8px;
  }
  
  .lang-btn span {
    display: none;
  }
  
  .upload-formats {
    gap: 6px;
  }
  
  .format-tag {
    font-size: 10px;
    padding: 4px 8px;
  }
}

/* ========== ANIMATIONS ========== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Tutorial Link */
.tutorial-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--primary);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, opacity 0.2s;
}
.tutorial-link:hover {
  color: var(--primary-hover);
  opacity: 0.85;
}
