/* ═══════════════════════════════════════════════
   FLY TECH Cookie Consent
   CI: #00A987 | Dark Navy Theme
   ═══════════════════════════════════════════════ */

:root {
  --cc-brand:        #00A987;
  --cc-brand-dark:   #007E66;
  --cc-brand-deeper: #005E4C;
  --cc-brand-soft:   #DFF7F1;
  --cc-brand-glow:   rgba(0, 169, 135, 0.35);
  --cc-bg:           rgba(10, 20, 18, 0.97);
  --cc-surface:      rgba(12, 20, 28, 0.98);
  --cc-text:         #f1f5f9;
  --cc-text-muted:   #94a3b8;
  --cc-border:       rgba(148, 163, 184, 0.15);
  --cc-shadow:       0 -8px 40px rgba(0,0,0,.50), 0 -1px 4px rgba(0,0,0,.3);
  --cc-shadow-modal: 0 28px 90px rgba(0,0,0,.70);
  --cc-radius:       18px;
  --cc-z:            100000;
  --cc-ease:         .28s cubic-bezier(.4,0,.2,1);
  --cc-font:         'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* ─── Banner ─── */
#cc-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: var(--cc-z);
  font-family: var(--cc-font);

  /* CI Green — เขียวเหมือน CTA Band */
  background: linear-gradient(135deg, rgba(0,169,135,.92), rgba(0,94,76,.92));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -4px 24px rgba(0,0,0,.28);

  transform: translateY(100%);
  opacity: 0;
  transition: transform var(--cc-ease), opacity var(--cc-ease);
  will-change: transform;
}
#cc-banner.cc-visible  { transform: translateY(0); opacity: 1; }
#cc-banner.cc-hiding   { transform: translateY(100%); opacity: 0; }

/* ซ่อนไอคอนคุกกี้ */
.cc-banner-icon { display: none; }

.cc-svg-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cc-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.cc-banner-text { flex: 1; min-width: 200px; }

.cc-banner-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 4px;
}

.cc-banner-desc {
  font-size: 13px;
  color: rgba(255,255,255,.82);
  margin: 0;
  line-height: 1.55;
}

.cc-link {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
  opacity: .9;
  transition: opacity .15s;
}
.cc-link:hover { opacity: 1; }

.cc-banner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ─── Shared button ─── */
.cc-btn {
  font-family: var(--cc-font);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--cc-ease), border-color var(--cc-ease), transform .12s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1.4;
}
.cc-btn:active { transform: scale(0.97); }
.cc-btn:focus-visible { outline: 2px solid var(--cc-brand); outline-offset: 2px; }

/* CI Green — "ยอมรับทั้งหมด" พื้นขาว ตัวเขียวเข้ม (เหมือน btn-contact--primary) */
.cc-btn-primary {
  background: #ffffff;
  color: var(--cc-brand-deeper);
  border-color: rgba(255,255,255,.85);
  box-shadow: none;
}
.cc-btn-primary:hover { transform: translateY(-1px); background: #f0fdf9; }

/* Ghost — ปุ่ม "ปฏิเสธ" บนพื้นเขียว */
.cc-btn-secondary {
  background: rgba(0,0,0,.12);
  color: #ffffff;
  border-color: rgba(255,255,255,.45);
  backdrop-filter: blur(4px);
}
.cc-btn-secondary:hover { background: rgba(0,0,0,.22); border-color: rgba(255,255,255,.60); }

/* Outline — ปุ่ม "ตั้งค่า" บนพื้นเขียว */
.cc-btn-outline {
  background: rgba(0,0,0,.12);
  color: #ffffff;
  border-color: rgba(255,255,255,.45);
}
.cc-btn-outline:hover { background: rgba(0,0,0,.22); border-color: rgba(255,255,255,.60); }

/* Modal: คืน style เดิมสำหรับปุ่มใน modal (พื้นมืด) */
.cc-modal .cc-btn-primary {
  background: linear-gradient(135deg, var(--cc-brand), var(--cc-brand-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 18px 42px var(--cc-brand-glow);
}
.cc-modal .cc-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 22px 55px rgba(0,169,135,.45); }

.cc-modal .cc-btn-secondary {
  background: rgba(255,255,255,.05);
  color: var(--cc-text);
  border-color: rgba(148,163,184,.28);
}
.cc-modal .cc-btn-secondary:hover { background: rgba(255,255,255,.09); }

.cc-modal .cc-btn-outline {
  background: transparent;
  color: var(--cc-text-muted);
  border-color: rgba(148,163,184,.22);
}
.cc-modal .cc-btn-outline:hover { color: var(--cc-text); background: rgba(255,255,255,.04); }

/* ─── Modal Overlay ─── */
#cc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: calc(var(--cc-z) + 1);
  background: rgba(2, 8, 12, 0.80);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--cc-ease);
}
#cc-modal-overlay.cc-visible { opacity: 1; pointer-events: all; }

/* ─── Modal ─── */
.cc-modal {
  background:
    radial-gradient(900px 520px at 55% 10%, rgba(0,169,135,.10), transparent 58%),
    var(--cc-surface);
  border-radius: var(--cc-radius);
  border: 1px solid var(--cc-border);
  box-shadow: var(--cc-shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  font-family: var(--cc-font);
  color: var(--cc-text);
  transform: translateY(16px) scale(0.98);
  transition: transform var(--cc-ease);
  overflow: hidden;
}
#cc-modal-overlay.cc-visible .cc-modal { transform: translateY(0) scale(1); }

/* Header */
.cc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--cc-border);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(0,169,135,.06), transparent);
}

.cc-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--cc-text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cc-modal-title::before { content: none; }

.cc-modal-close {
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,.18);
  background: rgba(255,255,255,.04);
  color: var(--cc-text-muted);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--cc-ease), color var(--cc-ease);
}
.cc-modal-close:hover { background: rgba(255,255,255,.08); color: var(--cc-text); }

/* Body */
.cc-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,169,135,.3) transparent;
}
.cc-modal-body::-webkit-scrollbar { width: 4px; }
.cc-modal-body::-webkit-scrollbar-track { background: transparent; }
.cc-modal-body::-webkit-scrollbar-thumb { background: rgba(0,169,135,.3); border-radius: 999px; }

.cc-modal-intro {
  font-size: 13px;
  color: var(--cc-text-muted);
  line-height: 1.65;
  margin: 0 0 18px;
}

/* ─── Categories ─── */
.cc-categories { display: flex; flex-direction: column; gap: 10px; }

.cc-category {
  border: 1px solid var(--cc-border);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color var(--cc-ease);
}
.cc-category:has(input:checked) { border-color: rgba(0,169,135,.35); }

.cc-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,.02);
}

.cc-category-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }

.cc-category-label { font-size: 14px; font-weight: 700; color: var(--cc-text); }

.cc-category-desc { font-size: 12px; color: var(--cc-text-muted); line-height: 1.5; }

/* ─── Toggle Switch ─── */
.cc-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  cursor: pointer;
}
.cc-switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.cc-slider {
  position: relative;
  display: inline-block;
  width: 44px; height: 24px;
  background: rgba(148,163,184,.2);
  border: 1px solid rgba(148,163,184,.18);
  border-radius: 12px;
  transition: background var(--cc-ease), box-shadow var(--cc-ease);
  flex-shrink: 0;
}
.cc-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--cc-ease), box-shadow var(--cc-ease);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.cc-switch input:checked + .cc-slider {
  background: linear-gradient(135deg, var(--cc-brand), var(--cc-brand-dark));
  border-color: transparent;
  box-shadow: 0 0 12px rgba(0,169,135,.3);
}
.cc-switch input:checked + .cc-slider::before { transform: translateX(20px); }
.cc-switch input:focus-visible + .cc-slider { outline: 2px solid var(--cc-brand); outline-offset: 2px; }

.cc-switch-disabled { opacity: 0.75; cursor: not-allowed; }
.cc-switch-disabled .cc-slider {
  background: linear-gradient(135deg, var(--cc-brand), var(--cc-brand-dark)) !important;
  cursor: not-allowed;
}

.cc-required-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--cc-brand);
  background: rgba(0,169,135,.12);
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .3px;
  border: 1px solid rgba(0,169,135,.25);
}

/* ─── Modal Footer ─── */
.cc-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--cc-border);
  flex-shrink: 0;
  flex-wrap: wrap;
  background: linear-gradient(0deg, rgba(0,169,135,.04), transparent);
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  .cc-banner-inner { padding: 14px 18px; gap: 14px; }
  .cc-banner-actions { width: 100%; justify-content: flex-end; }

  .cc-modal {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    max-width: 100%;
    transform: translateY(24px);
  }
  #cc-modal-overlay { align-items: flex-end; padding: 0; }
  .cc-modal-footer { flex-direction: column-reverse; }
  .cc-modal-footer .cc-btn { width: 100%; text-align: center; padding: 14px; }
}

/* =========================================================
   เป้าสัมผัสให้ครบ 44x44px (3 ก.ย. 2026)
   เกณฑ์ WCAG 2.5.5 (AAA) และคู่มือ iOS/Android
   วัดจริงที่จอ 320px แล้วพบว่ามี 11 จาก 17 จุดที่ยังไม่ผ่าน
   ========================================================= */

/* ── ลิงก์ในข้อความแบนเนอร์ — เดิมสูงแค่ 20px ─────────────
   ตั้ง min-height ไว้แล้วแต่ไม่มีผล เพราะเป็น inline element
   ใส่ padding แนวตั้งแทน: กับ inline element มันขยาย "พื้นที่กด"
   ให้ครบ 44px โดยไม่ดันความสูงของบรรทัดข้อความรอบ ๆ */
.cc-link {
  padding: 12px 0;
}

/* ── ปุ่มปิดหน้าต่างตั้งค่า — เดิม 32x32 ─────────────────── */
.cc-modal-close {
  width: 44px;
  height: 44px;
}

/* ── สวิตช์เปิด/ปิดหมวดคุกกี้ — เดิมสูง 24px ───────────────
   ใส่ padding แนวตั้งให้พื้นที่กดสูงครบ 44px ตัวสวิตช์ยังเห็นเป็น 44x24 เท่าเดิม
   ไม่ทำให้หน้าต่างสูงขึ้นเลย เพราะแต่ละแถว (.cc-category-header) สูง 72-108px
   อยู่แล้วตามความสูงของข้อความอธิบาย สวิตช์จึงไม่ใช่ตัวกำหนดความสูงของแถว
   (ลองใช้ pseudo-element ซ้อนทับก่อน แต่พื้นที่ 44px มันล้นไปทับแถวข้างเคียง
    แล้วโดนแถวถัดไปบังการกด) */
.cc-switch {
  padding: 10px 0;
}

/* ── ป้าย "จำเป็น" เดิม 10px เล็กกว่าเกณฑ์อ่านง่าย 12px ──── */
.cc-required-badge {
  font-size: 12px;
}

/* ── ปุ่มในแบนเนอร์ — ต้องสูง 44px ด้วยตัวเอง ────────────────
   เดิมไม่มี min-height เลย ความสูงมาจาก padding 9px + line-height ของ
   ตัวอักษรที่สืบทอดมา ผลคือบนหน้าที่โหลด style.pc/mobile.css ได้ 44px พอดี
   แต่บนหน้าที่ใช้ CSS ชุดอื่น (flytech/, price-calculator/) เหลือแค่ 38.2px
   — ไลบรารีต้องยืนได้เองไม่ว่าไปฝังหน้าไหน จึงกำหนดตรง ๆ ที่นี่
   ใช้ inline-flex เพื่อให้ข้อความอยู่กึ่งกลางแนวตั้งเมื่อ min-height ดันความสูง
   (.cc-modal-footer .cc-btn สูง 48px อยู่แล้ว กฎนี้จึงไม่กระทบ) — 3 ก.ย. 2026 */
.cc-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   แบนเนอร์คุกกี้บนมือถือ: จัดเรียงปุ่มใหม่ (7 ก.ย. 2026)

   ของเดิม @media (max-width: 600px) ตั้ง
     .cc-banner-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap }
   ปุ่มสามอันเป็น white-space: nowrap และกว้างไม่เท่ากัน
   ที่จอ 320-393px ใส่เรียงกันไม่พอ → "ยอมรับทั้งหมด" ตกไปบรรทัดที่สอง
   ได้เป็น 2+1 ชิดขวา ขนาดปุ่มไม่เท่ากัน ดูเป็นบันไดไม่เป็นระเบียบ

   จัดใหม่เป็นกริดตายตัว ไม่ปล่อยให้ flex-wrap เดาเอง:
     [ ตั้งค่า ] [ ปฏิเสธ ]   ← สองคอลัมน์เท่ากัน
     [  ยอมรับทั้งหมด  ]      ← เต็มความกว้าง อยู่ล่างสุดใกล้นิ้วโป้ง
   ========================================================= */
@media (max-width: 600px) {
  .cc-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }

  .cc-banner-text {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .cc-banner-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    justify-content: stretch;   /* ทับ flex-end ของบล็อกเดิม */
  }

  .cc-banner-actions .cc-btn {
    width: 100%;
    padding-inline: 10px;       /* เดิม 20px — จอ 320px ปุ่มจะเบียดกัน */
  }

  /* ปุ่มหลักกินเต็มแถวล่าง (อยู่ท้ายสุดใน DOM อยู่แล้ว) */
  #cc-btn-accept {
    grid-column: 1 / -1;
  }
}
