/* JRV Translation Studio — widget público (prefixo isolado) */

.jrv-translation-widget {
  position: fixed;
  z-index: 2147483000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: #1f2937;
  box-sizing: border-box;
}

.jrv-translation-widget *,
.jrv-translation-widget *::before,
.jrv-translation-widget *::after {
  box-sizing: border-box;
}

.jrv-translation-widget--top-right {
  top: 12px;
  right: 12px;
}

.jrv-translation-widget--top-left {
  top: 12px;
  left: 12px;
}

.jrv-translation-widget--bottom-right {
  bottom: 12px;
  right: 12px;
}

.jrv-translation-widget--bottom-left {
  bottom: 12px;
  left: 12px;
}

.jrv-translation-widget--inline-header {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  bottom: auto;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  z-index: 50;
}

.jrv-translation-widget--inline-header .jrv-translation-menu {
  right: 0;
  left: auto;
}

.jrv-translation-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.jrv-translation-toggle:hover,
.jrv-translation-toggle:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.18);
}

.jrv-translation-toggle[aria-expanded="true"] {
  border-color: rgba(37, 99, 235, 0.55);
}

.jrv-translation-flag {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.jrv-translation-label {
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.jrv-translation-chevron {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #64748b;
  transition: transform 0.15s ease;
}

.jrv-translation-toggle[aria-expanded="true"] .jrv-translation-chevron {
  transform: rotate(180deg);
}

.jrv-translation-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  max-width: min(92vw, 260px);
  max-height: min(60vh, 320px);
  overflow: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.jrv-translation-widget--top-left .jrv-translation-menu,
.jrv-translation-widget--bottom-left .jrv-translation-menu {
  right: auto;
  left: 0;
}

.jrv-translation-widget--bottom-right .jrv-translation-menu,
.jrv-translation-widget--bottom-left .jrv-translation-menu {
  top: auto;
  bottom: calc(100% + 8px);
  transform: translateY(4px);
}

.jrv-translation-menu[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.jrv-translation-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.jrv-translation-option:hover,
.jrv-translation-option:focus {
  outline: none;
  background: #f1f5f9;
}

.jrv-translation-option.is-active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.jrv-translation-option-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jrv-translation-option-code {
  font-size: 11px;
  color: #64748b;
}

.jrv-translation-menu-footer {
  margin: 6px 0 0;
  padding: 6px 0 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  list-style: none;
}

.jrv-translation-sync-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.jrv-translation-sync-button:hover:not(:disabled),
.jrv-translation-sync-button:focus:not(:disabled) {
  outline: none;
  background: #1d4ed8;
}

.jrv-translation-sync-button:disabled {
  opacity: 0.82;
  cursor: wait;
}

.jrv-translation-sync-spinner--button {
  width: 14px;
  height: 14px;
  border-width: 2px;
  border-color: rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
}

@media (max-width: 480px) {
  .jrv-translation-widget--top-right,
  .jrv-translation-widget--top-left {
    top: 8px;
  }

  .jrv-translation-widget--top-right,
  .jrv-translation-widget--bottom-right {
    right: 8px;
  }

  .jrv-translation-widget--top-left,
  .jrv-translation-widget--bottom-left {
    left: 8px;
  }

  .jrv-translation-toggle {
    min-height: 34px;
    padding: 5px 10px;
    font-size: 12px;
  }
}

.jrv-translation-widget--syncing .jrv-translation-toggle {
  cursor: wait;
  border-color: rgba(37, 99, 235, 0.45);
}

.jrv-translation-toggle:disabled {
  opacity: 0.92;
  cursor: wait;
}

.jrv-translation-sync-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid rgba(37, 99, 235, 0.18);
  border-top-color: #2563eb;
  border-radius: 50%;
  flex-shrink: 0;
  animation: jrv-translation-sync-spin 0.75s linear infinite;
}

.jrv-translation-sync-spinner--toggle {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.jrv-translation-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes jrv-translation-sync-spin {
  to {
    transform: rotate(360deg);
  }
}
