/* =========================================================
   SMART FARM IoT — Cookie Consent
   Desktop: full-width bottom bar while consent is pending.
   Mobile: compact floating leaf at bottom-left; tap to open.
   ========================================================= */
:root{
  --sf-cookie-bg:#06110d;
  --sf-cookie-surface:#0b1711;
  --sf-cookie-surface-2:#102019;
  --sf-cookie-text:#f4f8f4;
  --sf-cookie-muted:#a9b8ac;
  --sf-cookie-line:rgba(143,179,106,.24);
  --sf-cookie-farm:#8fb36a;
  --sf-cookie-accent:#baa274;
}

.sf-cookie-consent[data-ready="false"]{visibility:hidden;pointer-events:none}
.sf-cookie-consent{font-family:var(--font-ui,"Noto Sans Thai","Leelawadee UI","Segoe UI",Tahoma,sans-serif)}

.sf-cookie-bar{
  position:fixed;left:0;right:0;bottom:0;z-index:2147481800;
  display:none;
  background:rgba(6,17,13,.965);
  border-top:1px solid var(--sf-cookie-line);
  box-shadow:0 -18px 50px rgba(0,0,0,.38);
  -webkit-backdrop-filter:blur(16px);
  backdrop-filter:blur(16px);
}
.sf-cookie-consent[data-consent-state="pending"] .sf-cookie-bar{display:block}
.sf-cookie-bar__inner{
  width:min(1440px,calc(100% - 48px));margin:0 auto;
  min-height:86px;padding:14px 0;
  display:grid;grid-template-columns:48px minmax(0,1fr) auto;gap:18px;align-items:center;
}
.sf-cookie-bar__brand{
  width:46px;height:46px;border-radius:14px;display:grid;place-items:center;
  background:linear-gradient(145deg,rgba(143,179,106,.16),rgba(186,162,116,.08));
  border:1px solid rgba(143,179,106,.22);
}
.sf-cookie-bar__brand img{width:27px;height:27px;display:block}
.sf-cookie-bar__copy{min-width:0}
.sf-cookie-bar__copy strong{display:block;color:var(--sf-cookie-text);font-size:.98rem;font-weight:700;line-height:1.45;margin-bottom:2px}
.sf-cookie-bar__copy p{margin:0;color:#c5d2c7;font-size:.84rem;line-height:1.65}
.sf-cookie-bar__copy a,.sf-cookie-panel__legal a{color:#b7d58f;text-decoration:underline;text-underline-offset:3px}
.sf-cookie-bar__copy a:hover,.sf-cookie-panel__legal a:hover{color:#d7e8bf}
.sf-cookie-bar__actions{display:flex;gap:8px;align-items:center;justify-content:flex-end;flex-wrap:wrap}

.sf-cookie-btn{
  min-height:42px;border-radius:10px;padding:9px 15px;border:1px solid transparent;
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  font:inherit;font-size:.84rem;font-weight:650;line-height:1.2;cursor:pointer;
  transition:transform .18s ease,border-color .18s ease,background .18s ease,color .18s ease;
}
.sf-cookie-btn:hover{transform:translateY(-1px)}
.sf-cookie-btn:focus-visible,.sf-cookie-launcher:focus-visible,.sf-cookie-panel__close:focus-visible,.sf-cookie-footer-link:focus-visible{
  outline:3px solid rgba(183,213,143,.38);outline-offset:2px;
}
.sf-cookie-btn--primary{background:var(--sf-cookie-farm);border-color:var(--sf-cookie-farm);color:#07100b}
.sf-cookie-btn--primary:hover{background:#a1c47a;border-color:#a1c47a}
.sf-cookie-btn--secondary{background:rgba(143,179,106,.08);border-color:rgba(143,179,106,.34);color:#e7f1e8}
.sf-cookie-btn--secondary:hover{background:rgba(143,179,106,.14)}
.sf-cookie-btn--ghost{background:transparent;border-color:rgba(255,255,255,.14);color:#c6d2c8}
.sf-cookie-btn--ghost:hover{border-color:rgba(255,255,255,.26);color:#fff}

.sf-cookie-launcher{
  position:fixed;z-index:2147481900;
  left:calc(12px + env(safe-area-inset-left));
  bottom:calc(12px + env(safe-area-inset-bottom));
  width:48px;height:48px;padding:0;border-radius:50%;
  border:1px solid rgba(143,179,106,.36);
  background:rgba(6,17,13,.94);box-shadow:0 10px 30px rgba(0,0,0,.42);
  display:none;align-items:center;justify-content:center;cursor:pointer;
  -webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);
}
.sf-cookie-launcher__icon{width:29px;height:29px;border-radius:50%;display:grid;place-items:center;background:rgba(143,179,106,.08)}
.sf-cookie-launcher__icon img{width:24px;height:24px;display:block}
.sf-cookie-launcher__dot{
  position:absolute;right:0;top:1px;width:10px;height:10px;border-radius:50%;
  background:var(--sf-cookie-accent);border:2px solid var(--sf-cookie-bg);display:none;
}
.sf-cookie-consent[data-consent-state="pending"] .sf-cookie-launcher__dot{display:block;animation:sfCookiePulse 1.8s ease-in-out infinite}
@keyframes sfCookiePulse{0%,100%{box-shadow:0 0 0 0 rgba(186,162,116,.4)}50%{box-shadow:0 0 0 7px rgba(186,162,116,0)}}

.sf-cookie-backdrop{
  position:fixed;inset:0;z-index:2147481950;
  background:rgba(0,0,0,.58);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);
}
.sf-cookie-panel{
  position:fixed;z-index:2147482000;left:50%;bottom:24px;transform:translateX(-50%);
  width:min(590px,calc(100% - 40px));max-height:min(78vh,720px);overflow:auto;
  color:var(--sf-cookie-text);background:linear-gradient(180deg,#0b1811 0%,#07110c 100%);
  border:1px solid rgba(143,179,106,.25);border-radius:20px;
  box-shadow:0 28px 90px rgba(0,0,0,.62);padding:22px;
  overscroll-behavior:contain;
}
.sf-cookie-panel__head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin-bottom:12px}
.sf-cookie-panel__kicker{display:block;color:var(--sf-cookie-farm);font-size:.7rem;font-weight:700;letter-spacing:.14em;text-transform:uppercase;margin-bottom:2px}
.sf-cookie-panel h2{margin:0;color:#fff;font-size:1.35rem;line-height:1.35;font-weight:700}
.sf-cookie-panel__close{width:40px;height:40px;border-radius:50%;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.04);color:#dce6de;font-size:1.5rem;line-height:1;cursor:pointer;flex:0 0 auto}
.sf-cookie-panel__intro{margin:0 0 16px;color:var(--sf-cookie-muted);font-size:.87rem;line-height:1.75}
.sf-cookie-option{
  display:flex;align-items:center;justify-content:space-between;gap:18px;
  padding:15px 0;border-top:1px solid rgba(255,255,255,.08);cursor:pointer;
}
.sf-cookie-option__copy{display:block;min-width:0}
.sf-cookie-option__copy strong{display:block;color:#f2f7f3;font-size:.92rem;font-weight:650;margin-bottom:3px}
.sf-cookie-option__copy span{display:block;color:#9fb0a3;font-size:.79rem;line-height:1.6}
.sf-cookie-always{flex:0 0 auto;color:#b7d58f;font-size:.75rem;font-weight:650;border:1px solid rgba(143,179,106,.25);background:rgba(143,179,106,.08);padding:5px 9px;border-radius:999px}
.sf-cookie-switch{position:relative;display:inline-flex;width:46px;height:26px;flex:0 0 auto}
.sf-cookie-switch input{position:absolute;opacity:0;pointer-events:none}
.sf-cookie-switch span{position:absolute;inset:0;border-radius:999px;background:#29332d;border:1px solid rgba(255,255,255,.09);transition:.2s ease}
.sf-cookie-switch span::after{content:"";position:absolute;width:20px;height:20px;left:2px;top:2px;border-radius:50%;background:#d9e1db;box-shadow:0 2px 7px rgba(0,0,0,.3);transition:.2s ease}
.sf-cookie-switch input:checked + span{background:var(--sf-cookie-farm);border-color:var(--sf-cookie-farm)}
.sf-cookie-switch input:checked + span::after{transform:translateX(20px);background:#07100b}
.sf-cookie-switch input:focus-visible + span{outline:3px solid rgba(183,213,143,.32);outline-offset:2px}
.sf-cookie-panel__legal{padding-top:13px;border-top:1px solid rgba(255,255,255,.08);font-size:.8rem}
.sf-cookie-panel__actions{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px;margin-top:18px}
.sf-cookie-footer-link{padding:0;border:0;background:none;color:#a2b4a5;font:inherit;font-size:inherit;cursor:pointer;text-decoration:underline;text-decoration-color:rgba(143,179,106,.35);text-underline-offset:3px}
.sf-cookie-footer-link:hover{color:#d9e5db}

/* Keep consent controls out of the 3D pseudo-fullscreen interaction layer. */
html.viewer-fullscreen-lock .sf-cookie-consent,
body.viewer-fullscreen-lock .sf-cookie-consent{display:none!important}

/* Policy page */
.cookie-policy-main{padding:150px 0 90px;background:#050b07;min-height:70vh}
.cookie-policy-card{max-width:920px;margin:0 auto;background:#0b130e;border:1px solid #243529;border-radius:20px;padding:34px;box-shadow:0 20px 60px rgba(0,0,0,.24)}
.cookie-policy-card h1{margin:0 0 8px;font-size:clamp(1.8rem,4vw,2.7rem);line-height:1.25;color:#f2f5f2}
.cookie-policy-card .cookie-policy-lead{margin:0 0 28px;color:#abb8ad;line-height:1.8}
.cookie-policy-card h2{font-size:1.13rem;color:#dfe9e1;margin:28px 0 8px}
.cookie-policy-card p,.cookie-policy-card li{color:#b4c0b6;line-height:1.85;font-size:.94rem}
.cookie-policy-card ul{padding-left:1.3rem}
.cookie-policy-meta{display:inline-flex;align-items:center;gap:8px;color:#8fb36a;font-size:.78rem;font-weight:650;letter-spacing:.03em;margin-bottom:10px}
.cookie-policy-action{margin-top:28px;padding-top:20px;border-top:1px solid #243529;display:flex;gap:10px;flex-wrap:wrap}

@media (max-width:980px) and (min-width:769px){
  .sf-cookie-bar__inner{grid-template-columns:40px minmax(0,1fr);gap:12px 14px;padding:13px 0}
  .sf-cookie-bar__brand{width:40px;height:40px;border-radius:12px}
  .sf-cookie-bar__actions{grid-column:2;justify-content:flex-start}
}

@media (max-width:768px){
  .sf-cookie-bar{display:none!important}
  .sf-cookie-launcher{display:flex}
  .sf-cookie-panel{
    left:0;right:0;bottom:0;transform:none;width:100%;max-height:min(82dvh,720px);
    border-left:0;border-right:0;border-bottom:0;border-radius:20px 20px 0 0;
    padding:20px 18px calc(18px + env(safe-area-inset-bottom));
  }
  .sf-cookie-panel__actions{grid-template-columns:1fr}
  .sf-cookie-panel__actions .sf-cookie-btn--primary{order:-1}
  .sf-cookie-option{gap:12px}
  .cookie-policy-main{padding:116px 0 64px}
  .cookie-policy-card{padding:24px 20px;border-radius:16px}
}

@media (prefers-reduced-motion:reduce){
  .sf-cookie-launcher__dot{animation:none!important}
  .sf-cookie-btn,.sf-cookie-switch span,.sf-cookie-switch span::after{transition:none!important}
}
