/* ==========================================================================
   🏛️ Premium Thai Gov Floating Dock — chat.css
   Clean, orderly vertical dock with tooltip labels
   - Go-to-Top  : --gov-primary (Red  #D91113)
   - Messenger  : --gov-secondary (Blue #0C58A9)
   - Gold       : --gov-gold (#FFD700) — accent / active state
   ========================================================================== */

:root {
  --gov-primary:        #D91113;
  --gov-primary-dark:   #A80000;
  --gov-primary-light:  #FF3B3B;
  --gov-primary-soft:   #FFE5E8;
  --gov-secondary:      #0C58A9;
  --gov-secondary-dark: #063B7A;
  --gov-secondary-light:#2DACEF;
  --gov-gold:           #FFD700;
  --gov-gold-mid:       #F2B705;
  --gov-gold-dark:      #D89000;
  --gov-gold-soft:      #FFF7C2;
  --gov-white:          #FFFFFF;
  --gov-radius:         16px;
  --gov-gradient-red:   linear-gradient(135deg, #FF3B3B 0%, #D91113 50%, #A80000 100%);
  --gov-gradient-blue:  linear-gradient(135deg, #2DACEF 0%, #0C58A9 50%, #063B7A 100%);
  --gov-gradient-gold:  linear-gradient(135deg, #FFF3A3 0%, #FFD700 25%, #F2B705 50%, #D89000 75%, #FFF1A8 100%);
}

/* ─────────────────────────────────────────────
   Dock Container — fixed pill, bottom-right
───────────────────────────────────────────── */
.gov-floating-dock {
  position: fixed;
  right: 24px;
  bottom: 28px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  transition: bottom 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body:has(.cookiealert.show) .gov-floating-dock {
  bottom: 136px;
}

.gov-floating-dock > * {
  pointer-events: auto;
}

/* ─────────────────────────────────────────────
   Shared Dock Button Base
───────────────────────────────────────────── */
.gov-dock-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 1.15rem;
  outline: none;
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.28s ease;
  /* Tooltip via :before / :after */
}

/* ─────────────────────────────────────────────
   Tooltip label (appears to the LEFT on hover)
───────────────────────────────────────────── */
.gov-dock-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  white-space: nowrap;
  background: rgba(6, 59, 122, 0.92);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'Anuphan', sans-serif;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s;
}

/* Arrow tip */
.gov-dock-btn::after {
  content: '';
  position: absolute;
  right: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  border: 5px solid transparent;
  border-left-color: rgba(6, 59, 122, 0.92);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s;
}

.gov-dock-btn:hover::before,
.gov-dock-btn:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}

.gov-dock-btn:active {
  transform: scale(0.93) !important;
}

/* ─────────────────────────────────────────────
   🔴 Go-to-Top Button
───────────────────────────────────────────── */
.gov-btn-totop {
  background: var(--gov-gradient-red);
  color: #FFFFFF;
  box-shadow:
    0 4px 14px rgba(217, 17, 19, 0.38),
    0 1px 4px rgba(0, 0, 0, 0.10);
  /* Hidden by default until scrolled 300px */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.85);
}

.gov-btn-totop.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.gov-btn-totop:hover {
  background: linear-gradient(135deg, #A80000 0%, #D91113 100%);
  transform: translateY(-3px) scale(1.06) !important;
  box-shadow:
    0 8px 22px rgba(217, 17, 19, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.12);
}

/* ─────────────────────────────────────────────
   💙 Messenger / Contact Button
───────────────────────────────────────────── */
.gov-btn-contact {
  background: var(--gov-gradient-blue);
  color: #FFFFFF;
  box-shadow:
    0 4px 14px rgba(12, 88, 169, 0.40),
    0 1px 4px rgba(0, 0, 0, 0.10);
  animation: gov-contact-float 3.8s ease-in-out infinite;
}

.gov-btn-contact:hover {
  background: var(--gov-gradient-gold);
  color: #3A2A00;
  transform: translateY(-3px) scale(1.08) !important;
  box-shadow:
    0 10px 24px rgba(255, 215, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.10);
  animation-play-state: paused;
}

/* Gold active (popup open) */
.gov-btn-contact.active {
  background: var(--gov-gradient-gold);
  color: #3A2A00;
  box-shadow: 0 8px 22px rgba(255, 215, 0, 0.40);
  animation-play-state: paused;
}

@keyframes gov-contact-float {
  0%, 100% { transform: translateY(0);    }
  50%       { transform: translateY(-5px); }
}

/* ─────────────────────────────────────────────
   📬 FB Page Pop-up Card
───────────────────────────────────────────── */
.gov-fb-popup-card {
  position: absolute;
  bottom: 66px;     /* sits above the contact button */
  right: 0;
  width: 336px;
  background: #FFFFFF;
  border-radius: 18px;
  box-shadow:
    0 24px 56px rgba(12, 88, 169, 0.18),
    0 6px 16px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.95);
  transform-origin: bottom right;
  transition:
    opacity    0.30s cubic-bezier(0.25, 0.8, 0.25, 1),
    transform  0.30s cubic-bezier(0.25, 0.8, 0.25, 1),
    visibility 0.30s;
}

.gov-fb-popup-card.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.gov-fb-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--gov-gradient-blue);
}

.gov-fb-popup-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gov-fb-popup-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: 1.5px solid rgba(255, 215, 0, 0.40);
  color: #FFFFFF;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.gov-fb-popup-name {
  color: #FFFFFF;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.2;
  font-family: 'Anuphan', sans-serif;
}

.gov-fb-popup-status {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.80);
  font-size: 0.76rem;
  font-weight: 500;
  margin-top: 2px;
  font-family: 'Anuphan', sans-serif;
}

.gov-fb-online-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35);
  animation: gov-online-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes gov-online-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.35); }
  50%       { box-shadow: 0 0 0 5px rgba(74, 222, 128, 0.10); }
}

.gov-fb-popup-close {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.85rem;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.gov-fb-popup-close:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #FFFFFF;
  transform: scale(1.1) rotate(90deg);
}

/* Body */
.gov-fb-popup-body {
  background: #F0F2F5;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80px;
}

.gov-fb-popup-body iframe {
  display: block;
  border: none;
  overflow: hidden;
}


/* ─────────────────────────────────────────────
   📱 Responsive — Mobile
───────────────────────────────────────────── */
@media (max-width: 575px) {
  .gov-floating-dock {
    right: 16px;
    bottom: 20px;
    gap: 8px;
  }

  body:has(.cookiealert.show) .gov-floating-dock {
    bottom: 128px;
  }

  .gov-dock-btn {
    width: 46px;
    height: 46px;
    font-size: 1.05rem;
  }

  /* On mobile, hide tooltip to prevent overflow */
  .gov-dock-btn::before,
  .gov-dock-btn::after {
    display: none;
  }

  .gov-fb-popup-card {
    width: calc(100vw - 32px);
    right: -16px;
    bottom: 60px;
    border-radius: 14px;
  }
}


/* ─────────────────────────────────────────────
   🍪 Cookie Alert — ธีม Thai Gov (skill.md)
   สี: Blue footer gradient + Red top border + Gold CTA
   อ้างอิง: --gov-gradient-footer, --gov-primary, --gov-gold
───────────────────────────────────────────── */
.cookiealert {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  margin: 0;
  z-index: 10000;
  padding: 16px 32px;
  /* gov-gradient-red (skill.md) — สีหลักหน่วยงาน */
  background: linear-gradient(
    180deg,
    #FF3B3B 0%,
    #D91113 50%,
    #A80000 100%
  ) !important;
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  color: #fff !important;
  border: none !important;
  /* ขอบบนทอง — gov-gold (#FFD700) ตาม skill.md */
  border-top: 4px solid #FFD700 !important;
  display: none;
  box-shadow:
    0 -4px 24px rgba(217, 17, 19, 0.32),
    0 -1px 12px rgba(255, 215, 0, 0.18),
    0 -1px 6px rgba(0, 0, 0, 0.14) !important;
}

.cookiealert.show {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

/* ─── ไอคอน — สีทองธีม (gov-gold) ─── */
.cookie-icon {
  font-size: 2rem;
  color: #FFF3A3;
  filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.65));
  animation: cookie-spin 8s linear infinite;
  flex-shrink: 0;
}

@keyframes cookie-spin {
  0%   { transform: rotate(0deg);   }
  100% { transform: rotate(360deg); }
}

/* ─── เนื้อหาข้อความ ─── */
.cookie-content {
  flex: 1;
  max-width: 760px;
  font-size: 0.91rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.96);
}

/* หัวข้อ — ใช้ gov-gold (#FFD700) ตาม skill.md */
.cookie-content h6 {
  color: #FFF3A3 !important;
  font-weight: 800;
  margin-bottom: 4px;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* ลิงก์ — gov-gold */
.cookie-content a {
  color: #FFF3A3 !important;
  text-decoration: underline !important;
  font-weight: 700;
  transition: color 0.2s ease;
}

.cookie-content a:hover {
  color: #FFFFFF !important;
}

/* ─── ปุ่มยินยอม — btn-gov-gold (skill.md) ─── */
.btn-accept-cookie {
  background: linear-gradient(
    135deg,
    #FFF3A3 0%,
    #FFD700 25%,
    #F2B705 50%,
    #D89000 75%,
    #FFF1A8 100%
  ) !important;
  border: none !important;
  color: #3A2A00 !important;
  font-weight: 800 !important;
  padding: 10px 30px !important;
  border-radius: 999px !important;
  font-size: 0.90rem !important;
  letter-spacing: 0.3px !important;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow:
    0 4px 14px rgba(216, 144, 0, 0.42),
    0 0 0 1px rgba(255, 243, 163, 0.42),
    0 2px 4px rgba(0, 0, 0, 0.10) !important;
}

.btn-accept-cookie:hover {
  background: linear-gradient(
    135deg,
    #F2B705 0%,
    #E99500 50%,
    #B87900 100%
  ) !important;
  color: #fff !important;
  transform: translateY(-3px) scale(1.04) !important;
  box-shadow:
    0 8px 22px rgba(216, 144, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.34) !important;
}

.btn-accept-cookie:active {
  transform: translateY(0) scale(0.97) !important;
}

/* ─── Responsive Mobile ─── */
@media (max-width: 767px) {
  .cookiealert {
    padding: 14px 18px;
  }

  .cookiealert.show {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .cookie-icon {
    font-size: 1.7rem;
  }

  .cookie-content {
    font-size: 0.87rem;
  }

  .btn-accept-cookie {
    align-self: stretch;
    width: 100% !important;
    text-align: center !important;
  }
}



