/* ===== Smart Document Builder — Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #3730a3;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-dark: #0f172a;
  --bg-dark-card: #1e293b;
  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, .07), 0 2px 4px -2px rgba(0, 0, 0, .05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, .08), 0 4px 6px -4px rgba(0, 0, 0, .05);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, .1), 0 8px 10px -6px rgba(0, 0, 0, .06);
  --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, .15);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

/* ===== Navbar ===== */
.navbar-custom {
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(226, 232, 240, .6);
  padding: .75rem 0;
  transition: var(--transition);
  z-index: 1050;
}

.navbar-custom.scrolled {
  box-shadow: var(--shadow);
}

.navbar-brand-custom {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--primary) !important;
  display: flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}

.navbar-brand-custom i {
  font-size: 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-link-custom {
  font-weight: 500;
  color: var(--text-light) !important;
  padding: .5rem 1rem !important;
  border-radius: 8px;
  transition: var(--transition);
}

.nav-link-custom:hover,
.nav-link-custom.active {
  color: var(--primary) !important;
  background: var(--primary-50);
}

/* ===== Hero Section ===== */
.hero-section {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(99, 102, 241, .4) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, .3) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(168, 85, 247, .3) 0%, transparent 50%);
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-section h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}

.hero-section h1 span {
  background: linear-gradient(90deg, #fbbf24, #f59e0b, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-section p {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, .85);
  max-width: 540px;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  gap: 2rem;
  margin-top: 2.5rem;
}

.hero-stat {
  text-align: center;
  color: #fff;
}

.hero-stat .number {
  font-size: 1.8rem;
  font-weight: 800;
  display: block;
}

.hero-stat .label {
  font-size: .85rem;
  opacity: .8;
}

.hero-illustration {
  position: relative;
  z-index: 1;
}

.hero-card {
  background: rgba(255, 255, 255, .12);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-xl);
}

.hero-card .doc-preview-mini {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.hero-card .doc-preview-mini .line {
  height: 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.hero-card .doc-preview-mini .line.title {
  width: 60%;
  background: var(--primary);
}

.hero-card .doc-preview-mini .line.subtitle {
  width: 40%;
  background: var(--primary-200);
}

.hero-card .doc-preview-mini .line.text {
  width: 100%;
  background: #e2e8f0;
}

.hero-card .doc-preview-mini .line.text-short {
  width: 75%;
  background: #e2e8f0;
}

.hero-card .mini-toolbar {
  display: flex;
  gap: .5rem;
}

.hero-card .mini-toolbar span {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .85rem;
}

/* Floating shapes */
.floating-shape {
  position: absolute;
  border-radius: 50%;
  opacity: .15;
  animation: float 6s ease-in-out infinite;
}

.floating-shape.s1 {
  width: 200px;
  height: 200px;
  background: #fbbf24;
  top: 10%;
  right: 5%;
  animation-delay: 0s;
}

.floating-shape.s2 {
  width: 150px;
  height: 150px;
  background: #06b6d4;
  bottom: 15%;
  left: 5%;
  animation-delay: 2s;
}

.floating-shape.s3 {
  width: 100px;
  height: 100px;
  background: #fff;
  top: 60%;
  right: 30%;
  animation-delay: 4s;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

/* ===== Buttons ===== */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  padding: .75rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: .95rem;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(79, 70, 229, .35);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}

.btn-primary-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, .45);
  color: #fff;
}

.btn-outline-custom {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, .4);
  padding: .7rem 1.8rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: .95rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
}

.btn-outline-custom:hover {
  background: rgba(255, 255, 255, .15);
  border-color: rgba(255, 255, 255, .7);
  color: #fff;
}

.btn-secondary-custom {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .6rem 1.5rem;
  border-radius: 50px;
  font-weight: 500;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.btn-secondary-custom:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary);
}

/* ===== Section Styles ===== */
.section-padding {
  padding: 5rem 0;
}

.section-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .75rem;
}

.section-subtitle {
  color: var(--text-light);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 3rem;
}

.section-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--primary-50);
  color: var(--primary);
  font-size: .8rem;
  font-weight: 600;
  padding: .35rem 1rem;
  border-radius: 50px;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ===== Document Type Cards ===== */
.doc-type-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.doc-type-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform .3s ease;
}

.doc-type-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-200);
}

.doc-type-card:hover::before {
  transform: scaleX(1);
}

.doc-type-card .icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  transition: var(--transition);
}

.doc-type-card:hover .icon-wrap {
  transform: scale(1.1);
}

.doc-type-card h5 {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .35rem;
  color: var(--text);
}

.doc-type-card p {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0;
}

/* Card icon colors */
.icon-indigo {
  background: var(--primary-50);
  color: var(--primary);
}

.icon-cyan {
  background: #ecfeff;
  color: #06b6d4;
}

.icon-emerald {
  background: #ecfdf5;
  color: #10b981;
}

.icon-amber {
  background: #fffbeb;
  color: #f59e0b;
}

.icon-rose {
  background: #fff1f2;
  color: #f43f5e;
}

.icon-violet {
  background: #f5f3ff;
  color: #8b5cf6;
}

.icon-sky {
  background: #f0f9ff;
  color: #0ea5e9;
}

/* ===== How It Works ===== */
.how-it-works {
  background: var(--bg-dark);
  color: #fff;
}

.step-card {
  text-align: center;
  padding: 2rem 1.5rem;
}

.step-number {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 25px rgba(79, 70, 229, .4);
}

.step-card h4 {
  font-weight: 700;
  margin-bottom: .5rem;
  font-size: 1.15rem;
}

.step-card p {
  color: rgba(255, 255, 255, .7);
  font-size: .95rem;
}

.step-connector {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
}

/* ===== Templates Section ===== */
.template-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
}

.template-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.template-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-200);
}

.template-preview {
  height: 200px;
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: hidden;
}

.template-preview .mini-doc {
  width: 100%;
  background: #fff;
  border-radius: 6px;
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  font-size: .6rem;
  line-height: 1.4;
  transform: scale(.85);
}

.template-info {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.template-info h5 {
  font-weight: 600;
  font-size: .95rem;
  margin-bottom: .2rem;
}

.template-info p {
  font-size: .8rem;
  color: var(--text-muted);
  margin: 0;
}

/* ===== Export Section ===== */
.export-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  transition: var(--transition);
}

.export-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.export-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
}

.export-card h5 {
  font-weight: 600;
  margin-bottom: .5rem;
}

.export-card p {
  font-size: .85rem;
  color: var(--text-light);
  margin: 0;
}

/* ===== CTA Section ===== */
.cta-section {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  padding: 5rem 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 255, 255, .1) 0%, transparent 50%);
}

.cta-section h2 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  position: relative;
}

.cta-section p {
  font-size: 1.1rem;
  opacity: .9;
  margin-bottom: 2rem;
  position: relative;
}

.cta-section .btn-light-custom {
  background: #fff;
  color: var(--primary);
  border: none;
  padding: .85rem 2.5rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1rem;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  text-decoration: none;
  position: relative;
}

.cta-section .btn-light-custom:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-dark);
  color: rgba(255, 255, 255, .7);
  padding: 3rem 0 1.5rem;
}

.footer a {
  color: rgba(255, 255, 255, .7);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  color: #fff;
}

.footer-brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff !important;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
}

.footer-links {
  list-style: none;
  padding: 0;
}

.footer-links li {
  margin-bottom: .5rem;
}

.footer-links li a {
  font-size: .9rem;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .1);
  padding-top: 1.5rem;
  margin-top: 2rem;
  text-align: center;
  font-size: .85rem;
}

/* ============================================================
   EDITOR VIEW
   ============================================================ */
.editor-view {
  display: none;
  min-height: 100vh;
  background: var(--bg);
}

.editor-view.active {
  display: block;
}

.editor-topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.editor-topbar .back-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 500;
  transition: var(--transition);
}

.editor-topbar .back-btn:hover {
  color: var(--primary);
}

.editor-topbar .doc-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.editor-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.editor-actions .btn {
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  padding: .45rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.editor-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: calc(100vh - 60px);
}

/* Form Panel */
.form-panel {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  border-right: 1px solid var(--border);
}

.form-panel h4 {
  font-weight: 700;
  margin-bottom: .35rem;
}

.form-panel .form-subtitle {
  color: var(--text-light);
  font-size: .9rem;
  margin-bottom: 1.5rem;
}

.form-section-label {
  font-weight: 600;
  font-size: .85rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: .75rem;
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

.form-section-label:first-of-type {
  margin-top: 0;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 500;
  font-size: .85rem;
  color: var(--text);
  margin-bottom: .35rem;
  display: block;
}

.form-group .form-control,
.form-group .form-select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: .65rem .9rem;
  font-size: .9rem;
  transition: var(--transition);
  background: var(--bg-card);
}

.form-group .form-control:focus,
.form-group .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.form-group textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

/* Template Selector (in editor) */
.template-selector {
  display: flex;
  gap: .5rem;
  padding: 1rem 2rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.template-selector .template-chip {
  padding: .4rem 1rem;
  border-radius: 50px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: .8rem;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}

.template-selector .template-chip:hover {
  border-color: var(--primary-200);
}

.template-selector .template-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Preview Panel */
.preview-panel {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(100vh - 60px);
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-panel h6 {
  font-weight: 600;
  color: var(--text-light);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 1rem;
  align-self: flex-start;
}

.preview-document {
  width: 100%;
  max-width: 595px;
  min-height: 842px;
  background-color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 3rem 2.5rem;
  font-size: .9rem;
  line-height: 1.7;
  position: relative;
  /* Multi-page effect: visible page break every A4 page height */
  background-image:
    repeating-linear-gradient(to bottom,
      #fff 0px,
      #fff 836px,
      #e2e8f0 836px,
      #e2e8f0 837px,
      #cbd5e1 837px,
      #cbd5e1 839px,
      #e2e8f0 839px,
      #e2e8f0 840px,
      #fff 840px,
      #fff 842px);
}

/* ============================================================
   DASHBOARD VIEW
   ============================================================ */
.dashboard-view {
  display: none;
  min-height: 100vh;
  background: var(--bg);
}

.dashboard-view.active {
  display: block;
}

.dashboard-header {
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: #fff;
  padding: 3rem 0 2rem;
}

.dashboard-header h2 {
  font-weight: 800;
  margin-bottom: .5rem;
}

.dashboard-header p {
  opacity: .85;
}

.dashboard-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.dash-stat {
  background: rgba(255, 255, 255, .15);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  min-width: 140px;
}

.dash-stat .num {
  font-size: 1.6rem;
  font-weight: 800;
  display: block;
}

.dash-stat .lbl {
  font-size: .8rem;
  opacity: .8;
}

.dashboard-body {
  padding: 2rem 0;
}

.saved-doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: var(--transition);
  position: relative;
}

.saved-doc-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-200);
}

.saved-doc-card .doc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .65rem;
  border-radius: 50px;
  background: var(--primary-50);
  color: var(--primary);
  margin-bottom: .75rem;
}

.saved-doc-card h5 {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: .25rem;
}

.saved-doc-card .doc-date {
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.saved-doc-card .doc-actions {
  display: flex;
  gap: .5rem;
}

.saved-doc-card .doc-actions .btn {
  font-size: .78rem;
  padding: .3rem .65rem;
  border-radius: 6px;
}

.empty-dashboard {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-dashboard i {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-dashboard h4 {
  font-weight: 700;
  margin-bottom: .5rem;
}

.empty-dashboard p {
  color: var(--text-light);
}

/* ===== Animations ===== */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
}

.custom-toast {
  background: var(--bg-dark);
  color: #fff;
  border-radius: var(--radius);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: slideUp .3s ease;
  margin-top: .5rem;
}

.custom-toast.success {
  border-left: 4px solid var(--success);
}

.custom-toast.error {
  border-left: 4px solid var(--danger);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Modal overrides ===== */
.modal-content {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
}

.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

.share-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.share-option {
  text-align: center;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
}

.share-option:hover {
  border-color: var(--primary-200);
  background: var(--primary-50);
  color: var(--primary);
}

.share-option i {
  font-size: 1.5rem;
  display: block;
  margin-bottom: .5rem;
}

.share-option span {
  font-size: .85rem;
  font-weight: 500;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .editor-body {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .preview-panel {
    max-height: none;
    border-right: none;
  }

  .form-panel {
    border-bottom: 1px solid var(--border);
  }

  .preview-panel {
    min-height: 500px;
  }

  .hero-illustration {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .hero-section {
    min-height: 80vh;
  }

  .hero-stats {
    gap: 1rem;
  }

  .hero-stat .number {
    font-size: 1.4rem;
  }

  .section-padding {
    padding: 3.5rem 0;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .editor-topbar {
    padding: .6rem 1rem;
  }

  .editor-actions .btn span.btn-text {
    display: none;
  }

  .form-panel {
    padding: 1.25rem;
  }

  .preview-panel {
    padding: 1.25rem;
  }

  .preview-document {
    padding: 1.5rem 1.25rem;
  }

  .template-selector {
    padding: .75rem 1rem;
    overflow-x: auto;
  }

  .share-options {
    grid-template-columns: 1fr;
  }

  .step-connector {
    display: none;
  }
}

@media (max-width: 575.98px) {
  .dashboard-stats {
    flex-direction: column;
  }

  .editor-actions {
    justify-content: flex-end;
  }
}

/* ===== Print Styles ===== */
@media print {
  body * {
    visibility: hidden;
  }

  .preview-document,
  .preview-document * {
    visibility: visible;
  }

  .preview-document {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
    border-radius: 0;
    padding: 2cm;
  }

  .navbar-custom,
  .editor-topbar,
  .form-panel,
  .template-selector,
  .footer,
  .toast-container {
    display: none !important;
  }
}

/* ============================================================
   DARK MODE TOGGLE BUTTON
   ============================================================ */
.dark-mode-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  margin-left: 1rem;
}

.dark-mode-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: rotate(20deg);
}

/* ============================================================
   DARK MODE THEME
   ============================================================ */
body.dark-mode {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-light: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  background: #0f172a;
  color: #e2e8f0;
}

body.dark-mode .navbar-custom {
  background: rgba(15, 23, 42, .95) !important;
  border-bottom-color: #334155;
}

body.dark-mode .nav-link-custom {
  color: #cbd5e1 !important;
}

body.dark-mode .nav-link-custom:hover,
body.dark-mode .nav-link-custom.active {
  color: #818cf8 !important;
}

body.dark-mode .dark-mode-btn {
  background: #334155;
  border-color: #475569;
  color: #fbbf24;
}

body.dark-mode .dark-mode-btn:hover {
  background: #fbbf24;
  color: #0f172a;
  border-color: #fbbf24;
}

body.dark-mode .hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
}

body.dark-mode .hero-section h1 {
  color: #f1f5f9;
}

body.dark-mode .hero-section p {
  color: #94a3b8;
}

body.dark-mode .hero-stat {
  background: rgba(255, 255, 255, .05);
}

body.dark-mode .hero-stat .label {
  color: #94a3b8;
}

body.dark-mode .hero-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .btn-outline-custom {
  border-color: #475569;
  color: #cbd5e1;
}

body.dark-mode .btn-outline-custom:hover {
  background: #334155;
}

body.dark-mode .section-padding {
  background: #0f172a;
}

body.dark-mode .section-padding .section-title {
  color: #f1f5f9;
}

body.dark-mode .section-padding .section-subtitle {
  color: #94a3b8;
}

body.dark-mode .section-badge {
  background: rgba(99, 102, 241, .15);
  color: #818cf8;
}

body.dark-mode .doc-type-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .doc-type-card:hover {
  border-color: #818cf8;
  background: #1e293b;
}

body.dark-mode .doc-type-card h5 {
  color: #f1f5f9;
}

body.dark-mode .doc-type-card p {
  color: #94a3b8;
}

body.dark-mode .how-it-works {
  background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
}

body.dark-mode .footer {
  background: #020617;
}

body.dark-mode .footer-bottom {
  border-top-color: #1e293b;
}

body.dark-mode .editor-topbar {
  background: #1e293b;
  border-bottom-color: #334155;
}

body.dark-mode .editor-topbar h4 {
  color: #f1f5f9;
}

body.dark-mode .form-panel {
  background: #0f172a;
  border-right-color: #334155;
}

body.dark-mode .form-panel h4,
body.dark-mode .form-panel label {
  color: #e2e8f0;
}

body.dark-mode .form-group .form-control,
body.dark-mode .form-group .form-select {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .form-group .form-control:focus,
body.dark-mode .form-group .form-select:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, .2);
}

body.dark-mode .form-group .form-control::placeholder {
  color: #64748b;
}

body.dark-mode .preview-panel {
  background: #1a1f2e;
}

body.dark-mode .preview-panel h6 {
  color: #94a3b8;
}

body.dark-mode .template-selector {
  background: #1e293b;
  border-bottom-color: #334155;
}

body.dark-mode .template-chip {
  background: #0f172a;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-mode .template-chip:hover {
  border-color: #818cf8;
}

body.dark-mode .dashboard-view {
  background: #0f172a;
}

body.dark-mode .dashboard-header {
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
}

body.dark-mode .dash-stat {
  background: rgba(255, 255, 255, .05);
}

body.dark-mode .editor-actions .btn {
  background: #334155;
  border-color: #475569;
  color: #e2e8f0;
}

body.dark-mode .editor-actions .btn:hover {
  background: #475569;
}

body.dark-mode .editor-actions .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

body.dark-mode .modal-content {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .modal-header {
  border-bottom-color: #334155;
}

body.dark-mode .share-option {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .share-option:hover {
  background: #334155;
}

/* Dark mode: mobile hamburger menu & brand */
body.dark-mode .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%2306b6d4' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

body.dark-mode .navbar-toggler {
  border: 1.5px solid #06b6d4 !important;
  padding: 6px 10px;
  border-radius: 8px;
}

body.dark-mode .navbar-toggler:focus {
  box-shadow: 0 0 0 3px rgba(6, 182, 212, .3);
}

body.dark-mode .navbar-brand-custom {
  color: #f1f5f9 !important;
}

body.dark-mode .navbar-brand-custom i {
  color: #06b6d4;
}