/*----------------------------------------------------------------
  BBC Industrial Services — Feature Add-ons
  ----------------------------------------------------------------
  Loaded AFTER main.css + theme.css. Provides:
    1. Back-to-top button restyle (white disc, orange progress ring,
       orange arrow — per approved reference design)
    2. Multi-language selector (header dropdown, light/dark aware)
    3. Google Translate widget cleanup (banner / tooltip removal)

  Conventions follow theme.css: bbc- prefix, design tokens with
  safe fallbacks. No existing rules are modified — only additive
  overrides scoped to the two new features.
-----------------------------------------------------------------*/

/*==================================================
  1. BACK TO TOP — reference design override
     (markup + show/hide logic reused from theme:
      .backtotop-wrap / .active-progress in main.js)
==================================================*/
.backtotop-wrap,
.backtotop-wrap.has-theme-green {
  background: var(--bbc-bg-elevated, #FFFFFF);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.16);
}

/* Faint full-circle track behind the orange progress ring */
.backtotop-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(234, 95, 35, 0.18);
  pointer-events: none;
}

/* Arrow: orange on white */
.backtotop-wrap::after {
  color: var(--rs-theme-orange, #EA5F23);
  font-weight: 600;
}

/* Progress ring: orange stroke (theme ships stroke-width: 0) */
.backtotop-wrap svg.backtotop-circle path {
  stroke: var(--rs-theme-orange, #EA5F23);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
}

/* Hover: invert — orange disc, white arrow, gentle lift */
.backtotop-wrap:hover,
.backtotop-wrap.has-theme-green:hover {
  background: var(--rs-theme-orange, #EA5F23);
  box-shadow: 0 10px 28px rgba(234, 95, 35, 0.35);
}

.backtotop-wrap:hover::after {
  color: var(--rs-white, #FFFFFF);
}

.backtotop-wrap:hover svg.backtotop-circle path {
  stroke: rgba(255, 255, 255, 0.9);
}

/* Visible state keeps the theme's fade/slide, no change needed.
   Keyboard focus ring for accessibility */
.backtotop-wrap:focus-visible {
  outline: 2px solid var(--rs-theme-orange, #EA5F23);
  outline-offset: 4px;
}

/* Dark mode */
html[data-theme="dark"] .backtotop-wrap,
html[data-theme="dark"] .backtotop-wrap.has-theme-green {
  background: var(--bbc-bg-elevated, #1D2532);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .backtotop-wrap::before {
  border-color: rgba(234, 95, 35, 0.28);
}

html[data-theme="dark"] .backtotop-wrap:hover {
  background: var(--rs-theme-orange, #EA5F23);
}

/* Small screens: slightly smaller, tighter edge spacing.
   (main.css sets 46px + fixed ::after metrics, so both are overridden) */
@media (max-width: 575px) {
  .backtotop-wrap {
    height: 42px;
    width: 42px;
    bottom: 20px;
    right: 18px;
  }

  .backtotop-wrap::after {
    height: 42px;
    width: 42px;
    line-height: 42px;
    font-size: 14px;
  }
}

/* Respect reduced-motion users */
@media (prefers-reduced-motion: reduce) {
  .backtotop-wrap,
  .backtotop-wrap::after,
  .backtotop-wrap svg.backtotop-circle path {
    transition: none !important;
  }
}

/*==================================================
  2. LANGUAGE SELECTOR (header dropdown)
==================================================*/
.bbc-lang {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Trigger — pill button styled to match .bbc-theme-toggle */
.bbc-lang-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 50px;
  border: 1px solid var(--bbc-toggle-border, rgba(0, 0, 0, 0.12));
  background: transparent;
  color: var(--bbc-toggle-color, #1F1F1F);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.35s ease, border-color 0.35s ease,
    color 0.35s ease, transform 0.2s ease;
}

.bbc-lang-btn:hover,
.bbc-lang.open .bbc-lang-btn {
  background: var(--bbc-toggle-hover-bg, rgba(234, 95, 35, 0.1));
  border-color: var(--rs-theme-orange, #EA5F23);
  color: var(--rs-theme-orange, #EA5F23);
}

.bbc-lang-btn:active {
  transform: scale(0.95);
}

.bbc-lang-btn:focus-visible {
  outline: 2px solid var(--rs-theme-orange, #EA5F23);
  outline-offset: 3px;
}

.bbc-lang-globe {
  font-size: 15px;
}

.bbc-lang-caret {
  font-size: 10px;
  transition: transform 0.3s ease;
}

.bbc-lang.open .bbc-lang-caret {
  transform: rotate(180deg);
}

/* Dropdown panel */
.bbc-lang-list {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  min-width: 190px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bbc-bg-elevated, #FFFFFF);
  border: 1px solid var(--bbc-border, rgba(0, 0, 0, 0.05));
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.14);
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.bbc-lang.open .bbc-lang-list {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.bbc-lang-list::-webkit-scrollbar {
  width: 6px;
}

.bbc-lang-list::-webkit-scrollbar-thumb {
  background: var(--bbc-border-strong, #D2D2D2);
  border-radius: 6px;
}

/* Options */
.bbc-lang-option {
  -webkit-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--bbc-text-heading, #1F1F1F);
  font-size: 14px;
  text-align: start;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.bbc-lang-option:hover,
.bbc-lang-option:focus-visible {
  background: var(--bbc-toggle-hover-bg, rgba(234, 95, 35, 0.1));
  color: var(--rs-theme-orange, #EA5F23);
  outline: none;
}

.bbc-lang-option .bbc-lang-en-name {
  font-size: 11px;
  color: var(--bbc-text-muted, rgba(97, 97, 97, 0.54));
}

.bbc-lang-option.active {
  color: var(--rs-theme-orange, #EA5F23);
  font-weight: 600;
}

.bbc-lang-option.active .bbc-lang-en-name::after {
  font-family: var(--rs-ff-fontawesome, "Font Awesome 6 Pro");
  content: "\f00c";
  margin-inline-start: 6px;
  color: var(--rs-theme-orange, #EA5F23);
}

/* Placement fine-tuning per header slot (additive, no layout change):
   – sticky header .rs-header-right: flex + gap handles spacing
   – main header slot: small gap before the theme toggle           */
.bbc-header-toggle-slot .bbc-lang {
  margin-inline-end: 0px;
}

/* Offcanvas (mobile menu) placement — after the theme toggle */
.offcanvas-top .bbc-lang {
  margin-inline-end: 15px;
}

/* Compact trigger on small screens */
@media (max-width: 767px) {
  .bbc-lang-btn {
    height: 40px;
    padding: 0 12px;
    gap: 6px;
  }
}

@media (max-width: 400px) {
  .bbc-header-toggle-slot .bbc-lang {
    margin-inline-end: 8px;
  }
}

/*==================================================
  3. GOOGLE TRANSLATE CLEANUP
     Hides Google's injected banner/tooltips so the
     site design stays pixel-identical when translated.
==================================================*/
#bbc-google-translate,
.goog-te-gadget,
#goog-gt-tt,
.goog-te-balloon-frame {
  display: none !important;
}

.goog-te-banner-frame,
iframe.skiptranslate {
  display: none !important;
  visibility: hidden !important;
}

/* Google shifts the page down for its banner — undo it */
body {
  top: 0 !important;
}

html.translated-ltr body,
html.translated-rtl body {
  position: static !important;
}

/* No highlight/tooltip flash on translated text */
.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}

.goog-tooltip,
.goog-tooltip:hover {
  display: none !important;
}

/* Translated text keeps the site's typography */
font[style] {
  font-family: inherit !important;
  background: none !important;
}
@media (min-width:2001px) and (max-width:3000px) {
  .bbc-lang-btn {
    height: 50px;
    padding: 0px 14px;
    font-size: 21px;
  }
}
@media (min-width:3001px) and (max-width:6000px) {
  .bbc-lang-btn {
    height: 50px;
    padding: 0px 14px;
    font-size: 21px;
  }
}