/* =========================================================
   Site-wide UI helpers: skip link, scroll progress, back to top,
   cookie banner, copy buttons, form states, hover/focus states.
   ========================================================= */

/* ---------- Skip to content ---------- */
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10001;
  padding: 10px 18px;
  background: #1a2b4c;
  color: #fff;
  font-weight: 700;
  border-radius: 6px;
  transform: translateY(-150%);
  transition: transform .2s ease;
}
.skip-link:focus {
  transform: translateY(0);
  color: #fff;
  outline: 3px solid #4285F4;
  outline-offset: 2px;
}
#main-content:focus { outline: none; }

/* ---------- Scroll progress bar ---------- */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  z-index: 10000;
  background: linear-gradient(90deg, #045c83, #4285F4);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}

/* ---------- Back to top ---------- */
#back-to-top {
  position: fixed;
  right: 32px;
  bottom: 100px; /* sits above the WhatsApp button */
  z-index: 9997;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: #1a2b4c;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, background .2s ease;
}
#back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
#back-to-top:hover { background: #045c83; }
@media (max-width: 767.98px) {
  #back-to-top { right: 19px; bottom: 84px; }
}

/* ---------- Cookie banner ---------- */
#cookie-banner {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9999;
  max-width: 380px;
  background: #fff;
  color: #333;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
  padding: 18px 20px;
  font-size: 14px;
  line-height: 1.5;
}
#cookie-banner[hidden] { display: none; }
#cookie-banner p { margin: 0 0 12px; color: #333; }
#cookie-banner .cookie-actions { display: flex; gap: 8px; }
#cookie-banner button {
  flex: 1;
  border: 1px solid #045c83;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, color .2s ease;
}
#cookie-banner .cookie-accept { background: #045c83; color: #fff; }
#cookie-banner .cookie-accept:hover { background: #1a2b4c; border-color: #1a2b4c; }
#cookie-banner .cookie-reject { background: #fff; color: #045c83; }
#cookie-banner .cookie-reject:hover { background: #eef4fb; }
@media (max-width: 575.98px) {
  /* Full width on phones, leaving room for the WhatsApp button */
  #cookie-banner { left: 12px; right: 12px; bottom: 84px; max-width: none; }
}

/* ---------- Copy button ---------- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  color: #045c83;
  background: #eef4fb;
  border: 1px solid #cfe0f3;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  transition: background .2s ease, color .2s ease;
}
.copy-btn:hover { background: #045c83; color: #fff; }
.copy-btn.is-copied { background: #28a745; border-color: #28a745; color: #fff; }
.code-copy-wrap { position: relative; }
.code-copy-wrap .copy-btn { position: absolute; top: 8px; right: 8px; margin: 0; }

/* ---------- Form states ---------- */
.form-control.is-invalid,
.reference-style-form .form-control.is-invalid {
  border: 1px solid #dc3545 !important;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, .15) !important;
}
form .error {
  display: block;
  font-size: 13px;
  margin-top: 4px;
  color: #dc3545 !important;
}
.form-alert {
  display: none;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
}
.form-alert.is-error { display: block; background: #fdecea; color: #b3261e; border: 1px solid #f5c6c3; }
.form-alert.is-success { display: block; background: #e8f5ec; color: #1e7a3a; border: 1px solid #b9e0c5; }
button.is-loading { opacity: .75; cursor: progress; }
button.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* ---------- Site search ---------- */
.site-menu .nav-search-link svg { vertical-align: -2px; }
.search-page-form { display: flex; gap: 8px; max-width: 640px; margin: 0 auto; }
.search-page-form input { flex: 1; height: 50px; }
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { padding: 20px 0; border-bottom: 1px solid #eee; }
.search-results h3 { font-size: 20px; margin-bottom: 4px; }
.search-results .result-type {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #045c83;
  margin-bottom: 4px;
}
.search-results p { margin: 0; color: #555; }

/* ---------- Hover & keyboard focus states ---------- */
a, .btn, button { transition: color .2s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease; }
.site-footer .links a:hover { color: #fff; text-decoration: underline; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.untree_co-section .service:hover { box-shadow: 0 10px 30px rgba(0, 0, 0, .08); }
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #4285F4;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  #whatsapp-float { animation: none; }
  .btn:hover { transform: none; }
  html { scroll-behavior: auto !important; }
}
