/* v2.1.8 — popup ยินยอม PDPA/คุกกี้ + ลิงก์ footer + หน้า privacy.php (CSS ล้วน ไม่ต้อง build Tailwind) */

/* ---------- ลิงก์ใน footer ---------- */
.cme-footer-links { white-space: nowrap; }
.cme-footer-sep { margin: 0 .5rem; opacity: .8; }
.cme-footer-links a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.cme-footer-links a:hover, .cme-footer-links a:focus-visible { opacity: .85; }
@media (max-width: 480px) {
  .cme-footer-links { display: block; margin-top: .25rem; }
  .cme-footer-sep { display: none; }
}

/* ---------- popup ยินยอม ---------- */
html.cme-consent-lock, html.cme-consent-lock body { overflow: hidden; }
.cme-consent[hidden], .cme-consent-prefs[hidden] { display: none !important; }
.cme-consent {
  position: fixed; inset: 0; z-index: 1050; /* ต่ำกว่า SweetAlert2 (1060) เพื่อไม่บังข้อความแจ้งเตือนของระบบ */
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: rgba(17, 24, 39, .55);
}
@media (min-width: 640px) { .cme-consent { align-items: center; } }
.cme-consent-box {
  width: 100%; max-width: 40rem; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto;
  background: #fff; color: #1f2937; border-radius: 1rem; box-shadow: 0 25px 50px -12px rgba(0,0,0,.35);
  padding: 1.25rem; text-align: left; font-weight: 400;
}
@media (min-width: 640px) { .cme-consent-box { padding: 1.75rem; } }
.cme-consent-title { font-size: 1.125rem; font-weight: 700; color: rgb(var(--cme-primary-rgb, 74 44 109)); margin: 0 0 .75rem; line-height: 1.4; }
.cme-consent-title i { margin-right: .35rem; }
.cme-consent-body { font-size: .9rem; line-height: 1.65; }
.cme-consent-body p { margin: 0 0 .6rem; }
.cme-consent-body a, .cme-privacy a { color: rgb(var(--cme-primary-rgb, 74 44 109)); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cme-consent-prefs { border: 1px solid #e5e7eb; border-radius: .75rem; margin: .5rem 0 .25rem; }
.cme-consent-pref { display: flex; gap: .75rem; align-items: center; justify-content: space-between; padding: .75rem .9rem; font-size: .85rem; line-height: 1.5; }
.cme-consent-pref + .cme-consent-pref { border-top: 1px solid #e5e7eb; }
.cme-consent-pref span { color: #6b7280; }
.cme-consent-pref .cme-consent-always, .cme-consent-pref .cme-consent-none { flex-shrink: 0; font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; }
.cme-consent-pref .cme-consent-always { background: #dcfce7; color: #166534; }
.cme-consent-pref .cme-consent-none { background: #f3f4f6; color: #6b7280; }
.cme-consent-actions { display: flex; flex-direction: column-reverse; gap: .5rem; margin-top: 1rem; }
.cme-consent-actions button { width: 100%; padding-top: .75rem; padding-bottom: .75rem; }
@media (min-width: 640px) {
  .cme-consent-actions { flex-direction: row; justify-content: flex-end; }
  .cme-consent-actions button { width: auto; }
}

/* โหมดแถบด้านล่าง (หน้า privacy.php) — ไม่บังเนื้อหานโยบาย */
.cme-consent.is-banner { inset: auto 0 0 0; background: transparent; padding: 0; pointer-events: none; }
.cme-consent.is-banner .cme-consent-box { max-width: none; border-radius: 1rem 1rem 0 0; max-height: 60vh; pointer-events: auto; border-top: 4px solid rgb(var(--cme-primary-rgb, 74 44 109)); }
.cme-consent.is-banner .cme-consent-body p:not(:last-child) { display: none; }
html.cme-consent-pad body { padding-bottom: 14rem; }

/* ---------- หน้านโยบาย privacy.php ---------- */
.cme-privacy { line-height: 1.75; font-size: .95rem; }
.cme-privacy h2 { font-size: 1.35rem; font-weight: 700; color: rgb(var(--cme-primary-rgb, 74 44 109)); margin: 0 0 .25rem; scroll-margin-top: 1rem; }
.cme-privacy h3 { font-size: 1.05rem; font-weight: 700; color: #111827; margin: 1.5rem 0 .5rem; }
.cme-privacy p { margin: 0 0 .75rem; }
.cme-privacy ul { list-style: disc; padding-left: 1.4rem; margin: 0 0 .75rem; }
.cme-privacy li { margin-bottom: .3rem; }
.cme-privacy .cme-privacy-meta { color: #6b7280; font-size: .85rem; margin-bottom: 1rem; }
.cme-privacy .cme-privacy-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: .75rem; padding: .9rem 1rem; white-space: pre-line; margin: 0 0 .75rem; }
.cme-privacy-table { width: 100%; overflow-x: auto; margin: 0 0 1rem; -webkit-overflow-scrolling: touch; }
.cme-privacy-table table { width: 100%; min-width: 34rem; border-collapse: collapse; font-size: .875rem; }
.cme-privacy-table th, .cme-privacy-table td { border: 1px solid #e5e7eb; padding: .5rem .65rem; text-align: left; vertical-align: top; }
.cme-privacy-table th { background: #f3f4f6; font-weight: 600; }
.cme-privacy-toc { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.25rem; }
.cme-privacy-toc a { text-decoration: none; }
.cme-privacy-divider { border: 0; border-top: 2px dashed #e5e7eb; margin: 2rem 0; }
@media print {
  .cme-consent, footer, .cme-privacy-noprint { display: none !important; }
  .cme-privacy-table table { min-width: 0; }
}
