/* ── Modern AI Tool Layout ── */
:root {
  --p: #7c3aed;
  --p-h: #6d28d9;
  --p-lt: #ede9fe;
  --p-llt: #f5f3ff;
  --bg: #ffffff;
  --bg-2: #f5f3ff;
  --border: #e4e4f0;
  --text: #0f0a1e;
  --text2: #4b4b6a;
  --text3: #8888aa;
  --r: 12px;
  --r-lg: 18px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Be Vietnam Pro', sans-serif;
  color: var(--text);
  background: #fff;
  line-height: 1.6;
}

/* ────────────────────────────────────────────────
   HERO
──────────────────────────────────────────────── */
#hero {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 55%, #ddd6fe 100%);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
#hero::before {
  content: '';
  position: absolute; top: -80px; right: -80px;
  width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,.14) 0%, transparent 70%);
  pointer-events: none;
}
#hero::after {
  content: '';
  position: absolute; bottom: -60px; left: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,58,237,.09) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 700px; margin: 0 auto;
}
.hero-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(124,58,237,.12); color: var(--p);
  font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 6px 16px; border-radius: 100px; margin-bottom: 20px;
  border: 1px solid rgba(124,58,237,.2);
}
.hero-chip svg { width: 14px; height: 14px; flex-shrink: 0; }
#hero h1 {
  font-size: clamp(26px, 4vw, 46px);
  font-weight: 800; color: var(--text);
  line-height: 1.12; letter-spacing: -.5px; margin-bottom: 14px;
}
#hero h1 span { color: var(--p); }
#hero > .hero-inner > p {
  font-size: 16px; color: var(--text2);
  max-width: 540px; margin: 0 auto 24px; line-height: 1.7;
}
.hero-pills {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.hero-pill {
  background: rgba(255,255,255,.8); color: var(--text2);
  font-size: 13px; font-weight: 600;
  padding: 6px 16px; border-radius: 100px;
  border: 1px solid rgba(124,58,237,.2);
}

/* ────────────────────────────────────────────────
   TOOL WRAP (two-column)
──────────────────────────────────────────────── */
#tool-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  max-width: 1200px; margin: 48px auto; padding: 0 24px;
  align-items: start;
}

/* ── Panel card ── */
.tool-panel {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0,0,0,.05);
}
.panel-header {
  background: linear-gradient(135deg, #f5f3ff, #ede9fe);
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
}
.panel-header h2 {
  font-size: 17px; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px; margin: 0;
}
.panel-header h2 span { color: var(--p); }
.panel-header h2 svg { color: var(--p); flex-shrink: 0; }
.panel-body { padding: 24px; }

/* ────────────────────────────────────────────────
   FORM
──────────────────────────────────────────────── */
form {
  display: flex; flex-direction: column; gap: 16px;
}
form label {
  display: block;
  font-size: 13.5px; font-weight: 600; color: var(--text);
  margin-bottom: 6px;
}
form input[type="text"],
form input[type="number"],
form input[type="email"],
form input[type="url"],
form textarea,
form select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  font-size: 14px;
  font-family: 'Be Vietnam Pro', sans-serif;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  line-height: 1.5;
}
form input[type="text"]:focus,
form input[type="number"]:focus,
form input[type="email"]:focus,
form input[type="url"]:focus,
form textarea:focus,
form select:focus {
  border-color: var(--p);
  box-shadow: 0 0 0 3px rgba(124,58,237,.1);
}
form textarea { resize: vertical; min-height: 100px; }
form select { cursor: pointer; }

/* Custom Select (legacy handleCustomSelect.js) */
.customSelect { position: relative; user-select: none; }
.customSelect #inputArea {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: var(--r);
  background: #fff; cursor: pointer; overflow: hidden;
  transition: border-color .2s;
}
.customSelect #inputArea:hover,
.customSelect:focus #inputArea { border-color: var(--p); }
.customSelect .selectValue {
  flex: 1; padding: 11px 14px;
  border: none; outline: none; cursor: pointer;
  font-size: 14px; font-family: 'Be Vietnam Pro', sans-serif;
  color: var(--text); background: transparent;
}
.customSelect #inputArea svg { margin-right: 12px; flex-shrink: 0; }
.customSelect #selectOptions {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--r); z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
  list-style: none; padding: 6px 0;
  max-height: 220px; overflow-y: auto;
}
.customSelect #selectOptions.hidden { display: none; }
.customSelect .option {
  padding: 10px 14px; font-size: 14px;
  color: var(--text); cursor: pointer; transition: background .12s;
}
.customSelect .option:hover { background: var(--p-llt); color: var(--p); }

/* ── Generate button ── */
#generate, button#generate {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 24px;
  background: var(--p); color: #fff;
  border: none; border-radius: var(--r);
  font-size: 15px; font-weight: 700;
  font-family: 'Be Vietnam Pro', sans-serif;
  cursor: pointer; margin-top: 4px;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: 0 4px 14px rgba(124,58,237,.3);
}
#generate:hover, button#generate:hover {
  background: var(--p-h);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,.4);
}
#generate:active, button#generate:active { transform: translateY(0); }
#generate svg, button#generate svg { flex-shrink: 0; }
#generate svg.hidden, button#generate svg.hidden { display: none !important; }

/* ────────────────────────────────────────────────
   OUTPUT AREA  (createOutputAreaDefaultDOM injects here)
──────────────────────────────────────────────── */
.hidden { display: none !important; }

#output-area-container {
  display: flex; flex-direction: column;
  overflow: auto;
  max-height: 44rem; min-height: 340px;
  position: sticky; top: 80px;
}
#output-header {
  display: flex; z-index: 1;
  position: sticky; top: 0;
  gap: 1rem; padding: 12px 16px;
  align-items: center; justify-content: space-between;
  background: #6938ef;
  min-height: 52px; flex-shrink: 0;
}
#header-info-container {
  display: flex; gap: 0.75rem; align-items: center;
}
#output-header h2 {
  color: #fff; margin: 0;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 15px; font-weight: 700; line-height: 1.3;
}
.all-copy {
  display: flex; align-items: center; cursor: pointer; gap: 6px;
}
.all-copy p { margin: 0; color: #cecece; font-size: 13px; }
#stop-btn-container {
  display: flex; align-items: center; cursor: pointer;
  white-space: nowrap; gap: 6px;
}
#stopBtnText { margin: 0; color: #cecece; font-size: 13px; font-weight: 700; }

/* inline copy-button inside code blocks */
.copy-button { position: absolute; right: 6px; top: -12px; }
.copy-button svg { min-width: 0 !important; }
pre { position: relative; }

#output, #cy {
  padding: 16px 24px;
  background: #1f2c3d;
  flex-grow: 1;
  display: flex; flex-direction: column; gap: 0.5rem;
  color: #fff;
  font-family: 'Be Vietnam Pro', sans-serif;
  font-size: 14px; font-weight: 500; line-height: 1.75;
  min-height: 300px;
}
.empty { align-items: center; text-align: center; justify-content: center; }
#circle-above-img { width: 10px; height: 10px; border-radius: 50%; background: #38b1e4; }
#output #img-container {
  display: flex; width: 90px; height: 90px;
  justify-content: center; align-items: center;
  border-radius: 50%; background: #6938ef;
}
#output img { width: 60px; height: 60px; flex-shrink: 0; }
#output h1 { margin: 0 !important; padding: 0 !important; font-size: 2em !important; line-height: 1.4 !important; }
#output h2 { margin: 0 !important; padding: 0 !important; font-size: 1.6em !important; line-height: 1.4 !important; }
#output h3 { margin: 0 !important; padding: 0 !important; font-size: 1.1em !important; line-height: 1.4 !important; }
#output p { margin: 0; }
#output li { margin-bottom: 0.3em; }
#output svg { min-width: 100rem; }
#img-container svg { min-width: 0; }
code { white-space: pre-line; }
code.hljs { white-space: pre-wrap; }
table, th, td { border: 1px solid rgba(255,255,255,.2); }
td { padding: 0.75rem 1rem; }
th { text-align: initial; font-size: 1.1em; }
li:has(h1)::marker { font-size: 2em !important; }
li:has(h2)::marker { font-size: 1.6em !important; }
#codeOutput { overflow: auto; }
#flowchart-action-container { display: flex; gap: 1rem; }
.download-svg-icon-container { display: flex; justify-content: flex-end; }
.download-svg-icon-container svg { width: 20px; height: 20px; cursor: pointer; }
svg#graphDiv { font-size: 11px; font-weight: 500; }
#graphDiv .messageText { fill: white !important; }
#graphDiv .messageLine0 { stroke: white !important; }
.flowchart #output { overflow: auto; }
.gantt .bar-label { fill: #333 !important; font-weight: bold !important; }

/* ────────────────────────────────────────────────
   FEATURES STRIP
──────────────────────────────────────────────── */
#featuresStrip {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 56px 24px;
}
.features-inner {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px;
}
.feat-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 22px;
  text-align: center;
  transition: box-shadow .2s, transform .2s;
}
.feat-card:hover {
  box-shadow: 0 8px 28px rgba(124,58,237,.1);
  transform: translateY(-3px);
}
.feat-icon {
  width: 54px; height: 54px;
  background: var(--p-lt);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px; color: var(--p);
}
.feat-icon svg { width: 24px; height: 24px; }
.feat-card h3 { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.feat-card p { font-size: 13.5px; color: var(--text2); line-height: 1.6; }

/* ────────────────────────────────────────────────
   HOW IT WORKS
──────────────────────────────────────────────── */
#howItWorks {
  max-width: 1200px; margin: 0 auto; padding: 72px 24px;
}
.hiw-eyebrow { text-align: center; margin-bottom: 56px; }
.hiw-eyebrow h2 {
  font-size: clamp(22px, 3vw, 34px); font-weight: 800;
  color: var(--text); margin: 12px 0 10px;
}
.hiw-eyebrow p { font-size: 15px; color: var(--text2); }

.hiw-steps { display: flex; flex-direction: column; gap: 60px; }
.hiw-step {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
}
/* Alternate: even steps put visual on left, text on right */
.hiw-step:nth-child(even) .hiw-step-text { order: 2; }
.hiw-step:nth-child(even) .hiw-step-visual { order: 1; }

.hiw-step-num {
  font-size: 52px; font-weight: 800;
  color: var(--p-lt); line-height: 1;
  margin-bottom: 12px;
}
.hiw-step-text h3 {
  font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 12px;
}
.hiw-step-text p { font-size: 15px; color: var(--text2); line-height: 1.7; }

.hiw-step-visual {
  background: var(--bg-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
}
.mock-label {
  font-size: 11px; font-weight: 700; color: var(--text3);
  text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px;
}
.mock-field {
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 9px 12px;
  font-size: 13px; color: var(--text2); margin-bottom: 6px;
}
.mock-field.active { border-color: var(--p); color: var(--text); }
.mock-divider { height: 1px; background: var(--border); margin: 14px 0; }
.mock-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--p); color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 9px 20px; border-radius: 8px; margin-top: 10px;
}
.mock-output {
  background: #1f2c3d; border-radius: 8px; padding: 14px 16px;
}
.mock-output-line {
  height: 10px; background: rgba(255,255,255,.15); border-radius: 4px; margin-bottom: 8px;
}
.mock-output-line:last-child { width: 60%; margin-bottom: 0; }
.mock-output-line.p { background: rgba(124,58,237,.5); }

/* ── CHIP ── */
.chip {
  display: inline-flex; align-items: center;
  background: var(--p-lt); color: var(--p);
  font-size: 12px; font-weight: 700; letter-spacing: .3px;
  padding: 5px 14px; border-radius: 100px; margin-bottom: 12px;
}

/* ────────────────────────────────────────────────
   ABOUT SECTION
   populateAboutArea() creates:
     .about-area > p#aboutDataHeading  (intro text)
     .about-area > div > h2 + p        (each section card)
──────────────────────────────────────────────── */
#aboutSection {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 72px 24px;
}
.about-header {
  text-align: center; max-width: 640px; margin: 0 auto 48px;
}
.about-header h2 {
  font-size: clamp(20px, 3vw, 32px); font-weight: 800; color: var(--text); margin-bottom: 10px;
}
.about-header p { font-size: 15px; color: var(--text2); line-height: 1.7; }

/* Intro paragraph above the grid */
.about-area {
  max-width: 1200px; margin: 0 auto;
}
.about-area > #aboutDataHeading {
  font-size: 15px; color: var(--text2); line-height: 1.8;
  margin-bottom: 28px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--r-lg); padding: 24px;
  grid-column: 1 / -1;
}
.about-area > #aboutDataHeading a { color: var(--p); text-decoration: none; }
.about-area > #aboutDataHeading a:hover { text-decoration: underline; }

/* Grid of cards — each div created by populateAboutArea */
.about-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
.about-grid > div {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  transition: box-shadow .2s, transform .2s;
}
.about-grid > div:hover {
  box-shadow: 0 6px 24px rgba(124,58,237,.08);
  transform: translateY(-2px);
}
.about-grid > div h2 {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.about-grid > div p {
  font-size: 14px; color: var(--text2); line-height: 1.75; margin: 0;
}
.about-grid > div ul,
.about-grid > div ol {
  padding-left: 20px; margin-top: 8px;
}
.about-grid > div li {
  font-size: 14px; color: var(--text2); line-height: 1.7; margin-bottom: 4px;
}
.about-grid > div a { color: var(--p); text-decoration: none; }
.about-grid > div a:hover { text-decoration: underline; }

/* ────────────────────────────────────────────────
   FAQ SECTION
   generateFAQ() creates:
     .faq-area > div (faqContainer) > details
       details > summary + text + div(SVG icon)
       details > p (answer)
──────────────────────────────────────────────── */
#faqSection {
  max-width: 860px; margin: 0 auto; padding: 72px 24px;
}
.faq-header { text-align: center; margin-bottom: 44px; }
.faq-header h2 {
  font-size: clamp(20px, 3vw, 32px); font-weight: 800; color: var(--text); margin-bottom: 10px;
}
.faq-header p { font-size: 15px; color: var(--text2); }

/* Hide the legacy h2 inside .faq-area that old HTML had */
.faq-area > h2 { display: none; }

/* faqContainer div and details */
.faq-area > div { display: flex; flex-direction: column; gap: 10px; }
.faq-area details {
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  background: #fff;
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
.faq-area details[open] {
  box-shadow: 0 4px 20px rgba(124,58,237,.1);
  border-color: rgba(124,58,237,.35);
}

/* summary — the JS appends a <div> with SVG icon at the end */
.faq-area details summary {
  padding: 18px 22px;
  font-size: 15px; font-weight: 600; color: var(--text);
  cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  user-select: none;
}
.faq-area details summary::-webkit-details-marker { display: none; }

/* Style the SVG icon wrapper added by generateFAQ() */
.faq-area details summary > div {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  background: var(--p-lt); border-radius: 50%;
  transition: background .15s, transform .2s;
}
.faq-area details summary > div svg {
  width: 18px; height: 18px;
  transition: transform .2s;
}
.faq-area details summary > div svg path { fill: var(--p) !important; }
.faq-area details[open] summary > div {
  background: var(--p);
  transform: rotate(45deg);
}
.faq-area details[open] summary > div svg path { fill: #fff !important; }

/* Answer paragraph */
.faq-area details > p {
  padding: 0 22px 18px;
  font-size: 14.5px; color: var(--text2); line-height: 1.75;
  border-top: 1px solid var(--border);
  margin: 0; padding-top: 16px;
}
/* faq-answer class (fallback) */
.faq-area .faq-answer {
  padding: 0 22px 18px; padding-top: 16px;
  font-size: 14.5px; color: var(--text2); line-height: 1.75;
  border-top: 1px solid var(--border); margin: 0;
}

/* ────────────────────────────────────────────────
   MORE TOOLS / SIMILAR TOOLS
   showSimilarTools() → createToolsCards() injects
   .cat-section > .cat-section-hd + .cat-section-grid
   inside #tools-cards-container
──────────────────────────────────────────────── */
#more-tools {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  padding: 64px 24px 80px;
}
#more-tools > h2 {
  text-align: center;
  font-size: clamp(20px, 3vw, 30px); font-weight: 800; color: var(--text);
  margin-bottom: 8px;
}
#more-tools > p {
  text-align: center; font-size: 15px; color: var(--text2); margin-bottom: 40px;
}

/* The container — flex column because createToolsCards creates sections */
#more-tools #tools-cards-container {
  max-width: 1200px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 0;
}
/* Category section header inside more-tools */
#more-tools .cat-section-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 14px; margin-bottom: 20px;
  border-bottom: 2px solid var(--p-lt);
}
#more-tools .cat-section-hd-left {
  display: flex; align-items: center; gap: 10px;
}
#more-tools .cat-section-icon { color: var(--p); display: flex; align-items: center; }
#more-tools .cat-section-title {
  font-size: 18px; font-weight: 700; color: var(--text); margin: 0;
}
#more-tools .cat-section-count {
  font-size: 12px; font-weight: 600; color: var(--p);
  background: var(--p-lt); padding: 4px 12px; border-radius: 100px;
}
/* The 3-column card grid */
#more-tools .cat-section-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}

/* ────────────────────────────────────────────────
   RESPONSIVE
──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .features-inner { grid-template-columns: repeat(2, 1fr); }
  #more-tools .cat-section-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .hiw-step { grid-template-columns: 1fr; gap: 28px; }
  .hiw-step:nth-child(even) .hiw-step-text { order: 1; }
  .hiw-step:nth-child(even) .hiw-step-visual { order: 2; }
  .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  #tool-wrap {
    grid-template-columns: 1fr; gap: 24px;
    padding: 0 16px; margin: 32px auto;
  }
  #more-tools .cat-section-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  #hero { padding: 48px 16px 44px; }
  .features-inner { grid-template-columns: 1fr; gap: 14px; }
  #more-tools .cat-section-grid { grid-template-columns: 1fr; }
  #featuresStrip, #howItWorks, #aboutSection, #faqSection, #more-tools {
    padding-left: 16px; padding-right: 16px;
  }
}

/* ────────────────────────────────────────────────
   GLOBAL LINK FIX (replaces global.css for tool pages)
──────────────────────────────────────────────── */
a { text-decoration: none; color: inherit; }
a.custom-link { color: #1a73e8 !important; }
a.custom-link:hover { color: #9333ea !important; text-decoration: underline !important; }
