/* ==============================================================================
   I18N.CSS — Premium Multilingual & RTL System Styles
   CryptoJourney — Binance Landing Page
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&display=swap');

/* ------------------------------------------------------------------------------
   1. LANGUAGE SWITCHER (NAVBAR DESKTOP)
   ------------------------------------------------------------------------------ */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 1050;
  font-family: var(--font-primary);
}

.lang-switcher__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 20, 20, 0.7);
  border: 1px solid rgba(243, 186, 47, 0.25);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-primary);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  user-select: none;
  outline: none;
}

.lang-switcher__btn:hover {
  border-color: var(--gold);
  background: rgba(243, 186, 47, 0.1);
  box-shadow: 0 0 16px rgba(243, 186, 47, 0.2);
  transform: translateY(-1px);
}

.lang-switcher__btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.lang-switcher--open .lang-switcher__btn {
  border-color: var(--gold);
  background: rgba(243, 186, 47, 0.15);
  box-shadow: 0 0 20px rgba(243, 186, 47, 0.25);
}

.lang-switcher__flag {
  font-size: 1.15rem;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

.lang-switcher__label {
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.lang-switcher__arrow {
  width: 14px;
  height: 14px;
  stroke: var(--text-secondary);
  transition: transform var(--duration-fast) var(--ease-out), stroke var(--duration-fast);
  flex-shrink: 0;
}

.lang-switcher__btn:hover .lang-switcher__arrow,
.lang-switcher--open .lang-switcher__arrow {
  stroke: var(--gold);
}

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

/* Dropdown Menu */
.lang-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: rgba(14, 14, 14, 0.95);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(243, 186, 47, 0.22);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.8), 0 0 24px rgba(243, 186, 47, 0.12);
  padding: 6px;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out), visibility 0.2s;
  pointer-events: none;
  z-index: 1060;
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 186, 47, 0.3) transparent;
}

.lang-switcher__menu::-webkit-scrollbar {
  width: 5px;
}
.lang-switcher__menu::-webkit-scrollbar-thumb {
  background: rgba(243, 186, 47, 0.3);
  border-radius: 4px;
}

.lang-switcher--open .lang-switcher__menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Dropdown Items */
.lang-switcher__item {
  margin: 0;
  padding: 0;
}

.lang-switcher__option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
}

.lang-switcher__option-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switcher__option-names {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.lang-switcher__native-name {
  color: var(--text-primary);
  font-weight: 600;
}

.lang-switcher__en-name {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.lang-switcher__check {
  width: 16px;
  height: 16px;
  stroke: var(--gold);
  opacity: 0;
  transform: scale(0.6);
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.lang-switcher__option:hover,
.lang-switcher__option:focus-visible {
  background: rgba(243, 186, 47, 0.1);
  color: var(--text-primary);
  transform: translateX(2px);
}

.lang-switcher__option:hover .lang-switcher__native-name,
.lang-switcher__option:focus-visible .lang-switcher__native-name {
  color: var(--gold);
}

.lang-switcher__option--active {
  background: rgba(243, 186, 47, 0.12);
}

.lang-switcher__option--active .lang-switcher__native-name {
  color: var(--gold);
}

.lang-switcher__option--active .lang-switcher__check {
  opacity: 1;
  transform: scale(1);
}

/* ------------------------------------------------------------------------------
   2. MOBILE LANGUAGE SELECTOR (INSIDE MOBILE DRAWER)
   ------------------------------------------------------------------------------ */
.mobile-lang-switcher {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
}

.mobile-lang-switcher__title {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 0.75rem;
}

.mobile-lang-switcher__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mobile-lang-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: rgba(20, 20, 20, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration-fast);
  outline: none;
}

.mobile-lang-btn:hover {
  border-color: var(--gold);
  background: rgba(243, 186, 47, 0.08);
  color: var(--text-primary);
}

.mobile-lang-btn--active {
  border-color: var(--gold);
  background: rgba(243, 186, 47, 0.15);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(243, 186, 47, 0.2);
}

/* ------------------------------------------------------------------------------
   3. LANGUAGE CHANGE TOAST NOTIFICATION
   ------------------------------------------------------------------------------ */
.i18n-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 14, 14, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(243, 186, 47, 0.35);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 20px rgba(243, 186, 47, 0.15);
  padding: 12px 22px;
  border-radius: var(--radius-full);
  color: #ffffff;
  font-size: 0.9375rem;
  font-weight: 500;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.i18n-toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.i18n-toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(243, 186, 47, 0.18);
  color: var(--gold);
  flex-shrink: 0;
}

/* Smooth content transition indicator */
.i18n-transitioning * {
  transition: opacity 0.15s ease-out !important;
}

/* ------------------------------------------------------------------------------
   4. RTL LAYOUT SYSTEM (FOR ARABIC)
   ------------------------------------------------------------------------------ */
html[dir="rtl"],
body.rtl {
  font-family: 'Cairo', var(--font-primary);
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6 {
  font-family: 'Cairo', var(--font-display);
  letter-spacing: normal;
}

/* RTL Navigation */
html[dir="rtl"] .nav__inner {
  direction: rtl;
}

html[dir="rtl"] .nav__logo {
  order: 1;
}

html[dir="rtl"] .nav__links {
  order: 2;
}

html[dir="rtl"] .nav__cta {
  order: 3;
}

html[dir="rtl"] .nav__mobile-toggle {
  order: 4;
}

/* RTL Language Switcher Dropdown */
html[dir="rtl"] .lang-switcher__menu {
  right: auto;
  left: 0;
  transform-origin: top left;
}

html[dir="rtl"] .lang-switcher__option {
  text-align: right;
}

html[dir="rtl"] .lang-switcher__option:hover,
html[dir="rtl"] .lang-switcher__option:focus-visible {
  transform: translateX(-2px);
}

/* RTL Hero Section */
html[dir="rtl"] .hero__content {
  direction: rtl;
}

html[dir="rtl"] .hero__text {
  text-align: right;
}

html[dir="rtl"] .hero__badge-dot {
  margin-right: 0;
  margin-left: var(--space-xs);
}

html[dir="rtl"] .hero__ctas {
  justify-content: flex-start;
}

html[dir="rtl"] .hero__trust-row {
  justify-content: flex-start;
}

html[dir="rtl"] .hero__trust-item {
  direction: rtl;
}

/* RTL Dashboard Widget */
html[dir="rtl"] .dashboard__float--1 {
  right: auto;
  left: -20px;
}

html[dir="rtl"] .dashboard__float--2 {
  left: auto;
  right: -20px;
}

html[dir="rtl"] .dashboard__asset-left {
  direction: rtl;
}

html[dir="rtl"] .dashboard__header {
  direction: rtl;
}

/* RTL Story Section */
html[dir="rtl"] .story__text {
  text-align: right;
}

html[dir="rtl"] .story__narrative p {
  text-align: right;
}

html[dir="rtl"] .story__journey-step {
  text-align: right;
  border-left: none;
  border-right: 3px solid var(--border-subtle);
  padding-left: 0;
  padding-right: var(--space-md);
}

html[dir="rtl"] .story__journey-step:hover {
  border-right-color: var(--gold);
}

/* RTL Section Center Rules */
html[dir="rtl"] .section--center {
  text-align: center;
}

html[dir="rtl"] .section--center .why-crypto__card,
html[dir="rtl"] .section--center .why-binance__card,
html[dir="rtl"] .section--center .feature-card,
html[dir="rtl"] .section--center .trust-card {
  text-align: right;
}

/* RTL Timeline Steps */
html[dir="rtl"] .timeline__steps {
  direction: rtl;
}

html[dir="rtl"] .timeline__step-content {
  text-align: right;
}

/* RTL FAQ Accordion */
html[dir="rtl"] .faq__question {
  text-align: right;
  direction: rtl;
}

html[dir="rtl"] .faq__icon {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .faq__answer-inner {
  text-align: right;
  direction: rtl;
}

/* RTL Directional Arrow Flips */
html[dir="rtl"] .btn--secondary svg,
html[dir="rtl"] .story__journey-step-title svg {
  transform: scaleX(-1);
}

/* RTL Footer */
html[dir="rtl"] .footer__top {
  direction: rtl;
}

html[dir="rtl"] .footer__brand {
  text-align: right;
}

html[dir="rtl"] .footer__links {
  direction: rtl;
}

html[dir="rtl"] .footer__link-group {
  text-align: right;
}

html[dir="rtl"] .footer__disclaimer {
  text-align: right;
}

html[dir="rtl"] .footer__copyright {
  text-align: right;
}

/* RTL Toast Notification */
html[dir="rtl"] .i18n-toast {
  right: auto;
  left: 24px;
  direction: rtl;
}

/* RTL Popups */
html[dir="rtl"] .popup,
html[dir="rtl"] .popup2,
html[dir="rtl"] .exit-popup {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .popup__close,
html[dir="rtl"] .popup2__close,
html[dir="rtl"] .exit-popup__close {
  right: auto;
  left: 1rem;
}

html[dir="rtl"] .popup__headline,
html[dir="rtl"] .popup__message,
html[dir="rtl"] .popup2__headline,
html[dir="rtl"] .popup2__subheadline,
html[dir="rtl"] .popup2__message,
html[dir="rtl"] .popup2__disclaimer,
html[dir="rtl"] .exit-popup__headline,
html[dir="rtl"] .exit-popup__subtitle,
html[dir="rtl"] .exit-popup__warning-text {
  text-align: right;
}

html[dir="rtl"] .popup2__reward-text,
html[dir="rtl"] .exit-popup__feature-content {
  text-align: right;
}

html[dir="rtl"] .popup__actions,
html[dir="rtl"] .popup2__actions,
html[dir="rtl"] .exit-popup__actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .exit-popup__feature-icon {
  margin-right: 0;
  margin-left: 1rem;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .lang-switcher__label {
    display: none;
  }
  .lang-switcher__btn {
    padding: 7px 10px;
  }
}

@media (max-width: 768px) {
  html[dir="rtl"] .popup__actions,
  html[dir="rtl"] .popup2__actions,
  html[dir="rtl"] .exit-popup__actions {
    flex-direction: column;
  }
  .i18n-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-content: center;
  }
}
