/* ========== Base Theme Vars ========== */
:root{
  --dt-primary:#0a84ff;
  --dt-primary-contrast:#fff;
  --dt-bg:#ffffff;
  --dt-fg:#111111;
  --dt-chip-bg:transparent;
  --dt-border:rgba(0,0,0,.12);
  --dt-hover-bg:rgba(0,0,0,.06);
  --dt-hover-border:rgba(0,0,0,.18);
  --dt-shadow:0 2px 10px rgba(0,0,0,.08);
  --dt-fab-bg:#111111;
  --dt-fab-fg:#ffffff;
}

@media (prefers-color-scheme: dark){
  :root{
    --dt-bg:#0f1115;
    --dt-fg:#e8eaed;
    --dt-chip-bg:transparent;
    --dt-border:rgba(255,255,255,.14);
    --dt-hover-bg:rgba(255,255,255,.09);
    --dt-hover-border:rgba(255,255,255,.22);
    --dt-shadow:0 2px 10px rgba(0,0,0,.5);
    --dt-fab-bg:#1b1e24;
    --dt-fab-fg:#e8eaed;
  }
}

/* ========== Namespace safety ========== */
.dt-lang-shortcode,
.dt-lang-shortcode *,
.dt-lang-dd-wrap,
.dt-lang-dd-wrap *,
.dt-lang-widget,
.dt-lang-widget *,
.dt-floating-switcher,
.dt-floating-switcher *,
#dt-translator-bar,
#dt-translator-bar *{
  box-sizing:border-box;
}

/* ========== Inline Picker / Editor Assist ========== */
.dt-hover{
  outline:1px dashed rgba(0,0,0,.35);
  cursor:crosshair;
}

body.dt-edit-mode{
  padding-bottom:56px;
}

body.dt-edit-mode :is(
  a,
  button,
  [role="button"],
  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  span,
  li,
  strong,
  em,
  label,
  input,
  textarea,
  .uagb-heading-text,
  figcaption,
  .wp-caption-text,
  [class*="caption"]
){
  outline:1px dashed rgba(0,0,0,.2);
  cursor:crosshair;
}

/* ========== Bottom helper bar (optional) ========== */
#dt-translator-bar{
  position:fixed;
  left:0;
  right:0;
  bottom:0;
  z-index:99997;
  background:#222;
  color:#fff;
  padding:10px 12px;
  font-size:13px;
}

#dt-translator-bar .sep{
  opacity:.55;
  margin:0 8px;
}

#dt-translator-bar .dt-lang-btn{
  display:inline-block;
  margin-right:8px;
  padding:4px 10px;
  border-radius:8px;
  background:#444;
  color:#fff;
  text-decoration:none;
  transition:filter .15s;
}

#dt-translator-bar .dt-lang-btn:hover{
  filter:brightness(1.1);
}

#dt-translator-bar .dt-lang-btn.active{
  background:var(--dt-primary);
  color:var(--dt-primary-contrast);
}

#dt-translator-bar .dt-edit-toggle{
  margin-left:12px;
  border:0;
  border-radius:10px;
  padding:6px 10px;
  cursor:pointer;
  background:var(--dt-primary);
  color:var(--dt-primary-contrast);
  transition:filter .15s;
}

#dt-translator-bar .dt-edit-toggle:hover{
  filter:brightness(1.05);
}

/* ========== Shortcode Switcher ========== */
.dt-lang-shortcode{
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  align-items:center;
  --dt-sw-accent:#2563eb;
  --dt-sw-text:#111;
  --dt-sw-hover-bg:var(--dt-hover-bg, rgba(0,0,0,.06));
  --dt-sw-hover-text:#111;
  --dt-sw-active-text:#fff;
  --dt-sw-stroke:var(--dt-border, rgba(0,0,0,.12));
  --dt-sw-case:none;
}

.dt-lang-shortcode[data-align="center"]{
  justify-content:center;
}

.dt-lang-shortcode[data-align="right"]{
  justify-content:flex-end;
}

.dt-lang{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.35rem .6rem;
  border:1px solid var(--dt-sw-stroke);
  border-radius:9999px;
  background:transparent;
  color:var(--dt-sw-text);
  text-decoration:none;
  line-height:1;
  transition:
    background-color .15s ease,
    color .15s ease,
    transform .15s ease,
    box-shadow .15s ease,
    border-color .15s ease;
}

.dt-lang-shortcode[data-radius="rounded"] .dt-lang{
  border-radius:.6rem;
}

.dt-lang-shortcode[data-size="sm"] .dt-lang{
  padding:.25rem .5rem;
  font-size:.825rem;
}

.dt-lang-shortcode[data-size="md"] .dt-lang{
  padding:.35rem .6rem;
  font-size:.9rem;
}

.dt-lang-shortcode[data-size="lg"] .dt-lang{
  padding:.5rem .8rem;
  font-size:1rem;
}

.dt-lang .dt-flag,
.dt-lang-dd__btn .dt-flag,
.dt-lang-dd__item .dt-flag{
  display:block;
  height:1rem;
  width:auto;
  object-fit:cover;
}

.dt-lang-shortcode[data-flag-shape="round"] .dt-flag{
  border-radius:9999px;
}

.dt-lang-shortcode[data-flag-shape="rounded"] .dt-flag{
  border-radius:.25rem;
}

.dt-lang:hover{
  background:var(--dt-sw-hover-bg);
  color:var(--dt-sw-hover-text);
  border-color:var(--dt-sw-hover-bg);
}

.dt-lang:focus-visible{
  outline:2px solid var(--dt-sw-accent);
  outline-offset:2px;
}

.dt-lang-shortcode[data-hover-raise="1"] .dt-lang:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 14px rgba(0,0,0,.12);
}

.dt-lang.active,
.dt-lang[aria-current="true"]{
  background:var(--dt-sw-accent);
  color:var(--dt-sw-active-text);
  border-color:var(--dt-sw-accent);
}

.dt-lang-shortcode[data-underline="always"] .dt-lang{
  text-decoration:underline;
}

.dt-lang-shortcode[data-underline="hover"] .dt-lang:hover{
  text-decoration:underline;
}

.dt-lang__label{
  line-height:1;
  text-transform:var(--dt-sw-case, none);
}

/* ========== Dropdown Switcher (shortcode mode) ========== */
.dt-lang-dd-wrap{
  display:inline-block;
}

.dt-lang-dd{
  position:relative;
  display:inline-block;
}

.dt-lang-dd__btn{
  list-style:none;
  cursor:pointer;
  user-select:none;
  display:inline-flex;
  align-items:center;
  gap:.45rem;
  padding:.35rem .6rem;
  border:1px solid var(--dt-sw-accent);
  border-radius:999px;
  color:var(--dt-sw-text);
  background:var(--dt-bg);
}

.dt-lang-dd__btn::-webkit-details-marker{
  display:none;
}

.dt-lang-dd__btn:focus-visible{
  outline:2px solid var(--dt-sw-accent);
  outline-offset:2px;
}

.dt-lang-dd__chev{
  font-size:.85em;
  opacity:.8;
}

.dt-lang-dd__menu{
  position:absolute;
  top:calc(100% + .5rem);
  min-width:180px;
  background:var(--dt-bg);
  color:var(--dt-fg);
  border:1px solid var(--dt-border);
  border-radius:14px;
  padding:.35rem;
  box-shadow:0 10px 30px rgba(0,0,0,.12);
  z-index:9999;
}

.dt-lang-dd__item{
  display:flex;
  align-items:center;
  gap:.5rem;
  padding:.5rem .55rem;
  border-radius:10px;
  text-decoration:none;
  color:var(--dt-fg);
}

.dt-lang-dd__item:hover{
  background:var(--dt-sw-hover-bg);
  color:var(--dt-sw-hover-text);
}

.dt-lang-dd__item:focus-visible{
  outline:2px solid var(--dt-sw-accent);
  outline-offset:2px;
}

.dt-lang-dd__item.active{
  font-weight:600;
}

/* ========== Floating Switcher (Apple-like dropdown) ========== */
.dt-floating-switcher{
  position:fixed;
  z-index:99998;
  bottom:var(--dt-float-bottom,20px);
}

.dt-floating-switcher--right{
  right:var(--dt-float-side,20px);
}

.dt-floating-switcher--left{
  left:var(--dt-float-side,20px);
}

.dt-floating-switcher__trigger{
  appearance:none;
  border:1px solid var(--dt-float-border,rgba(255,255,255,.10));
  background:var(--dt-float-bg,rgba(15,17,21,.88));
  color:var(--dt-float-text,#fff);
  backdrop-filter:blur(16px) saturate(160%);
  -webkit-backdrop-filter:blur(16px) saturate(160%);
  box-shadow:0 12px 30px rgba(0,0,0,.28);
  cursor:pointer;
  padding:0;
  min-width:0;
}

.dt-floating-switcher__trigger:hover{
  filter:brightness(1.04);
}

.dt-floating-switcher__trigger:focus-visible{
  outline:2px solid var(--dt-primary);
  outline-offset:2px;
}

.dt-floating-switcher--pill .dt-floating-switcher__trigger{
  border-radius:999px;
}

.dt-floating-switcher--rounded .dt-floating-switcher__trigger{
  border-radius:18px;
}

.dt-floating-switcher--sm .dt-floating-switcher__trigger-inner{
  padding:10px 12px;
  font-size:13px;
}

.dt-floating-switcher--md .dt-floating-switcher__trigger-inner{
  padding:12px 14px;
  font-size:14px;
}

.dt-floating-switcher--lg .dt-floating-switcher__trigger-inner{
  padding:14px 16px;
  font-size:15px;
}

.dt-floating-switcher__trigger-inner{
  display:inline-flex;
  align-items:center;
  gap:10px;
  line-height:1;
  font-weight:600;
}

.dt-floating-switcher__flag{
  width:18px;
  height:18px;
  border-radius:999px;
  object-fit:cover;
  flex:0 0 auto;
}

.dt-floating-switcher__current-label{
  white-space:nowrap;
}

.dt-floating-switcher__chevron{
  font-size:12px;
  opacity:.72;
  transition:transform .18s ease;
}

.dt-floating-switcher.is-open .dt-floating-switcher__chevron{
  transform:rotate(180deg);
}

.dt-floating-switcher__panel{
  position:absolute;
  bottom:calc(100% + 10px);
  min-width:190px;
  padding:8px;
  border:1px solid var(--dt-float-border,rgba(255,255,255,.10));
  background:var(--dt-float-bg,rgba(15,17,21,.92));
  color:var(--dt-float-text,#fff);
  backdrop-filter:blur(18px) saturate(160%);
  -webkit-backdrop-filter:blur(18px) saturate(160%);
  box-shadow:0 18px 40px rgba(0,0,0,.32);
  opacity:0;
  visibility:hidden;
  transform:translateY(8px);
  transition:opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.dt-floating-switcher--right .dt-floating-switcher__panel{
  right:0;
}

.dt-floating-switcher--left .dt-floating-switcher__panel{
  left:0;
}

.dt-floating-switcher--pill .dt-floating-switcher__panel{
  border-radius:22px;
}

.dt-floating-switcher--rounded .dt-floating-switcher__panel{
  border-radius:18px;
}

.dt-floating-switcher.is-open .dt-floating-switcher__panel{
  opacity:1;
  visibility:visible;
  transform:translateY(0);
}

.dt-floating-switcher__item{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color:var(--dt-float-text,#fff);
  padding:11px 12px;
  border-radius:14px;
  transition:background-color .16s ease, color .16s ease;
}

.dt-floating-switcher__item:hover{
  background:var(--dt-float-hover-bg,rgba(255,255,255,.08));
  color:var(--dt-float-hover-text,#fff);
}

.dt-floating-switcher__item:focus-visible{
  outline:2px solid var(--dt-primary);
  outline-offset:2px;
}

.dt-floating-switcher__item.is-active{
  background:var(--dt-float-active-bg,#0a84ff);
  color:var(--dt-float-active-text,#fff);
}

.dt-floating-switcher__item-label{
  white-space:nowrap;
}

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce){
  .dt-lang-widget *,
  .dt-lang-shortcode *,
  .dt-lang-dd-wrap *,
  .dt-floating-switcher *,
  #dt-translator-bar *,
  body.dt-edit-mode *{
    transition:none !important;
    animation:none !important;
  }
}