/* frontend.css */
/* =========================================
   AnyWareX Clone Translate – Language Switcher
   ========================================= */

/* -----------------------------------------
   Base: Menu Item (Desktop & Mobile)
   ----------------------------------------- */

.menu-item-awxct-lang {
  display: flex;
  align-items: center;
  position: relative;
}

.menu-item-awxct-lang .awxct-plg-ct-switcher {
  display: inline-flex;
  align-items: center;
  position: relative;
  z-index: 10;
}

/* Unified button design (light pill-style) */
.menu-item-awxct-lang .awxct-plg-ct-btn,
#awxct-plg-ct-switcher-root .awxct-plg-ct-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  line-height: 1;
  cursor: pointer;

  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: inherit;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);

  font-size: 0.95rem;
  -webkit-tap-highlight-color: transparent;
}

/* Hover/Focus: slightly stronger shadow */
.menu-item-awxct-lang .awxct-plg-ct-btn:hover,
.menu-item-awxct-lang .awxct-plg-ct-btn:focus-visible,
#awxct-plg-ct-switcher-root .awxct-plg-ct-btn:hover,
#awxct-plg-ct-switcher-root .awxct-plg-ct-btn:focus-visible {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

/* Dropdown menu (light unified look) */
.menu-item-awxct-lang .awxct-plg-ct-menu,
#awxct-plg-ct-switcher-root .awxct-plg-ct-menu {
  position: absolute;
  top: calc(100% + 6px);
  min-width: 72px;
  list-style: none;
  margin: 0;
  padding: 8px;

  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 16px;
  background: #ffffff;
  color: inherit;
  display: none;
  z-index: 9999;
}

/* Show dropdown when parent has .open */
.menu-item-awxct-lang .awxct-plg-ct-switcher.open .awxct-plg-ct-menu,
#awxct-plg-ct-switcher-root .awxct-plg-ct-switcher.open .awxct-plg-ct-menu {
  display: block;
}

/* Alignment inside header menu: align right */
.menu-item-awxct-lang .awxct-plg-ct-menu {
  right: 0;
  left: auto;
}

/* Floating switcher default: align left */
#awxct-plg-ct-switcher-root .awxct-plg-ct-menu {
  left: 0;
  right: auto;
}

/* Floating switcher when aligned right */
#awxct-plg-ct-switcher-root.awxct-plg-ct-pos-right .awxct-plg-ct-menu {
  left: auto;
  right: 0;
}

/* Dropdown menu items (shared) */
.menu-item-awxct-lang .awxct-plg-ct-item,
#awxct-plg-ct-switcher-root .awxct-plg-ct-item {
  display: block;
  padding: 6px 10px;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;

  font-size: 0.95rem;
  font-weight: 400;
}

.menu-item-awxct-lang .awxct-plg-ct-item:hover,
.menu-item-awxct-lang .awxct-plg-ct-item:focus-visible,
#awxct-plg-ct-switcher-root .awxct-plg-ct-item:hover,
#awxct-plg-ct-switcher-root .awxct-plg-ct-item:focus-visible {
  background: rgba(0, 0, 0, 0.05);
  outline: none;
}

.menu-item-awxct-lang .awxct-plg-ct-item.is-active,
#awxct-plg-ct-switcher-root .awxct-plg-ct-item.is-active {
  font-weight: 600;
}

/* Caret arrow */
.awxct-plg-ct-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transition: transform 0.2s ease;
  transform-origin: 50% 40%;
  opacity: 0.9;
}

.awxct-plg-ct-switcher.open .awxct-plg-ct-caret {
  transform: rotate(180deg);
}

/* Remove default browser focus outlines;
   accessibility relies on :focus-visible styling */
.awxct-plg-ct-btn:focus,
.awxct-plg-ct-btn:active {
  outline: none !important;
  box-shadow: none !important;
}

/* --- AnyWareX Clone Translate – Label / Flag --- */
.awxct-plg-ct-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.awxct-plg-ct-item.is-active {
  outline: none;
}

.awxct-plg-ct-item:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.awxct-plg-ct-flag {
  display: inline-block;
  border-radius: 2px;
  vertical-align: middle;
}

.awxct-plg-ct-flag-emoji {
  font-size: 1.05em;
  line-height: 1;
}

.awxct-plg-ct-label {
  line-height: 1;
}

.awxct-plg-ct-select {
  min-width: 220px;
}

.awxct-plg-ct-form {
  margin: 16px 0;
}

/* Flag icon tweaks (flag-icons or SVG flags) */
.awxct-plg-ct-lang-switcher .awxct-plg-ct-flag,
.awxct-plg-ct-switcher .awxct-plg-ct-flag {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.375rem;
}

.awxct-plg-ct-lang-switcher .fi.awxct-plg-ct-flag,
.awxct-plg-ct-switcher .fi.awxct-plg-ct-flag {
  width: 1.15em;
  height: 0.85em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06) inset;
}

.awxct-plg-ct-menu .fi.awxct-plg-ct-flag {
  margin-right: 0.5rem;
}

.awxct-plg-ct-btn .fi.awxct-plg-ct-flag + .awxct-plg-ct-caret {
  margin-left: 0.25rem;
}

/* -----------------------------------------
   Mobile Tweaks (≤ 992px)
   ----------------------------------------- */
@media (max-width: 992px) {
  :root {
    --awxct-gap-right: 0px; /* Distance to hamburger column */
  }

  /* Shared container (hamburger + switcher) without gaps */
  .navbar-collapse.collapse.d-flex.flex-row-reverse {
    justify-content: flex-end !important;
    gap: 0 !important;
    padding: 0 !important;
  }

  /* Prevent .navbar-brand block from expanding */
  .navbar-collapse.collapse.d-flex.flex-row-reverse > .navbar-brand {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Shrinkable #menu-primary inside header */
  .navbar-collapse.collapse.d-flex.flex-row-reverse
    > .navbar-brand
    > #menu-primary {
    width: auto !important;
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  #menu-primary.navbar-nav.nav-fill,
  #menu-primary.navbar-nav.nav-justified {
    flex: 0 0 auto !important;
  }

  /* Remove stretch on LI items */
  #menu-primary.navbar-nav > li {
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Language switcher aligned to the right */
  #menu-primary.navbar-nav > li.menu-item-awxct-lang {
    margin-left: auto !important;
    margin-right: var(--awxct-gap-right) !important;
    padding-right: 0 !important;
  }

  /* Compact button */
  #menu-primary.navbar-nav > li.menu-item-awxct-lang .awxct-plg-ct-btn {
    height: 32px !important;
    padding: 0 12px !important;
    line-height: 1 !important;
    border-radius: 999px !important;
    margin-top: 0 !important;
  }

  /* Compact dropdown */
  #menu-primary .awxct-plg-ct-menu {
    min-width: auto !important;
    width: auto !important;
    padding: 4px 8px !important;
  }

  #menu-primary .awxct-plg-ct-item {
    font-size: inherit !important;
    font-weight: normal !important;
    padding: 6px 8px !important;
    line-height: 1.4 !important;
  }

  #menu-primary .awxct-plg-ct-item.is-active {
    font-weight: 600 !important;
  }

  /* Hamburger safety: no left margin */
  .navbar-collapse.collapse.d-flex.flex-row-reverse
    > .navbar-icons
    .navbar-hamburger,
  .navbar-toggler {
    margin-left: 0 !important;
  }

  /* Ensure button border visibility on mobile */
  .menu-item-awxct-lang .awxct-plg-ct-btn {
    border-width: 1px !important;
  }
}

/* -----------------------------------------
   Remove fine lines / separators added by theme
   ----------------------------------------- */
#menu-primary .menu-item-awxct-lang,
#menu-primary .menu-item-awxct-lang > a,
#menu-primary .menu-item-awxct-lang > .nav-link,
#menu-primary .menu-item-awxct-lang > .awxct-plg-ct-switcher,
#menu-primary .menu-item-awxct-lang > .awxct-plg-ct-switcher > .awxct-plg-ct-btn {
  border: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  background-image: none !important;
}

/* Remove theme pseudo-separators */
#menu-primary .menu-item-awxct-lang::before,
#menu-primary .menu-item-awxct-lang::after,
#menu-primary .menu-item-awxct-lang > a::before,
#menu-primary .menu-item-awxct-lang > a::after,
#menu-primary .menu-item-awxct-lang > .nav-link::before,
#menu-primary .menu-item-awxct-lang > .nav-link::after,
#menu-primary .menu-item-awxct-lang > .awxct-plg-ct-switcher::before,
#menu-primary .menu-item-awxct-lang > .awxct-plg-ct-switcher::after,
#menu-primary
  .menu-item-awxct-lang
  > .awxct-plg-ct-switcher
  > .awxct-plg-ct-btn::before,
#menu-primary
  .menu-item-awxct-lang
  > .awxct-plg-ct-switcher
  > .awxct-plg-ct-btn::after {
  content: none !important;
  border: 0 !important;
  box-shadow: none !important;
  background: none !important;
}

/* Remove mobile separators if theme applies them globally */
.navbar-nav > li.menu-item-awxct-lang,
.navbar-nav > li.menu-item-awxct-lang > a {
  border-bottom: 0 !important;
}

/* Additional safety for the button itself */
.menu-item-awxct-lang .awxct-plg-ct-btn {
  outline: none !important;
  background-clip: padding-box;
}

/* =========================================
   Fallback: Stand-alone Switcher Root
   ========================================= */

#awxct-plg-ct-switcher-root {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 9999;
}

/* If WP admin bar is visible, move switcher down */
body.admin-bar #awxct-plg-ct-switcher-root {
  top: 50px;
}

/* On smaller screens the admin bar is taller */
@media (max-width: 782px) {
  body.admin-bar #awxct-plg-ct-switcher-root {
    top: 50px;
  }
}

/* Floating right instead of left */
#awxct-plg-ct-switcher-root.awxct-plg-ct-pos-right {
  right: 8px;
  left: auto;
}

/* Remove focus outlines on dropdown containers */
.menu-item-awxct-lang .awxct-plg-ct-menu:focus,
.menu-item-awxct-lang .awxct-plg-ct-menu:focus-visible,
#awxct-plg-ct-switcher-root .awxct-plg-ct-menu:focus,
#awxct-plg-ct-switcher-root .awxct-plg-ct-menu:focus-visible {
  outline: none !important;
}

/* -----------------------------------------
   UI tweaks (menu-end consistency)
   Added during 2.0.6 testing – keep minimal
   ----------------------------------------- */

/* Align flags in a single vertical column inside the dropdown */
.awxct-plg-ct-menu .awxct-plg-ct-flag {
  width: 20px;
  min-width: 20px;
  text-align: center;
}

/* Dropdown: slightly lower + a bit more spacing between items + tiny inner right shift */
.awxct-plg-ct-menu {
  top: calc(100% + 10px);
  padding-left: calc(8px + 3px) !important;

  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Slightly taller click area per item (keeps hover look) */
.awxct-plg-ct-menu .awxct-plg-ct-item {
  padding: 4px 10px;
}

/* Menu-end: button should not look floating (dropdown keeps shadow) */
.menu-item-awxct-lang .awxct-plg-ct-btn {
  box-shadow: none !important;
}

/* Prevent theme menu link styles (e.g. underline) from affecting dropdown items */
.awxct-plg-ct-menu .awxct-plg-ct-item {
  text-decoration: none !important;
  color: inherit;
}

/* Make menu-end dropdown identical to floating (typography inherits from plugin) */
.menu-item-awxct-lang .awxct-plg-ct-menu {
  font-size: inherit;
  line-height: normal;
}

