/* Certificate PDF Generator */
:root {
  --bg: #0f0f14;
  --bg-card: #1e1e28;
  --bg-surface: #18181f;
  --primary: #a855f7;
  --primary-dark: #7c3aed;
  --accent: #f59e0b;
  --text: #e8e8f0;
  --text-muted: #9999b8;
  --text-faint: #555570;
  --border: #2a2a3d;
  --radius: 10px;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* ── layout ──────────────────────────────────── */
.page-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ── header ──────────────────────────────────── */
.tool-header {
  padding: 2rem 0 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.tool-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tool-icon svg { width: 26px; height: 26px; stroke: #fff; }

.tool-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; }
.tool-header p  { color: var(--text-muted); font-size: .95rem; }

/* ── breadcrumb ──────────────────────────────── */
.breadcrumb {
  font-size: .8rem;
  color: var(--text-faint);
  padding: 1rem 0 0;
  display: flex; gap: .4rem; align-items: center; flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-faint); }
.breadcrumb a:hover { color: var(--text-muted); text-decoration: none; }
.breadcrumb span { color: var(--text-faint); }

/* ── main two-column layout ──────────────────── */
.tool-main {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 820px) {
  .tool-main { grid-template-columns: 1fr; }
}

/* ── card base ───────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-title {
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── template picker ─────────────────────────── */
.tpl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .6rem;
  margin-bottom: 1rem;
}

.tpl-thumb {
  position: relative;
  cursor: pointer;
  border-radius: 7px;
  overflow: hidden;
  border: 2px solid transparent;
  aspect-ratio: 4/3;
  transition: border-color .15s;
}
.tpl-thumb:hover { border-color: var(--primary); }
.tpl-thumb.selected { border-color: var(--primary); }
.tpl-thumb canvas {
  width: 100%; height: 100%;
  display: block;
}
.tpl-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55);
  font-size: .65rem;
  color: #fff;
  text-align: center;
  padding: 2px 0;
}

/* ── form fields ─────────────────────────────── */
.field-group { margin-bottom: .85rem; }
.field-group label {
  display: block;
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: .35rem;
}

.field-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: .9rem;
  padding: .55rem .75rem;
  outline: none;
  transition: border-color .15s;
}
.field-input:focus { border-color: var(--primary); }
.field-input::placeholder { color: var(--text-faint); }

textarea.field-input {
  resize: vertical;
  min-height: 62px;
  font-family: inherit;
}

/* ── orientation toggle ──────────────────────── */
.orient-row {
  display: flex; gap: .5rem; margin-bottom: .85rem;
}
.orient-chip {
  flex: 1;
  padding: .45rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: .8rem;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.orient-chip:hover { border-color: var(--primary); color: var(--text); }
.orient-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── download button ─────────────────────────── */
.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .75rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
  margin-top: .5rem;
}
.btn-download:hover { opacity: .88; }
.btn-download svg { width: 18px; height: 18px; stroke: #fff; fill: none; flex-shrink: 0; }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  width: 100%;
  padding: .6rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: .85rem;
  cursor: pointer;
  transition: all .15s;
  margin-top: .5rem;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--text); }
.btn-secondary svg { width: 16px; height: 16px; stroke: currentColor; fill: none; flex-shrink: 0; }

/* ── preview panel ───────────────────────────── */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.preview-wrap {
  position: relative;
  background: #1a1a24;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 300px;
}

#previewCanvas {
  max-width: 100%;
  border-radius: 4px;
  box-shadow: 0 4px 32px rgba(0,0,0,.6);
  display: block;
}

.preview-hint {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-size: .7rem;
  color: var(--text-faint);
}

/* ── color chips ─────────────────────────────── */
.color-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}
.color-chip {
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s, border-color .12s;
}
.color-chip:hover { transform: scale(1.15); }
.color-chip.selected { border-color: #fff; transform: scale(1.1); }

/* ── font selector ───────────────────────────── */
.font-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
  margin-bottom: .85rem;
}
.font-chip {
  padding: .4rem .6rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: .8rem;
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.font-chip:hover { border-color: var(--primary); color: var(--text); }
.font-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── sections ────────────────────────────────── */
.sections { margin-top: 2.5rem; display: flex; flex-direction: column; gap: 2rem; }

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}

.prose {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: .95rem;
}
.prose p { margin-bottom: .75rem; }
.prose ul { padding-left: 1.25rem; margin-bottom: .75rem; }
.prose li { margin-bottom: .3rem; }
.prose strong { color: var(--text); }

/* ── how-to steps ────────────────────────────── */
.steps { display: flex; flex-direction: column; gap: .75rem; }
.step-item {
  display: flex; gap: 1rem; align-items: flex-start;
}
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.step-text { color: var(--text-muted); font-size: .9rem; padding-top: .3rem; line-height: 1.5; }

/* ── FAQ ─────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: .6rem; }
.faq-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.faq-q {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .9rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  gap: .5rem;
}
.faq-q svg {
  width: 16px; height: 16px;
  stroke: var(--text-muted);
  flex-shrink: 0;
  transition: transform .2s;
}
.faq-item.open .faq-q svg { transform: rotate(45deg); }
.faq-a {
  display: none;
  padding: 0 1rem 1rem;
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.6;
}
.faq-item.open .faq-a { display: block; }

/* ── related tools ───────────────────────────── */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .85rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s;
  display: block;
}
.related-card:hover { border-color: var(--primary); text-decoration: none; }
.related-card-title { font-size: .88rem; font-weight: 600; margin-bottom: .25rem; }
.related-card-desc  { font-size: .78rem; color: var(--text-muted); line-height: 1.4; }

/* ── ad placeholder ──────────────────────────── */
.ad-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: .8rem;
  margin-top: 1rem;
}

/* ── toast ───────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #2a2a3d;
  color: var(--text);
  padding: .6rem 1.25rem;
  border-radius: 999px;
  font-size: .85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 999;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
