/* Main UI & Light Theme Design System (Autodoc Style) */
:root {
  --bg-primary: #4a0a12;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --border-color: #e5e7eb;
  --border-active: #8b1522;
  
  /* Brand Colors */
  --brand-burgundy: #8b1522;
  --brand-burgundy-hover: #70111a;
  --brand-gold: #c29b62;
  --brand-gold-hover: #a6834d;
  --brand-white: #ffffff;
  
  --primary: var(--brand-burgundy);
  --primary-hover: var(--brand-burgundy-hover);
  --primary-glow: rgba(139, 21, 34, 0.2);
  --accent-cyan: var(--brand-gold);
  --accent-emerald: var(--brand-burgundy);
  
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --backdrop: none;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Open Sans', sans-serif;
  margin: 0;
  padding: 0;
  font-family: 'Open Sans', sans-serif;
  background-color: var(--bg-primary);
  background-image: url('data:image/svg+xml;utf8,<svg width="100%" height="100%" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="M0 100 L30 50 L50 80 L80 30 L100 60 L100 100 Z" fill="rgba(0,0,0,0.02)"/></svg>');
  background-size: cover;
  background-position: bottom;
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  padding: 12px 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand-logo {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--ossetian-yellow), var(--ossetian-red));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  box-shadow: 0 2px 8px var(--primary-glow);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--brand-white);
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--brand-gold);
  font-weight: 500;
}

.pwa-install-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--ossetian-yellow);
  border: 1px solid var(--ossetian-yellow-hover);
  color: #111827;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.pwa-install-btn:hover {
  background: var(--ossetian-yellow-hover);
  color: #111827;
}

.ossetian-ribbon {
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, #ffffff 0%, #ffffff 33%, #8b1522 33%, #8b1522 66%, #c29b62 66%, #c29b62 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Main Container */
.main-container {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
}

/* Stepper Wizard */
.stepper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  opacity: 0.6;
  transition: var(--transition);
  padding: 6px 12px;
  border-radius: var(--radius-md);
}

.step-item.active {
  opacity: 1;
  background: #fdfdfd;
  border: 1px solid var(--primary);
}

.step-item.completed .step-number {
  background: var(--accent-emerald);
  color: #fff;
}

.step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-item.active .step-number {
  background: var(--primary);
  color: #fff;
}

.step-label {
  font-size: 0.88rem;
  font-weight: 500;
}

.step-divider {
  flex: 1;
  height: 2px;
  background: var(--border-color);
  margin: 0 8px;
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Glass Card (Now Solid White Card) */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
}

.card-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #000000;
}

.card-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* Demo Banner */
.demo-banner {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(37, 99, 235, 0.12));
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.demo-banner-text p {
  font-size: 0.88rem;
  font-weight: 500;
  color: #e2e8f0;
}

.demo-banner-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.demo-btn-group {
  display: flex;
  gap: 8px;
}

/* Upload Grid */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.upload-box {
  background: #f9fafb;
  border: 2px dashed #d1d5db;
  border-radius: var(--radius-md);
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

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

.upload-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  background: #fee2e2;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary);
}

.upload-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.upload-desc {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.btn-upload {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #111827;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-upload:hover {
  background: #f9fafb;
}

.file-input {
  display: none;
}

.preview-container {
  display: none;
  margin-top: 12px;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 200px;
  border: 1px solid var(--border-color);
}

.preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-status {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(16, 185, 129, 0.9);
  color: #000;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
}

.ocr-progress-box {
  display: none;
  background: #ffffff;
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  box-shadow: 0 4px 6px -1px rgba(229,57,53,0.1);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  transition: width 0.3s ease;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

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

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select {
  width: 100%;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: #111827;
  font-family: inherit;
  font-size: 0.92rem;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229,57,53,0.15);
}

.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-burgundy) 0%, #630c16 100%);
  color: var(--brand-white);
  border: 1px solid var(--brand-gold);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #70111a 0%, #4a070e 100%);
  border-color: #d1b181;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #d1d5db;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-emerald {
  background: var(--ossetian-yellow);
  color: #111827;
  box-shadow: 0 4px 6px -1px rgba(251,192,45,0.4);
  transition: var(--transition);
}

.btn-emerald:hover {
  background: var(--ossetian-yellow-hover);
}

/* Document Paper Reader Preview (Full A4 proportion view) */
.decl-paper-preview {
  background: #f1f5f9;
  padding: 30px;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #111827;
  border: 1px solid #374151;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.camera-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 2000;
  flex-direction: column;
}

.camera-modal.active {
  display: flex;
}

.camera-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0,0,0,0.6);
  color: #fff;
}

.camera-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-frame-guide {
  position: absolute;
  width: 85%;
  height: 60%;
  border: 2px dashed #06b6d4;
  border-radius: 12px;
  pointer-events: none;
}

.camera-controls {
  padding: 24px;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  gap: 20px;
}

.btn-snap {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid var(--primary);
  cursor: pointer;
}

/* ==========================================================================
   MOBILE ADAPTATION
   ========================================================================== */
@media (max-width: 600px) {
  .brand-text h1 { font-size: 1.1rem; }
  .brand-text p { font-size: 0.75rem; }
  .card-title { font-size: 1.1rem; }
  .card-subtitle { font-size: 0.85rem; }
  .upload-box { padding: 16px; }
  .step-label { display: none; }
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar .btn { width: 100%; margin-bottom: 8px; padding: 14px 16px; font-size: 1rem; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-input, .form-select { font-size: 1rem; padding: 12px; }
  .pwa-install-btn { padding: 6px 10px; font-size: 0.75rem; }
}

h1, h2, h3, .brand-text h1, .card-title { font-family: 'Montserrat', sans-serif; font-weight: 600; }
\n.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }\n