/*
 * VIG Tools — Shared Design System
 * https://tools.vigdigital.com
 *
 * File này chứa design tokens + CSS cho header, footer, dropdown menu.
 * Mỗi tool chỉ cần <link rel="stylesheet" href="/shared/vig-tools.css">
 * và <script src="/shared/vig-tools.js" defer></script>.
 *
 * Light mode only. Không có dark mode.
 */

/* ── Design tokens (VIG brand) ── */
:root {
  --ground: #F7F3EC;
  --surface: #FFFFFF;
  --surface-2: #FCFAF4;
  --ink: #211C15;
  --muted: #6E6555;
  --faint: #948A77;
  --hairline: #E7DECD;
  --hairline-strong: #D8CDB6;
  --brand: #C4275D;
  --brand-bright: #D4305F;
  --brand-soft: #FBEDF2;
  --success: #3E7A56;
  --success-soft: #E3EFE5;
  --warn: #B4712A;
  --warn-soft: #F6E9D3;
  --danger: #B0473B;
  --danger-soft: #F6E0DB;
  --shadow: 0 1px 2px rgba(33,28,21,.04), 0 12px 32px -12px rgba(33,28,21,.16);
  --radius: 14px;
  --radius-sm: 9px;
}

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
body {
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  background: var(--ground);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.vig-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ground);
  border-bottom: 1px solid var(--hairline);
  padding: 0 24px;
}
.vig-header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.vig-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.vig-header-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vig-header-mark svg { width: 18px; height: 18px; }
.vig-header-title {
  font-family: 'Instrument Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.vig-header-title span { color: var(--brand); }

/* Header right */
.vig-header-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Dropdown ── */
.vig-dropdown { position: relative; }
.vig-dropdown-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
}
.vig-dropdown-btn:hover {
  border-color: var(--hairline-strong);
  box-shadow: 0 1px 3px rgba(33,28,21,.08);
}
.vig-dropdown-btn svg {
  width: 12px; height: 12px;
  color: var(--muted);
  transition: transform .15s;
}
.vig-dropdown.open .vig-dropdown-btn svg { transform: rotate(180deg); }
.vig-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 200;
}
.vig-dropdown.open .vig-dropdown-menu { display: block; }
.vig-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background .12s;
}
.vig-dropdown-menu a:hover { background: var(--hairline); }
.vig-dropdown-menu a .tool-ico {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.vig-dropdown-menu a .tool-ico svg { width: 14px; height: 14px; stroke-width: 1.8; }
.vig-dropdown-menu a .tool-info { flex: 1; line-height: 1.3; }
.vig-dropdown-menu a .tool-name { font-weight: 600; font-size: 13px; }
.vig-dropdown-menu a .tool-desc { font-size: 11px; color: var(--muted); font-weight: 400; }
.vig-dropdown-divider { height: 1px; background: var(--hairline); margin: 4px 0; }
.vig-dropdown-menu a.ext { color: var(--muted); font-weight: 400; }

/* Tool icon colors */
.icon-pixclean { background: #EDE9FE; color: #7C3AED; }
.icon-pixoptimizer { background: #FEF3C7; color: #D97706; }
.icon-pixmark { background: #CCFBF1; color: #0D9488; }
.icon-seo { background: #DBEAFE; color: #2563EB; }
.icon-schema { background: #D1FAE5; color: #059669; }
.icon-og { background: #FCE7F3; color: #DB2777; }
.icon-qr { background: #E0E7FF; color: #4F46E5; }
.icon-count { background: #E2E8F0; color: #475569; }

@media (max-width: 640px) {
  .vig-dropdown-menu {
    position: fixed;
    top: 56px;
    left: 0; right: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    min-width: auto;
  }
}

/* ── Footer (compact 2-row) ── */
.vig-footer {
  border-top: 1px solid var(--hairline);
  padding: 20px 24px;
  margin-top: 44px;
}
.vig-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}
.vig-footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px 11px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 9px;
}
.vig-footer-row a { color: var(--muted); text-decoration: none; }
.vig-footer-row a:hover { color: var(--brand); }
.vig-footer-row .fmark {
  width: 19px; height: 19px;
  border-radius: 5px;
  background: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.vig-footer-row .fmark svg { width: 11px; height: 11px; }
.vig-footer-row b a { color: var(--brand); font-weight: 600; }
.vig-footer-privacy {
  font-size: 11px;
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.vig-footer-privacy .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--hairline-strong);
}

/* ════════════════════════════════════════════════════════════
   FEEDBACK MODAL (Góp ý / Báo lỗi / Đánh giá)
   ════════════════════════════════════════════════════════════ */
.vig-fb[hidden] { display: none; }
.vig-fb { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 18px; }
.vig-fb-backdrop { position: absolute; inset: 0; background: rgba(33,28,21,.45); }
.vig-fb-modal { position: relative; width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.25); max-height: calc(100vh - 36px); overflow: auto; }
.vig-fb-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--faint); cursor: pointer; padding: 4px 8px; }
.vig-fb-x:hover { color: var(--ink); }
.vig-fb-body { padding: 22px 22px 20px; }
.vig-fb-body h3 { font-family: 'Fraunces', Georgia, serif; font-size: 21px; margin: 0 0 4px; color: var(--ink); }
.vig-fb-sub { font-size: 13.5px; color: var(--muted); margin: 0 0 16px; }
.vig-fb-form { display: flex; flex-direction: column; gap: 12px; }
.vig-fb-seg { display: inline-flex; border: 1px solid var(--hairline-strong); border-radius: 9px; overflow: hidden; align-self: flex-start; }
.vig-fb-seg button { border: 0; background: var(--surface); color: var(--muted); padding: 8px 14px; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.vig-fb-seg button.on { background: var(--brand); color: #fff; }
.vig-fb-stars { display: flex; gap: 4px; font-size: 26px; line-height: 1; color: var(--hairline-strong); cursor: pointer; }
.vig-fb-stars span { transition: color .1s; }
.vig-fb-stars span.on { color: #E0A800; }
.vig-fb-form textarea, .vig-fb-form input[type=email] {
  width: 100%; box-sizing: border-box; border: 1px solid var(--hairline-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font: inherit; font-size: 14px; background: var(--surface); color: var(--ink); resize: vertical;
}
.vig-fb-form textarea:focus, .vig-fb-form input[type=email]:focus { outline: none; border-color: var(--brand); }
.vig-fb-consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); line-height: 1.4; cursor: pointer; }
.vig-fb-consent input { margin-top: 2px; accent-color: var(--brand); flex: none; }
.vig-fb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.vig-fb-submit { background: var(--brand); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 11px 16px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: .15s; }
.vig-fb-submit:hover { background: var(--brand-bright); }
.vig-fb-submit:disabled { opacity: .6; cursor: default; }
.vig-fb-note { font-size: 11.5px; color: var(--faint); margin: 0; line-height: 1.4; }
.vig-fb-result { margin: 0; font-size: 13.5px; font-weight: 600; padding: 9px 12px; border-radius: var(--radius-sm); }
.vig-fb-result.ok { background: #e9f6ee; color: var(--success); }
.vig-fb-result.err { background: #fdecea; color: var(--danger); }

/* ════════════════════════════════════════════════════════════
   FLOATING RATING WIDGET (Đánh giá 👍/👎 → bình luận)
   ════════════════════════════════════════════════════════════ */
.vig-rate { position: fixed; right: 20px; bottom: 20px; z-index: 9990; }
.vig-rate-fab {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: var(--brand); color: #fff; border: 0; border-radius: 999px;
  padding: 11px 16px; font: inherit; font-size: 14px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(196,39,93,.35); transition: transform .15s, background .15s;
}
.vig-rate-fab:hover { background: var(--brand-bright); transform: translateY(-1px); }
.vig-rate-fab svg { width: 18px; height: 18px; }
.vig-rate.open .vig-rate-fab { display: none; }
.vig-rate-panel {
  display: none; position: absolute; right: 0; bottom: 0; width: 300px; max-width: calc(100vw - 40px);
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  box-shadow: 0 16px 44px rgba(0,0,0,.22); padding: 18px 18px 16px;
}
.vig-rate.open .vig-rate-panel { display: block; }
.vig-rate-x { position: absolute; top: 6px; right: 9px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--faint); cursor: pointer; }
.vig-rate-x:hover { color: var(--ink); }
.vig-rate-q { margin: 2px 0 12px; font-size: 15px; font-weight: 600; color: var(--ink); }
.vig-rate-thumbs { display: flex; gap: 10px; }
.vig-rate-thumbs button {
  flex: 1; border: 1px solid var(--hairline-strong); background: var(--surface-2);
  border-radius: var(--radius-sm); padding: 12px 0; font-size: 26px; cursor: pointer; transition: .15s; line-height: 1;
}
.vig-rate-thumbs button:hover { border-color: var(--brand); background: var(--brand-soft); transform: translateY(-1px); }
.vig-rate-link { font-size: 14px; font-weight: 600; color: var(--brand); text-decoration: none; }
.vig-rate-link:hover { text-decoration: underline; }
.vig-rate-form { display: flex; flex-direction: column; gap: 9px; }
.vig-rate-form input[type=email], .vig-rate-form textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--hairline-strong); border-radius: var(--radius-sm);
  padding: 9px 11px; font: inherit; font-size: 13.5px; background: var(--surface); color: var(--ink); resize: vertical;
}
.vig-rate-form input:focus, .vig-rate-form textarea:focus { outline: none; border-color: var(--brand); }
.vig-rate-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.vig-rate-send { background: var(--brand); color: #fff; border: 0; border-radius: var(--radius-sm); padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.vig-rate-send:hover { background: var(--brand-bright); }
.vig-rate-send:disabled { opacity: .6; cursor: default; }
.vig-rate-result { margin: 0; font-size: 13px; font-weight: 600; }
.vig-rate-result.err { color: var(--danger); }
@media (max-width: 560px) { .vig-rate-fab span { display: none; } .vig-rate-fab { padding: 12px; } }

/* Cloudflare Turnstile trong form (chỉ hiện khi đã bật site key) */
.vig-fb-cf:empty,.vig-rate-cf:empty{display:none}
.vig-fb-cf,.vig-rate-cf{margin:2px 0}
