/* ============================================================
   QR Cute — Stylesheet
   Phong cách: pastel, bo tròn, dễ thương nhưng chuyên nghiệp
   ============================================================ */

:root {
  --pink: #ff8fc7;
  --pink-deep: #ff6fb5;
  --pink-soft: #ffd9ec;
  --pink-bg: #fff5fa;
  --purple: #b98aff;
  --purple-soft: #e7dbff;
  --blue: #8fd0ff;
  --mint: #8ff2cf;
  --yellow: #ffe17a;
  --ink: #5a4a66;
  --ink-soft: #9486a0;
  --line: #f0e3f0;
  --card: #ffffff;
  --bg: #fff9fd;
  --radius: 26px;
  --radius-sm: 16px;
  --shadow-sm: 0 6px 18px rgba(185, 138, 255, 0.14);
  --shadow: 0 18px 44px rgba(201, 130, 175, 0.22);
  --shadow-lg: 0 26px 60px rgba(201, 130, 175, 0.28);
  --font-head: "Baloo 2", system-ui, sans-serif;
  --font-body: "Quicksand", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--pink-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.25; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 249, 253, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 66px;
}
.brand {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--pink-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand:hover { text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }
.footer-brand .brand img { height: 44px; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--ink); font-weight: 600; font-size: 0.95rem; }
.nav-links a:hover { color: var(--pink-deep); text-decoration: none; }
.lang-switch {
  display: inline-flex;
  background: var(--pink-soft);
  border-radius: 999px;
  padding: 3px;
  font-size: 0.82rem;
  font-weight: 700;
}
.lang-switch a {
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--ink-soft);
}
.lang-switch a.active { background: var(--pink); color: #fff; }
.lang-switch a:hover { text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; font-size: 1.6rem; cursor: pointer; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 48px 0 16px;
  position: relative;
  overflow: hidden;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--pink-deep);
  text-shadow: 2px 3px 0 var(--pink-soft);
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--pink), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  max-width: 620px;
  margin: 14px auto 0;
  font-size: 1.08rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}
.badge {
  background: #fff;
  border: 2px solid var(--pink-soft);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* floating decorations */
.deco { position: absolute; font-size: 2rem; opacity: 0.55; pointer-events: none; animation: float 6s ease-in-out infinite; }
.deco.a { top: 18%; left: 6%; }
.deco.b { top: 30%; right: 7%; animation-delay: 1.4s; }
.deco.c { bottom: 8%; left: 14%; animation-delay: 0.8s; }
.deco.d { bottom: 14%; right: 16%; animation-delay: 2s; }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-16px) rotate(6deg); } }

/* ---------- App layout ---------- */
.app {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  margin: 28px 0 12px;
}
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  padding: 24px;
}
.panel h2 { font-size: 1.15rem; margin-bottom: 6px; }
.panel-sub { color: var(--ink-soft); font-size: 0.88rem; font-weight: 600; margin-bottom: 16px; }

/* type tabs */
.type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.type-tab {
  border: 2px solid var(--pink-soft);
  background: var(--pink-bg);
  border-radius: 14px;
  padding: 8px 13px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--ink-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s;
}
.type-tab:hover { border-color: var(--pink); color: var(--ink); }
.type-tab.active {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  border-color: transparent;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* form fields */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; }
.field .hint { font-size: 0.76rem; color: var(--ink-soft); font-weight: 600; margin-top: 4px; }
.input, textarea, select {
  width: 100%;
  border: 2.5px solid var(--pink-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--pink-bg);
  transition: border-color 0.18s, box-shadow 0.18s;
}
textarea { min-height: 96px; resize: vertical; }
.input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(255, 143, 199, 0.18);
}
.input::placeholder, textarea::placeholder { color: #d7bcd0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* checkbox */
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--pink); }

/* ---------- Options / styling panel ---------- */
.opt-group { margin-bottom: 18px; }
.opt-group > .opt-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset {
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  border: 3px solid #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s;
}
.preset:hover { transform: scale(1.12) rotate(-4deg); }
.preset.sel { outline: 3px solid var(--ink); outline-offset: 2px; }

.color-pick {
  display: flex; align-items: center; gap: 8px;
  background: var(--pink-bg); border: 2px solid var(--pink-soft);
  border-radius: 12px; padding: 6px 8px;
}
.color-pick input[type="color"] { width: 30px; height: 30px; border: none; border-radius: 8px; background: none; cursor: pointer; padding: 0; }
.color-pick input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-pick input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
.color-pick .val { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); }

.style-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.style-opt {
  border: 2px solid var(--pink-soft); background: var(--pink-bg); border-radius: 12px;
  padding: 8px 4px; text-align: center; cursor: pointer; font-size: 0.74rem; font-weight: 700;
  color: var(--ink-soft); transition: all 0.15s;
}
.style-opt:hover { border-color: var(--pink); }
.style-opt.sel { border-color: var(--pink); color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.style-opt .ico { font-size: 1.2rem; display: block; margin-bottom: 2px; }

.range-row { display: flex; align-items: center; gap: 10px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--pink); }
.range-row .val { font-weight: 700; font-size: 0.82rem; min-width: 52px; text-align: right; color: var(--ink-soft); }

.logo-drop {
  border: 2px dashed var(--purple); border-radius: 14px; padding: 16px; text-align: center;
  cursor: pointer; background: var(--purple-soft); transition: background 0.15s; font-weight: 600; font-size: 0.85rem; color: var(--ink);
}
.logo-drop:hover { background: #ddd0ff; }
.logo-preview { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.logo-preview img { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); background: #fff; }

/* ---------- Preview / result ---------- */
.preview-wrap { text-align: center; }
.qr-frame {
  display: inline-block; padding: 18px; background: #fff; border-radius: 22px;
  border: 4px dashed var(--purple); box-shadow: var(--shadow);
}
.qr-frame.empty { border-color: var(--pink-soft); color: var(--ink-soft); }
#qr-canvas { width: 256px; height: 256px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* Buffer vẽ của canvas có thể tới 1000px, nhưng hiển thị luôn co về khung 256px
   để preview không phồng lên làm vỡ layout — ảnh tải về vẫn giữ độ phân giải đầy đủ */
#qr-canvas canvas, #qr-canvas svg { border-radius: 8px; max-width: 100%; max-height: 100%; height: auto; width: auto; }
.empty-state { padding: 40px 24px; }
.empty-state .big { font-size: 3rem; display: block; margin-bottom: 8px; }
.empty-state p { color: var(--ink-soft); font-weight: 600; font-size: 0.9rem; }

.dl-label { font-weight: 700; font-size: 0.92rem; color: var(--ink); margin-top: 18px; }
.download-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 16px; padding: 13px 20px;
  font-family: var(--font-head); font-weight: 700; font-size: 1rem; cursor: pointer;
  color: #fff; transition: transform 0.12s, filter 0.2s, box-shadow 0.2s; display: inline-flex; align-items: center; gap: 7px; justify-content: center;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: linear-gradient(135deg, var(--pink), var(--purple)); box-shadow: 0 10px 22px rgba(201, 130, 175, 0.4); width: 100%; font-size: 1.08rem; padding: 15px; }
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-2px); }
.btn-sm { padding: 9px 14px; font-size: 0.86rem; border-radius: 12px; }
.btn-mint { background: linear-gradient(135deg, var(--mint), var(--blue)); color: var(--ink); }
.btn-yellow { background: linear-gradient(135deg, var(--yellow), #ffc46b); color: var(--ink); }
.btn-ghost { background: #fff; color: var(--ink); border: 2px solid var(--pink-soft); }
.btn-ghost:hover { border-color: var(--pink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(calc(100% + 40px));
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 0.9rem; box-shadow: var(--shadow-lg); z-index: 100;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 0.3s, opacity 0.3s, visibility 0.3s; max-width: 90vw;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; pointer-events: auto; }

/* ---------- History ---------- */
.history { margin-top: 16px; }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 8px; }
.history-item { border: 2px solid var(--line); border-radius: 12px; padding: 4px; cursor: pointer; background: #fff; transition: border-color 0.15s; position: relative; }
.history-item:hover { border-color: var(--pink); }
.history-item img { border-radius: 6px; }

/* ---------- Ad slots ---------- */
.ad-slot {
  margin: 28px auto; max-width: 970px; min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(45deg, #fdeef7, #fdeef7 10px, #fbe6f1 10px, #fbe6f1 20px);
  border-radius: 16px; color: var(--ink-soft); font-weight: 700; font-size: 0.8rem; border: 1px dashed var(--pink-soft);
}
.ad-slot.in-content { max-width: 100%; }

/* ---------- Content sections ---------- */
.section { padding: 44px 0; }
.section-title { text-align: center; font-size: clamp(1.5rem, 4vw, 2.1rem); color: var(--ink); margin-bottom: 8px; }
.section-title .em { color: var(--pink-deep); }
.section-lead { text-align: center; color: var(--ink-soft); font-weight: 600; max-width: 640px; margin: 0 auto 30px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature {
  background: #fff; border-radius: var(--radius-sm); padding: 22px; box-shadow: var(--shadow-sm);
  border: 2px solid var(--line); transition: transform 0.18s, box-shadow 0.18s;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature .ico { font-size: 2rem; margin-bottom: 8px; }
.feature h3 { font-size: 1.05rem; margin-bottom: 6px; }
.feature p { font-size: 0.9rem; color: var(--ink-soft); font-weight: 500; }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: step; }
.step { text-align: center; position: relative; }
.step .num {
  width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--pink), var(--purple)); color: #fff;
  font-family: var(--font-head); font-weight: 800; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm);
}
.step h3 { font-size: 1rem; margin-bottom: 4px; }
.step p { font-size: 0.86rem; color: var(--ink-soft); font-weight: 500; }

/* type explainer cards */
.types-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.type-card { background: #fff; border-radius: var(--radius-sm); padding: 18px; border: 2px solid var(--line); box-shadow: var(--shadow-sm); }
.type-card h3 { font-size: 1rem; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.type-card p { font-size: 0.86rem; color: var(--ink-soft); font-weight: 500; }

/* FAQ */
.faq { max-width: 760px; margin: 0 auto; }
.faq-item { background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; overflow: hidden; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 16px 20px; font-family: var(--font-head); font-weight: 700; font-size: 1rem; color: var(--ink);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq-q .chev { transition: transform 0.2s; color: var(--pink-deep); }
.faq-item.open .faq-q .chev { transform: rotate(180deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; padding: 0 20px; }
.faq-item.open .faq-a { max-height: 400px; padding-bottom: 16px; }
.faq-a p { color: var(--ink-soft); font-weight: 500; font-size: 0.94rem; }

/* prose (privacy/about) */
.prose { max-width: 760px; margin: 0 auto; padding: 30px 0; }
.prose h1 { font-size: 2rem; color: var(--pink-deep); margin-bottom: 16px; }
.prose h2 { font-size: 1.3rem; margin: 26px 0 10px; }
.prose p, .prose li { color: var(--ink); font-weight: 500; margin-bottom: 10px; }
.prose ul { padding-left: 22px; }
.prose .updated { color: var(--ink-soft); font-style: italic; font-size: 0.9rem; }

/* ---------- Donate ---------- */
.donate-section { background: linear-gradient(135deg, #fff0f8, #eafff6); }
.donate-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 3px solid #fff; padding: 18px; max-width: 340px; margin: 0 auto; text-align: center;
}
.donate-card img { width: 280px; max-width: 100%; height: auto; border-radius: 16px; margin: 0 auto; }
.donate-note { margin-top: 12px; font-weight: 700; color: var(--ink-soft); font-size: 0.9rem; }
.donate-thanks { display: inline-block; margin-top: 14px; font-size: 1.4rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: linear-gradient(135deg, #fff0f8, #f1e9ff);
  border-top: 1px solid var(--line); margin-top: 40px; padding: 36px 0 24px;
}
.footer-grid { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-brand { max-width: 280px; }
.footer-brand .brand { margin-bottom: 8px; }
.footer-brand p { font-size: 0.88rem; color: var(--ink-soft); font-weight: 500; }
.footer-col h4 { font-size: 0.95rem; margin-bottom: 10px; }
.footer-col a { display: block; color: var(--ink-soft); font-size: 0.9rem; font-weight: 600; margin-bottom: 6px; }
.footer-col a:hover { color: var(--pink-deep); }
.footer-bottom { text-align: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.84rem; font-weight: 600; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .features, .types-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .nav-links { position: fixed; top: 66px; right: 0; left: 0; background: var(--bg); flex-direction: column; align-items: stretch; padding: 16px 20px; gap: 14px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); transform: translateY(-150%); transition: transform 0.25s; }
  .nav-links.open { transform: translateY(0); }
  .nav-toggle { display: block; }
  .features, .types-grid, .steps { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
}
