/* ==============================
   CLE – Language Switcher
   lang.css
   ============================== */

#lang-switcher {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: Arial, sans-serif;
}

#lang-current-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 30px;
  cursor: pointer;
  color: #fff;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.05em;
  transition: background 0.2s, border-color 0.2s;
  white-space: nowrap;
}

#lang-current-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  border-color: rgba(255, 255, 255, 0.4);
}

#lang-current-btn img {
  width: 24px;
  height: 17px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: block;
}

.lang-chevron {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.25s;
}

#lang-switcher.open .lang-chevron {
  transform: rotate(180deg);
}

#lang-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#lang-switcher.open #lang-options {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.lang-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  cursor: pointer;
  color: #ccc;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.05em;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.lang-option-btn:hover {
  background: rgba(30, 30, 30, 0.95);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.lang-option-btn img {
  width: 24px;
  height: 17px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: block;
}

/* ==============================
   RTL Layout
   ============================== */

body.lang-rtl {
  direction: rtl;
  text-align: right;
}

/* Desktop-only RTL menu layout (above 992px) */
@media (min-width: 993px) {
  body.lang-rtl .navbar {
    flex-direction: row-reverse;
  }

  body.lang-rtl .icon {
    order: 2;
    flex-shrink: 0;
    width: 300px;
  }

  body.lang-rtl .menu {
    order: 1;
    width: calc(100% - 360px);
    display: flex;
    align-items: center;
  }

  body.lang-rtl .menu ul {
    float: none;
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: center;
    width: 100%;
    margin-top: 0;
    padding: 0;
  }

  body.lang-rtl .menu ul li {
    margin: 0;
    margin-top: 0;
  }
}

/* ==============================
   RTL Mobile Menu Fix
   ============================== */

/* On desktop, RTL menu stays full-width flex row — no changes needed */

/* On mobile (hamburger active), override the LTR slide-in-from-right
   so the panel slides in from the LEFT instead */
@media (max-width: 992px) {

  /* Keep icon width the same */
  body.lang-rtl .icon {
    width: 300px;
    float: right;
  }

  /* Reset the flex layout override — let mobile styles take over */
  body.lang-rtl .menu {
    width: 70%;
    /* Override: slide from LEFT instead of right */
    right: auto;
    left: 0;
    /* Reset flex overrides from desktop RTL rules */
    display: none;
    flex-direction: unset;
    align-items: unset;
  }

  body.lang-rtl .menu.active {
    display: block;
    right: auto;
    left: 0;
  }

  body.lang-rtl .menu ul {
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
  }

  /* Move hamburger toggle to LEFT side in RTL */
  body.lang-rtl .menu-toggle {
    right: auto;
    left: 20px;
    position: absolute;
  }
}

@media (max-width: 704px) {
  body.lang-rtl .icon {
    float: right;
  }
  body.lang-rtl .menu {
    right: auto;
    left: 0;
  }
  body.lang-rtl .menu.active {
    right: auto;
    left: 0;
  }
  body.lang-rtl .menu-toggle {
    right: auto;
    left: 20px;
  }
}
