/* Đối chiếu iLovePDF — nhóm ai (09/11/2026). Chỉ agent nhóm ai sửa tệp này. */
:root {
  --ai-purple: #7253e2;
  --ai-purple-dark: #3f268c;
  --ai-purple-soft: #dad9fb;
  --ai-purple-bg: #f0effd;
}

/* ---------- Huy hiệu AI + nút tím dùng chung ---------- */
.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 3px 8px;
  border: 1px solid #7b67eb;
  border-radius: 4px;
  background: var(--ai-purple-soft);
  color: #47474f;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
}
.ai-badge .ai-sparkle { width: 14px; height: 14px; color: var(--ai-purple); }
.ai-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--ai-purple);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s;
}
.ai-primary:hover:not(:disabled) { background: #5e3fd6; }
.ai-primary:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Hộp thoại cài đặt tóm tắt ---------- */
dialog.ai-settings-dialog {
  width: min(800px, calc(100vw - 32px));
  max-width: none;
  margin: 24px auto auto;
  padding: 0;
  border-radius: 8px;
  box-shadow: 0 0 5px rgba(0, 0, 0, .5);
  text-align: center;
  color: #47474f;
}
dialog.ai-settings-dialog::backdrop { background: rgba(22, 22, 22, .5); backdrop-filter: none; }
dialog.ai-settings-dialog > h2 {
  margin: 32px 64px 24px;
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: #33333b;
}
dialog.ai-settings-dialog .pdf-dialog-close { top: 14px; right: 14px; }
.ai-settings-dialog .ai-settings { min-width: 0; padding: 0 64px 48px; }
.ai-settings-dialog .ai-settings h3 {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: #33333b;
}
.ai-settings-dialog .ai-settings h3:not(:first-child) { margin-top: 40px; }
.ai-settings-dialog input[type=range] {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: calc(100% - 24px);
  height: 6px;
  margin: 0 12px;
  border-radius: 6px;
  background: linear-gradient(to right, var(--ai-purple) var(--fill), #d6d6df var(--fill));
  cursor: pointer;
}
.ai-settings-dialog input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #47474f;
  box-shadow: 0 0 0 1px #fff;
}
.ai-settings-dialog input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1px solid #47474f;
}
.ai-settings-dialog .ai-length-labels { margin-top: 12px; }
.ai-settings-dialog .ai-length-labels button {
  padding: 0;
  font-size: 14px;
  line-height: 20px;
  color: #555;
  cursor: pointer;
}
.ai-settings-dialog .ai-length-labels [aria-pressed=true] { color: #33333b; font-weight: 500; }
.ai-tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ai-tier.ai-choice, .mark-dialog label.ai-tier {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 16px;
  border: 1px solid #d6d6df;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  color: #47474f;
  text-align: left;
  transition: border-color .15s;
}
.ai-tier.ai-choice:hover { border-color: #9f8fe9; }
.ai-tier.ai-choice:has(input:checked) { border-color: var(--ai-purple-dark); }
.ai-tier input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1px solid #47474f;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.ai-tier input:checked { background: radial-gradient(circle, #33333b 0 6px, #fff 6.5px); }
.ai-tier input:focus-visible { outline: 2px solid var(--ai-purple); outline-offset: 2px; }
.ai-help { position: relative; display: inline-flex; color: #47474f; cursor: help; }
.ai-help:is(:hover, :focus-visible)::after {
  content: attr(data-tooltip);
  position: absolute;
  z-index: 20;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 260px;
  padding: 8px 12px;
  border-radius: 4px;
  background: #47474f;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  line-height: 18px;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}
.ai-help:is(:hover, :focus-visible)::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #47474f;
}
.ai-settings-dialog .ai-primary:focus-visible { outline: 2px solid #b9a9f5; outline-offset: 2px; }
.ai-dialog-footer {
  display: flex;
  justify-content: flex-end;
  padding: 24px;
  border-top: 1px solid #d6d6df;
}
.ai-settings-dialog .mark-error:not([hidden]) { margin: 0 24px 16px; }

/* ---------- Không gian tóm tắt ---------- */
.ai-summary { grid-template-columns: minmax(0, 1fr) minmax(360px, 580px); }
.ai-preview { padding: 36px 9%; border-right: 1px solid #e3e3ea; }
.ai-preview figure { box-shadow: none; outline: 1px solid #0b74de; max-width: 600px; }
.ai-chat > header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  border-bottom: 1px solid #e3e3ea;
}
.ai-chat > header h1 { margin: 0; font-size: 24px; font-weight: 600; line-height: 30px; color: #33333b; }
.ai-scroll { padding: 24px 32px; }
.ai-start { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; text-align: center; }
.ai-start p { margin: 0; max-width: 380px; font-size: 14px; line-height: 20px; color: #707078; }
.ai-start .ai-sparkle { width: 18px; height: 18px; }
.ai-author { margin: 0 0 4px; font-size: 12px; line-height: 18px; color: #707078; }
.ai-conversation { color: var(--ai-purple-dark); font-size: 16px; line-height: 28px; }
.ai-conversation h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; line-height: 26px; color: var(--ai-purple-dark); }
.ai-points { padding-left: 22px; margin: 0 0 20px; }
.ai-points li { margin: 0 0 8px; line-height: 28px; }
.ai-source-page {
  display: inline-block;
  margin-left: 2px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--ai-purple-bg);
  color: var(--ai-purple);
  font-size: 12px;
  line-height: 20px;
  text-decoration: none;
  vertical-align: 1px;
  cursor: pointer;
}
.ai-source-page:hover { background: var(--ai-purple-soft); }
.ai-suggest { padding: 12px; border-radius: 8px; background: var(--ai-purple-bg); color: #33333b; }
.ai-suggest summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  list-style: none;
}
.ai-suggest summary::-webkit-details-marker { display: none; }
.ai-suggest summary::after {
  content: '';
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border: solid #47474f;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translateY(-2px);
  transition: transform .15s;
}
.ai-suggest[open] summary::after { transform: rotate(-135deg) translate(-2px, 0); }
.ai-suggest button {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 2px solid #c9c1f5;
  border-radius: 4px;
  background: #fff;
  color: var(--ai-purple-dark);
  font: inherit;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  transition: border-color .15s;
}
.ai-suggest button:hover:not(:disabled) { border-color: var(--ai-purple); }
.ai-suggest .ai-sparkle { flex: none; color: var(--ai-purple); }
.ai-actions { gap: 12px; margin: 12px 0 4px; }
.ai-actions button, .ai-copy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: #707078;
  font: inherit;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
}
.ai-actions button:hover:not(:disabled), .ai-copy:hover { background: #f5f5fa; color: #33333b; }
.ai-actions button.is-copied, .ai-copy.is-copied { color: #2b8a3e; }
.ai-turn { border-top: 0; padding: 16px 0 0; }
.ai-turn > h3 {
  width: fit-content;
  max-width: 85%;
  margin: 0 0 16px auto;
  padding: 10px 16px;
  border-radius: 16px 16px 4px 16px;
  background: #f5f5fa;
  color: #33333b;
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
}
.ai-turn > p:not(.ai-author) { margin: 0 0 6px; }
.ai-turn-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ai-status:not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 16px;
  background: var(--ai-purple-bg);
  color: var(--ai-purple-dark);
}
.ai-status:not(:empty)::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ai-purple);
  box-shadow: 10px 0 0 #a493ee, 20px 0 0 #cfc6f7;
  margin-right: 20px;
  animation: ai-dots 1.2s infinite linear;
}
@keyframes ai-dots { 50% { opacity: .35; } }
.ai-compose { padding: 20px 24px; border-top: 1px solid #e3e3ea; }
.ai-compose textarea {
  min-height: 44px;
  max-height: 140px;
  padding: 10px 16px;
  border: 1px solid var(--ai-purple);
  border-radius: 22px;
  font-size: 16px;
  line-height: 22px;
  resize: none;
}
.ai-compose textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--ai-purple-soft); }
.ai-compose button { width: 46px; height: 46px; background: var(--ai-purple); font-size: 20px; cursor: pointer; }
.ai-compose button:disabled { background: #c6bbf3; opacity: 1; cursor: default; }
[data-ai-cancel]:not([hidden]) { margin: 8px 0; }
@media (max-width: 760px) {
  .ai-summary { grid-template-columns: 1fr; }
  .ai-tiers { grid-template-columns: 1fr; }
  dialog.ai-settings-dialog > h2 { margin: 24px 24px 16px; }
  .ai-settings-dialog .ai-settings { padding: 0 20px 28px; }
}

/* ---------- Dịch PDF / PDF sang Markdown: thanh tùy chọn ---------- */
.ai-translation .ai-options > .ai-badge { align-self: center; margin: 16px auto 0; }
.ai-translation .ai-options:has(> .ai-badge) > h1 { padding-top: 8px; }
.ai-translation .ai-options h3 { margin: 20px 0 12px; font-size: 15px; font-weight: 500; line-height: 20px; color: #33333b; }
.ai-translation .ai-picker { margin: 0; padding: 16px 12px; border-radius: 8px; }
.ai-translation .ai-picker-source { background: #ebebf3; }
.ai-translation .ai-picker-target { background: #dcdaf7; }
.ai-translation .ai-picker label { margin-bottom: 10px; font-size: 15px; font-weight: 500; color: #33333b; }
.ai-translation .ai-picker input {
  height: 44px;
  padding: 4px 36px 4px 12px;
  border: 1px solid #707078;
  border-radius: 4px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2333333b' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
  color: #47474f;
  cursor: pointer;
}
.ai-translation .ai-picker input:focus { outline: none; border-color: var(--ai-purple); box-shadow: 0 0 0 3px var(--ai-purple-soft); cursor: text; }
.ai-translation .ai-pick-menu { left: 12px; width: calc(100% - 24px); top: calc(100% - 12px); border-radius: 4px; }
.ai-translation .ai-pick-menu button { cursor: pointer; }
.ai-translation .ai-pick-menu button:disabled { color: #a3a3ab; cursor: not-allowed; }
.ai-flip-row { position: relative; display: flex; justify-content: center; margin: 4px 0; }
.ai-flip-row::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid #ebebf3; }
.ai-translation .ai-flip {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--ai-purple);
  border-radius: 50%;
  background: #fff;
  color: var(--ai-purple);
  cursor: pointer;
  transition: background-color .15s, transform .2s;
}
.ai-translation .ai-flip:hover { background: var(--ai-purple-bg); transform: rotate(180deg); }
.ai-translation .ai-layout.ai-choice {
  display: flex;
  gap: 12px;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid #d6d6df;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  color: #47474f;
  transition: border-color .15s;
}
.ai-translation .ai-layout.ai-choice:hover { border-color: #9f8fe9; }
.ai-translation .ai-layout.ai-choice:has(input:checked) { border-color: var(--ai-purple-dark); }
.ai-translation .ai-layout input {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 1px solid #47474f;
  border-radius: 50%;
  background: #fff;
}
.ai-translation .ai-layout input:checked { background: radial-gradient(circle, #33333b 0 6px, #fff 6.5px); }
.ai-translation .ai-layout small { margin-top: 2px; font-size: 14px; font-weight: 400; line-height: 18px; color: #47474f; }
.ai-tiers-stack { grid-template-columns: 1fr; gap: 12px; }
.ai-translation .process-button.ai-process { background: var(--ai-purple); border-radius: 12px; gap: 14px; }
.ai-translation .process-button.ai-process:hover:not(:disabled) { background: #5e3fd6; }
.ai-translation .process-button.ai-process .ai-sparkle { width: 26px; height: 26px; }
.ai-translation .info-box { border-radius: 8px; }

/* ---------- Quét thành PDF: hai thẻ bước ---------- */
.scan-landing .scan-steps { gap: 32px; max-width: 752px; margin: 32px auto 28px; }
.scan-landing .scan-steps > section {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 417px;
  padding: 32px 32px 40px;
  border: 0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(72, 72, 100, .1);
  color: #47474f;
  transition: opacity .2s, background-color .2s;
}
.scan-landing .scan-steps strong { font-size: 28px; font-weight: 600; line-height: 36px; color: #33333b; }
.scan-landing .scan-steps p { margin: 12px 0 0; font-size: 16px; line-height: 28px; }
.scan-landing .scan-code { flex: 1; min-height: 0; margin-top: 20px; align-content: center; gap: 10px; }
.scan-landing .scan-code p { margin: 0; font-size: 13px; line-height: 18px; color: #707078; }
.scan-landing .scan-qr { width: 170px; }
.scan-landing .scan-steps > .scan-step-phone b { margin-top: 20px; font-weight: 600; }
.scan-landing .scan-step-phone .scan-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 400;
  line-height: 18px;
  color: #707078;
}
.scan-landing .scan-step-phone .scan-status::after {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a3a3ab;
}
.scan-landing .scan-steps[data-state=connected] .scan-status::after,
.scan-landing .scan-steps[data-state=ready] .scan-status::after { background: #2b8a3e; }
.scan-landing .scan-steps[data-state=disconnected] .scan-status::after { background: #e5322d; }
.scan-landing .scan-steps > .scan-step-phone img { max-height: 110px; margin-top: auto; }
/* Bước 2 mờ cho đến khi điện thoại kết nối, giống trang tham chiếu. */
.scan-landing .scan-steps:not([data-state=connected]):not([data-state=ready]) > .scan-step-phone {
  background: #f8f8fb;
  box-shadow: none;
  opacity: .45;
}
.scan-landing .scan-local { gap: 12px; margin-top: 0; }
.scan-landing .scan-local button { min-height: 48px; padding: 12px 22px; font-size: 16px; }
.scan-landing .drop-hint { margin-top: 8px; font-size: 13px; color: #47474f; }
@media (max-width: 700px) {
  .scan-landing .scan-steps { gap: 12px; margin-top: 20px; }
  .scan-landing .scan-steps > section { min-height: 0; padding: 20px; }
  .scan-landing .scan-steps strong { font-size: 22px; }
}

/* ---------- Trang chủ: thẻ công cụ, nhãn Mới!, thẻ quy trình ---------- */
.home .new-badge {
  top: 13px;
  right: 13px;
  padding: 3px 8px;
  border: 1px solid #def2ff;
  border-radius: 4px;
  background: #def2ff;
  color: #47474f;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
}
.home .workflow-card {
  position: relative;
  overflow: hidden;
  border-style: solid;
  background:
    radial-gradient(circle at 104% 108%, rgba(229, 50, 45, .16) 0 58px, transparent 59px),
    radial-gradient(circle at 92% 30%, rgba(255, 255, 255, .55) 0 26px, transparent 27px),
    radial-gradient(circle at 18% 116%, rgba(255, 255, 255, .5) 0 44px, transparent 45px),
    #fde4df;
}
.home .workflow-card > a { display: flex; flex-direction: column; height: 100%; }
.home .workflow-card img { display: none; }
.home .workflow-card p { flex: 1; }
.home .workflow-card .text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 0;
  padding-top: 24px;
  color: #33333b;
  font-weight: 500;
}
.home .workflow-card .text-link::after {
  content: '';
  width: 16px;
  height: 16px;
  background: no-repeat center/16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2333333b' stroke-width='2'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
}
.home .workflow-card:hover { border-color: #292931; }

/* ---------- Menu đầu trang ---------- */
.menu-group a { font-weight: 500; color: #33333b; }
.menu-group h3 { font-size: 14px; color: #707078; letter-spacing: .01em; }
.dropdown .menu-group a:hover { color: var(--red, #e5322d); }
@media (min-width: 1200px) {
  .mega-menu {
    left: 14px;
    right: 14px;
    top: 73px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 8px 24px;
    padding: 32px;
  }
  .mega-menu .menu-group { grid-row: span 2; }
  .mega-menu .menu-group:first-child { grid-row: 1; }
  .mega-menu .menu-group:last-child { grid-column: 1; grid-row: 2; margin-top: 12px; }
  .mega-menu .menu-group a { font-size: 13px; }
}
.apps-menu > a, .apps-menu > button { font-weight: 500; }
.apps-menu [data-info=language] { display: flex; align-items: center; gap: 8px; }

/* ---------- Chân trang lớn (trang chủ) ---------- */
.footer { background: #292931; color: #fff; padding: 64px max(48px, calc((100% - 1178px) / 2)) 48px; }
.footer h3 { color: #fff; font-size: 16px; font-weight: 600; margin-bottom: 16px; }
.footer a, .footer button { color: #fff; font-size: 14px; line-height: 18px; margin-bottom: 18px; }
.footer a:hover, .footer button:hover { color: #fff; text-decoration: underline; }
.footer-bottom { border-top-color: #47474f; color: #fff; margin-top: 40px; align-items: center; }
.footer-bottom > button {
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #fff;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
}
.footer-bottom > button:hover { text-decoration: none; background: rgba(255, 255, 255, .08); }
.footer-bottom .chevron { border-color: #fff; }
.footer-bottom > span { color: #fff; font-size: 12px; }
@media (max-width: 700px) { .footer { padding: 40px 24px 32px; } }
.scan-landing { padding-bottom: 64px; }
