/* =========================================================
   Kirley’s Tree Services — Cookie Consent UI (SI-sized)
   - Same sizing/typography as Star Import
   - Keeps KTS dark + gold colorway + footer-overlap FAB tint
   - Safe: fully scoped to #si-cc-root / .si-cc
   ========================================================= */

/* ------------------------------
   HARD SCOPE + BASE TYPE LOCK
   ------------------------------ */
#si-cc-root,
#si-cc-root *{
  box-sizing: border-box;
}

#si-cc-root.si-cc{
  position: fixed;
  right: 18px;

  /* ✅ CHANGED: JS will control where the FAB sits (above footer vs docked into footer) */
  bottom: var(--cc-root-bottom, 18px);

  /* ✅ NEW: makes it “slide” instead of jump */
  transition: bottom 220ms ease;

  z-index: 2147483647;

  /* keep everything else the same */
  font-family: var(--font-body, "Open Sans", Arial, sans-serif);
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
  text-align: left;
}

/* ------------------------------
   FAB (floating cookie button)
   ------------------------------ */
#si-cc-root .si-cc__fab{
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;

  background: transparent; /* base moved to ::after */
  color: #fff;

  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  display: grid;
  place-items: center;

  /* emoji size = SI */
  font-size: 19.2px; /* 1.2rem @ 16px */

  transition: transform 0.25s ease;
}
#si-cc-root .si-cc__fab:hover{ transform: translateY(-2px); }

/* ✅ FAB “partial overlap” gold overlay (only where it overlaps footer) */
#si-cc-root .si-cc__fab{
  position: relative;
  overflow: hidden;
  isolation: isolate;
  will-change: transform, clip-path, opacity;
  transform: translateZ(0);
}

/* Base fill (matches sticky-footer tint on KTS) */
#si-cc-root .si-cc__fab::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0,0,0,0.4); /* match sticky-footer */
  z-index: -2;
}

/* Gold overlay fill — clipped to overlap region via CSS vars */
#si-cc-root .si-cc__fab::before{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #DAA520; /* KTS gold */
  z-index: -1;

  opacity: 0;
  clip-path: inset(
    var(--cc-clip-top, 100%)
    var(--cc-clip-right, 0px)
    var(--cc-clip-bottom, 0px)
    var(--cc-clip-left, 0px)
    round 999px
  );

  transition: opacity 140ms ease, clip-path 120ms linear;
  will-change: clip-path, opacity;
}

#si-cc-root .si-cc__fab.si-cc__fab--overlap::before{
  opacity: 1;
}

/* When banner is open, hide fab */
#si-cc-root[data-open="1"] .si-cc__fab{ display: none !important; }

/* ------------------------------
   PANEL (banner)
   ------------------------------ */
#si-cc-root .si-cc__panel{
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));

  background: #333333;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--border-radius, 4px);

  box-shadow: 0 12px 32px rgba(0,0,0,0.25);

  /* ✅ SI padding height */
  padding: 20px; /* 1.25rem @ 16px */
  animation: ccFadeIn 0.3s ease;

  text-align: left;
}

/* Header */
#si-cc-root .si-cc__header{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0.5rem; /* 0.5rem */
}

#si-cc-root .si-cc__badge{
  font-size: 28px; /* SI */
  line-height: 1;
  margin-right: 8px;
  margin-bottom: 7px;
}

#si-cc-root .si-cc__title{
  font-weight: 650;
  font-size: 18.6px; /* 1.1rem @ 16px */
  line-height: 1.25;
  color: #DAA520;
  margin-top: 7px;
  margin-bottom: 10px;
}

#si-cc-root .si-cc__subtitle{
  font-size: 15.4px; /* 0.9rem @ 16px */
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.86);
  margin-bottom: 5px;
}

#si-cc-root .si-cc__close{
  border: none;
  background: transparent;
  font-size: 20px; /* 1.25rem @ 16px */
  line-height: 1;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.75);
  transition: color 0.25s ease;
  padding: 0;
  margin-top: 6px;
}
#si-cc-root .si-cc__close:hover{ color: #DAA520; }

/* Body */
#si-cc-root .si-cc__body{
  font-size: 15.8px; /* 0.95rem @ 16px */
  line-height: 1.5;
  margin-bottom: 12px; /* 0.75rem */
  color: rgba(255, 255, 255, 0.92);
  text-align: left;
}

/* ✅ normalize default element margins inside the consent body */
#si-cc-root .si-cc__body p{
  margin: 0 0 12px;
}
#si-cc-root .si-cc__body p:last-child{
  margin-bottom: 0;
}

#si-cc-root .si-cc__sectionTitle{
  font-weight: 600;
  margin-top: 8px;
  line-height: 1.35;
  color: #DAA520;
}

#si-cc-root .si-cc__list{
  margin: 4px 0 12px 20px; /* matches SI spacing feel */
  padding: 0;
  color: rgba(255, 255, 255, 0.88);
}
#si-cc-root .si-cc__list li{
  margin: 3px 0;
}

#si-cc-root .si-cc__toggle{
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.92);
  text-align: left;
}
#si-cc-root .si-cc__toggle input{
  margin-top: 3px;
}

#si-cc-root .si-cc__small{
  display: block;
  font-size: 13.6px; /* 0.85rem @ 16px */
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.70);
  font-weight: 400;
  margin-top: 2px;
}

/* Footer buttons */
#si-cc-root .si-cc__footer{
  display: flex;
  justify-content: flex-end;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px; /* 1rem */
}

/* When Save is visible, keep Decline/Accept on the left, Save on the right */
#si-cc-root #si-cc-save{ margin-left: auto; }

#si-cc-root .si-cc__btn{
  padding: 8.8px 17.6px; /* 0.55rem 1.1rem @ 16px */
  font-weight: 600;
  text-transform: uppercase;
  font-size: 12.8px; /* 0.80rem @ 16px */
  line-height: 1.1;

  border-radius: var(--border-radius, 4px);
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.25s ease;

  white-space: nowrap;
  letter-spacing: -0.2px;
}

/* Ghost (outline) */
#si-cc-root .si-cc__btn--ghost{
  background: transparent;
  border: 1px solid #DAA520;
  color: #DAA520;
}
#si-cc-root .si-cc__btn--ghost:hover{
  background: #DAA520;
  color: #111;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
}

/* Primary */
#si-cc-root .si-cc__btn--primary{
  background: #DAA520;
  border: none;
  color: #fff;
}
#si-cc-root .si-cc__btn--primary:hover{
  background: #CDA117;
  transform: translateY(-2px);
}

/* Link */
#si-cc-root .si-cc__link{
  color: #DAA520;
  font-size: 15.2px; /* 0.9rem @ 16px */
}
#si-cc-root .si-cc__link:hover{
  color: #CDA117;
  text-decoration: underline;
}

/* Fade animation */
@keyframes ccFadeIn{
  from{ opacity: 0; transform: translateY(12px); }
  to{ opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Responsive resize (same behavior as SI)
   ========================================================= */

/* 500px ↓ */
@media (max-width: 500px){
  #si-cc-root.si-cc{ right: 16px; }

  #si-cc-root .si-cc__fab{
    width: 40px;
    height: 40px;
    font-size: 17.6px; /* 1.1rem */
  }

  #si-cc-root .si-cc__panel{
    width: min(380px, calc(100vw - 28px));
    padding: 16px; /* 1rem */
  }

  #si-cc-root .si-cc__btn{
    padding: 8px 14.4px;
    font-size: 12.48px; /* 0.78rem */
  }
}

/* 401–500px — keep inline alignment for both trios */
@media (max-width: 500px) and (min-width: 401px){
  #si-cc-root .si-cc__footer{
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    gap: 5.6px;
  }

  #si-cc-root .si-cc__btn{
    padding: 7.2px 12px;
    font-size: 12px; /* 0.75rem */
    letter-spacing: -0.25px;
    flex: 0 1 auto;
  }

  /* Manage trio: Decline + Manage + Accept */
  #si-cc-root .si-cc__footer #si-cc-manageBtn:not([hidden]) ~ #si-cc-accept:not([hidden]){
    margin-left: auto;
  }

  /* Save trio: Decline + Accept + Save */
  #si-cc-root #si-cc-save:not([hidden]){
    margin-left: auto;
  }
}

/* 450px ↓ */
@media (max-width: 450px){
  #si-cc-root.si-cc{ right: 16px; }

  #si-cc-root .si-cc__fab{
    width: 38px;
    height: 38px;
    font-size: 16px; /* 1rem */
  }

  #si-cc-root .si-cc__panel{
    width: min(340px, calc(100vw - 26px));
    padding: 14.4px; /* 0.9rem */
  }

  #si-cc-root .si-cc__btn{
    font-size: 11.84px; /* 0.74rem */
    padding: 6.72px 12px;
  }
}

/* 400px ↓ — handle both trios correctly */
@media (max-width: 400px){
  #si-cc-root.si-cc{ right: 14px; }

  #si-cc-root .si-cc__fab{
    width: 36px;
    height: 36px;
    font-size: 15.2px; /* 0.95rem */
  }

  #si-cc-root .si-cc__panel{
    width: min(320px, calc(100vw - 22px));
    padding: 12.8px; /* 0.8rem */
  }

  #si-cc-root .si-cc__btn{
    font-size: 11.52px; /* 0.72rem */
    padding: 6.4px 11.2px;
  }

  #si-cc-root .si-cc__footer{
    flex-wrap: wrap;
    gap: 6.4px;
  }

  /* Manage trio: Decline + Manage + Accept → drop Accept below only if Manage is visible */
  #si-cc-root .si-cc__footer #si-cc-manageBtn:not([hidden]) ~ #si-cc-accept:not([hidden]){
    flex-basis: 100%;
    display: block;
    margin-top: 6.4px;
  }

  /* Save trio: Decline + Accept + Save → drop Save below */
  #si-cc-root .si-cc__footer #si-cc-save:not([hidden]){
    flex-basis: 100%;
    display: block;
    margin-top: 6.4px;
    margin-left: 0;
  }

  /* prevent Accept from dropping when Save is visible */
  #si-cc-root .si-cc__footer #si-cc-save:not([hidden]) ~ #si-cc-accept{
    flex-basis: auto !important;
    display: inline-block !important;
    margin-top: 0 !important;
  }
}

/* 350px ↓ */
@media (max-width: 350px){
  #si-cc-root.si-cc{ right: 14px; }

  #si-cc-root .si-cc__fab{
    width: 34px;
    height: 34px;
    font-size: 14.4px; /* 0.9rem */
  }

  #si-cc-root .si-cc__panel{
    width: min(290px, calc(100vw - 20px));
    padding: 11.2px; /* 0.7rem */
  }

  #si-cc-root .si-cc__btn{
    font-size: 11.2px; /* 0.7rem */
    padding: 5.6px 10.4px;
  }

  /* Move last visible button to new line */
  #si-cc-root .si-cc__footer .si-cc__btn:last-of-type:not([hidden]){
    flex-basis: 100%;
    display: block;
    margin-top: 6.4px;
  }
}

/* 450px ↓ (but above 400px) — ONLY for the Manage trio */
@media (max-width: 450px) and (min-width: 401px){
  #si-cc-root .si-cc__footer:has(#si-cc-manageBtn:not([hidden])){
    gap: 4.48px;
  }

  #si-cc-root .si-cc__footer:has(#si-cc-manageBtn:not([hidden])) .si-cc__btn{
    padding: 6.4px 9.92px;
    font-size: 11.52px; /* 0.72rem */
    letter-spacing: -0.3px;
  }
}