/**
 * Ocopress Translate — Frontend Language Switcher Styles.
 */

/* Language Switcher Container */
.oco-trsl-switcher {
  position: relative;
  display: inline-flex;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  z-index: 9999;
}

/* Current Language Button */
.oco-trsl-switcher__current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  color: inherit;
  font-size: inherit;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.oco-trsl-switcher__current:hover {
  border-color: #9ca3af;
}

.oco-trsl-switcher__current:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* Chevron icon */
.oco-trsl-chevron {
  transition: transform 0.2s ease;
}

.oco-trsl-switcher__current[aria-expanded="true"] .oco-trsl-chevron {
  transform: rotate(180deg);
}

/* Dropdown */
.oco-trsl-switcher__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  margin: 0;
  padding: 4px 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  list-style: none;
  z-index: 10000;
}

/* Dropdown Item */
.oco-trsl-switcher__item {
  margin: 0;
  padding: 0;
}

.oco-trsl-switcher__link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: #374151;
  text-decoration: none;
  transition: background 0.1s ease;
}

.oco-trsl-switcher__link:hover {
  background: #f3f4f6;
  color: #111827;
}

/* WCAG 2.4.7 — visible keyboard focus on menu links (mirrors :focus-visible on __current). */
.oco-trsl-switcher__link:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
  background: #eff6ff;
  color: #1d4ed8;
}

.oco-trsl-switcher__item--active .oco-trsl-switcher__link {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 500;
}

/* Flag & Name */
.oco-trsl-flag {
  font-size: 1.15em;
  line-height: 1;
}

.oco-trsl-name {
  white-space: nowrap;
}

/* Responsive: on small screens, hide language names, show only flags */
@media (max-width: 480px) {
  .oco-trsl-switcher__current .oco-trsl-name {
    display: none;
  }

  .oco-trsl-switcher__current {
    padding: 6px 8px;
  }
}

/* ── Language Detection Banner ─────────────────────────────────────── */
.oco-trsl-banner {
  position: relative;
  z-index: 99999;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
}

.oco-trsl-banner__content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.oco-trsl-banner__text {
  opacity: 0.95;
}

.oco-trsl-banner__switch {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: #fff;
  font-weight: 500;
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.oco-trsl-banner__switch:hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.oco-trsl-banner__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* WCAG 2.5.5 — minimum target size 24×24 px, padding extends the hit area. */
  width: 24px;
  height: 24px;
  /* 6px padding extends the visual touch target to 36×36 px total. */
  padding: 6px;
  /* Use negative margin to compensate for extra padding so layout is unchanged. */
  margin: -6px -6px -6px 0;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.oco-trsl-banner__close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

/* WCAG 2.4.7 — visible keyboard focus on the close button. */
.oco-trsl-banner__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .oco-trsl-banner__content {
    flex-wrap: wrap;
    text-align: center;
    gap: 8px;
    padding: 10px 16px;
  }

  .oco-trsl-banner__text {
    flex: 1 1 100%;
  }
}
