/* Contenedor base */
.uiaa-tr {
  --uiaa-tr-fg: #fff;
  --uiaa-tr-border: #ddd;
  --uiaa-tr-bg: transparent;
  color: var(--uiaa-tr-fg);
  background: var(--uiaa-tr-bg);
  border: 1px solid var(--uiaa-tr-border);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
}

/* Header / Toggle */
.uiaa-tr__header { display: block; }
.uiaa-tr__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: inherit;
  border: 0;
  padding: 8px 2px;
  cursor: pointer;
}
.uiaa-tr__title { font-weight: 600; font-size: 1.05rem; line-height: 1.2; }
.uiaa-tr__chevron {
  width: 12px; height: 12px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s ease;
  margin-left: 8px;
}
.uiaa-tr__toggle[aria-expanded="true"] .uiaa-tr__chevron { transform: rotate(45deg); }

/* Contenido */
.uiaa-tr__content { margin-top: 8px; }

/* Lista común */
.uiaa-tr__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* GRID */
.uiaa-tr--grid .uiaa-tr__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .uiaa-tr--grid .uiaa-tr__list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 980px) {
  .uiaa-tr--grid .uiaa-tr__list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* LIST */
.uiaa-tr--list .uiaa-tr__list { display: flex; flex-direction: column; gap: 8px; }

/* Item / Link */
.uiaa-tr__item { margin: 0; }
.uiaa-tr__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--uiaa-tr-border);
  border-radius: 8px;
  padding: 8px 10px;
  transition: box-shadow .15s ease, transform .05s ease;
}
.uiaa-tr__link:hover { box-shadow: 0 1px 6px rgba(0,0,0,.08); }
.uiaa-tr__link:active { transform: translateY(1px); }

/* Banderas / Icono */
.uiaa-tr__flags {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* IMPORTANTE: nunca ocultamos el span de idioma aunque no haya banderas */
  min-width: 20px; /* reserva espacio para icono por defecto */
}

.uiaa-tr__flag {
  width: 20px;
  height: 14px;
  object-fit: cover;
  border-radius: 2px;
  display: inline-block;
}

.uiaa-tr__flag--default {
  width: 20px;
  height: 20px;
  border-radius: 3px;
  object-fit: contain;
}

/* Contenedor del SVG por defecto (cuando no hay banderas) */
.uiaa-tr__fileicon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

/* Nombre del idioma: SIEMPRE visible */
.uiaa-tr__lang {
  display: inline-block;
  margin-left: 2px;
  font-size: .95rem;
  line-height: 1.2;
  font-weight: 500;
  /* Nunca ocultar el nombre por reglas de “si no hay bandera” */
}

/* Hardening: evita que temas/constructores oculten spans vacíos y arrastren el de idioma */
.uiaa-tr__flags:empty { display: inline-flex; } /* nunca colapsa */
